Browse Source

Small layout corrections

tags/v0.16^2
Frans Bouma 8 years ago
parent
commit
068d152b39
4 changed files with 5 additions and 17 deletions
  1. +2
    -5
      src/DocNet/Engine.cs
  2. +1
    -4
      src/DocNet/NavigationContext.cs
  3. +2
    -6
      src/DocNet/StringExtensions.cs
  4. +0
    -2
      src/DocNet/UrlFormatting.cs

+ 2
- 5
src/DocNet/Engine.cs View File

@@ -45,9 +45,7 @@ namespace Docnet
return 1;
}

var navigationContext = new NavigationContext(_loadedConfig.PathSpecification, _loadedConfig.UrlFormatting,
_loadedConfig.MaxLevelInToC, _loadedConfig.StripIndexHtm);

var navigationContext = new NavigationContext(_loadedConfig.PathSpecification, _loadedConfig.UrlFormatting, _loadedConfig.MaxLevelInToC, _loadedConfig.StripIndexHtm);
GeneratePages(navigationContext);
return 0;
}
@@ -75,8 +73,7 @@ namespace Docnet
return null;
}

var navigationContext = new NavigationContext(config.PathSpecification, config.UrlFormatting,
config.MaxLevelInToC, config.StripIndexHtm);
var navigationContext = new NavigationContext(config.PathSpecification, config.UrlFormatting, config.MaxLevelInToC, config.StripIndexHtm);

var indexElement = config.Pages.GetIndexElement(navigationContext);
if(indexElement == null)


+ 1
- 4
src/DocNet/NavigationContext.cs View File

@@ -4,7 +4,7 @@
{
public NavigationContext()
{
MaxLevel = 2;
this.MaxLevel = 2;
}

public NavigationContext(PathSpecification pathSpecification, UrlFormatting urlFormatting, int maxLevel, bool stripIndexHtm)
@@ -17,11 +17,8 @@
}

public PathSpecification PathSpecification { get; set; }

public UrlFormatting UrlFormatting { get; set; }

public int MaxLevel { get; set; }

public bool StripIndexHtm { get; set; }
}
}

+ 2
- 6
src/DocNet/StringExtensions.cs View File

@@ -28,17 +28,15 @@ namespace Docnet
throw new ArgumentOutOfRangeException(nameof(urlFormatting), urlFormatting, null);
}

var splitted = value.Split(new[] { "/", "\\" }, StringSplitOptions.RemoveEmptyEntries);

if (replacementValue != null)
{
var doubleReplacementValue = replacementValue + replacementValue;
var regEx = new Regex("[^a-zA-Z0-9 -]");

for (var i = 0; i < splitted.Length; i++)
var splitted = value.Split(new[] { "/", "\\" }, StringSplitOptions.RemoveEmptyEntries);
for(var i = 0; i < splitted.Length; i++)
{
var splittedValue = splitted[i];

splittedValue = regEx.Replace(splittedValue, replacementValue).Replace(" ", replacementValue);

if (!string.IsNullOrEmpty(replacementValue))
@@ -48,13 +46,11 @@ namespace Docnet
splittedValue = splittedValue.Replace(doubleReplacementValue, replacementValue);
}
}

splitted[i] = splittedValue.ToLower();
}

finalValue = string.Join("/", splitted);
}

return finalValue;
}
}

+ 0
- 2
src/DocNet/UrlFormatting.cs View File

@@ -3,9 +3,7 @@
public enum UrlFormatting
{
None,

Strip,

Dashes
}
}

Loading…
Cancel
Save