Browse Source

Expose the option of setting the default HTML file extension for the generated files through the config file.

pull/28/head
Seemant Rajvanshi 10 years ago
parent
commit
0a67cacea8
2 changed files with 13 additions and 5 deletions
  1. +12
    -4
      src/DocNet/Config.cs
  2. +1
    -1
      src/DocNet/SimpleNavigationElement.cs

+ 12
- 4
src/DocNet/Config.cs View File

@@ -64,7 +64,10 @@ namespace Docnet
Console.WriteLine("[ERROR] Page template '{0}' is empty.", _configData.PageTemplate);
return false;
}
return true;
// Set default extension
string defaultExtension = _configData.DefaultExtension;
DefaultExtension = string.IsNullOrWhiteSpace(defaultExtension) ? "htm" : defaultExtension;
return true;
}


@@ -269,7 +272,12 @@ namespace Docnet
}
return rawFolderNames.HasValues ? rawFolderNames.Values<string>().ToList() : new List<string>();
}
}
#endregion
}
}

/// <summary>
/// File extension to be used for the generated HTML files. Defaults to 'htm'
/// </summary>
public static string DefaultExtension = "htm";
#endregion
}
}

+ 1
- 1
src/DocNet/SimpleNavigationElement.cs View File

@@ -210,7 +210,7 @@ namespace Docnet
_targetURLForHTML = (this.Value ?? string.Empty);
if(_targetURLForHTML.ToLowerInvariant().EndsWith(".md"))
{
_targetURLForHTML = _targetURLForHTML.Substring(0, _targetURLForHTML.Length-3) + ".htm";
_targetURLForHTML = String.Format("{0}.{1}", _targetURLForHTML.Substring(0, _targetURLForHTML.Length-3), Config.DefaultExtension);
}
_targetURLForHTML = _targetURLForHTML.Replace("\\", "/");
}


Loading…
Cancel
Save