From 068d152b39ad2a8c5e4707d4204e8769f6726507 Mon Sep 17 00:00:00 2001 From: Frans Bouma Date: Wed, 5 Jul 2017 13:44:25 +0200 Subject: [PATCH] Small layout corrections --- src/DocNet/Engine.cs | 7 ++----- src/DocNet/NavigationContext.cs | 5 +---- src/DocNet/StringExtensions.cs | 8 ++------ src/DocNet/UrlFormatting.cs | 2 -- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/DocNet/Engine.cs b/src/DocNet/Engine.cs index 1dff26a..938d520 100644 --- a/src/DocNet/Engine.cs +++ b/src/DocNet/Engine.cs @@ -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) diff --git a/src/DocNet/NavigationContext.cs b/src/DocNet/NavigationContext.cs index 33c891f..14b091b 100644 --- a/src/DocNet/NavigationContext.cs +++ b/src/DocNet/NavigationContext.cs @@ -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; } } } \ No newline at end of file diff --git a/src/DocNet/StringExtensions.cs b/src/DocNet/StringExtensions.cs index ebf2c41..502f768 100644 --- a/src/DocNet/StringExtensions.cs +++ b/src/DocNet/StringExtensions.cs @@ -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; } } diff --git a/src/DocNet/UrlFormatting.cs b/src/DocNet/UrlFormatting.cs index 7937bb1..0953938 100644 --- a/src/DocNet/UrlFormatting.cs +++ b/src/DocNet/UrlFormatting.cs @@ -3,9 +3,7 @@ public enum UrlFormatting { None, - Strip, - Dashes } } \ No newline at end of file