From be61985ed97608779166c22e65259a4224e82641 Mon Sep 17 00:00:00 2001 From: Frans Bouma Date: Wed, 17 Feb 2016 11:50:43 +0100 Subject: [PATCH] Changes: Implements #14 Added changes so HTML generated for some elements in the ExtraMode extensions work with the CSS in themes. Added dl/dt CSS statements Bumped version to 0.9.0 --- Themes/Default/Destination/css/theme.css | 184 ++++++++++-------- src/DocNet/Properties/AssemblyInfo.cs | 4 +- src/DocNet/SimpleNavigationElement.cs | 4 +- src/DocNet/Utils.cs | 21 +- src/MarkdownDeep/TableSpec.cs | 2 +- .../extramode/Issue26(ExtraMode).html | 2 +- .../extramode/TableAlignment(ExtraMode).html | 2 +- .../extramode/TableFormatting(ExtraMode).html | 2 +- .../extramode/Tables(ExtraMode).html | 2 +- 9 files changed, 122 insertions(+), 101 deletions(-) diff --git a/Themes/Default/Destination/css/theme.css b/Themes/Default/Destination/css/theme.css index 35bb121..49f1dc5 100644 --- a/Themes/Default/Destination/css/theme.css +++ b/Themes/Default/Destination/css/theme.css @@ -220,14 +220,31 @@ code.code-large { font-size: 90%; } -dd { - margin: 0; -} - dfn { font-style: italic; } +dl { + margin-bottom: 24px; +} + +dl dt { + font-weight: bold; +} + +dl p, dl table, dl ul, dl ol { + margin-bottom: 12px !important; +} + +dl dd { + margin: 0 0 12px 24px; +} + +dl:not(.docutils) { + margin-bottom: 24px; +} + + figure { margin: 0; } @@ -317,23 +334,23 @@ input { *vertical-align: middle; } - input[type="text"] { - -webkit-appearance: none; - padding: 6px; - display: inline-block; - border: 1px solid; - font-size: 80%; - box-shadow: inset 0 1px 3px #ddd; - border-radius: 0; - -webkit-transition: border 0.3s linear; - -moz-transition: border 0.3s linear; - transition: border 0.3s linear; - } +input[type="text"] { + -webkit-appearance: none; + padding: 6px; + display: inline-block; + border: 1px solid; + font-size: 80%; + box-shadow: inset 0 1px 3px #ddd; + border-radius: 0; + -webkit-transition: border 0.3s linear; + -moz-transition: border 0.3s linear; + transition: border 0.3s linear; +} - /* For chrome, to avoid ugly bar around search box*/ - input:focus { - outline: none; - } +/* For chrome, to avoid ugly bar around search box*/ +input:focus { + outline: none; +} ins { text-decoration: none; @@ -496,17 +513,21 @@ td { text-align: center; } - .toc-footer hr { - width: 100%; - display: block; - height: 1px; - border: 0; - border-top: 1px solid; - margin-left: auto; - margin-right: auto; - padding-bottom: 0; - margin-bottom: 5px; - } +.toc-footer hr { + width: 100%; + display: block; + height: 1px; + border: 0; + border-top: 1px solid; + margin-left: auto; + margin-right: auto; + padding-bottom: 0; + margin-bottom: 5px; +} + +.footnotes { + font-size:smaller; +} /* #endregion */ @@ -538,52 +559,51 @@ td { margin-bottom: 24px; } - .table caption { - font-size: 85%; - font-style: italic; - padding: 1em 0; - text-align: center; - } +.table caption { + font-size: 85%; + font-style: italic; + padding: 1em 0; + text-align: center; +} - .table td, .table th { - font-size: 90%; - margin: 0; - overflow: visible; - padding: 8px 16px; - } +.table td, .table th { + font-size: 90%; + margin: 0; + overflow: visible; + padding: 8px 16px; +} - .table td:first-child, .table th:first-child { - border-left-width: 0; - } +.table td:first-child, .table th:first-child { + border-left-width: 0; +} - .table thead { - text-align: left; - vertical-align: bottom; - white-space: nowrap; - } +.table thead { + text-align: left; + vertical-align: bottom; + white-space: nowrap; +} - .table thead th { - font-weight: bold; - border-bottom: solid 2px; - } +.table thead th { + font-weight: bold; + border-bottom: solid 2px; +} - .table td { - background-color: transparent; - vertical-align: middle; - } +.table td { + background-color: transparent; +} - .table td p { - line-height: 18px; - } +.table td p { + line-height: 18px; +} - .table td p:last-child { - margin-bottom: 0; - } +.table td p:last-child { + margin-bottom: 0; +} - .table .table-cell-min { - width: 1%; - padding-right: 0; - } +.table .table-cell-min { + width: 1%; + padding-right: 0; +} .table-secondary { font-size: 90%; @@ -597,14 +617,14 @@ td { border: 1px solid; } - .table-bordered-all td { - border-bottom: 1px solid; - border-left: 1px solid; - } +.table-bordered-all td { + border-bottom: 1px solid; + border-left: 1px solid; +} - .table-bordered-all tbody > tr:last-child td { - border-bottom-width: 0; - } +.table-bordered-all tbody > tr:last-child td { + border-bottom-width: 0; +} .table-bordered { border: 1px solid; @@ -637,13 +657,13 @@ td { overflow: auto; } - .table-responsive table { - margin-bottom: 0 !important; - } +.table-responsive table { + margin-bottom: 0 !important; +} - .table-responsive table td, .table-responsive table th { - white-space: nowrap; - } +.table-responsive table td, .table-responsive table th { + white-space: nowrap; +} /* #endregion*/ /* #region Tabs*/ diff --git a/src/DocNet/Properties/AssemblyInfo.cs b/src/DocNet/Properties/AssemblyInfo.cs index 94bb2c5..12aeddb 100644 --- a/src/DocNet/Properties/AssemblyInfo.cs +++ b/src/DocNet/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.8.1.0")] -[assembly: AssemblyFileVersion("0.8.1")] +[assembly: AssemblyVersion("0.9.0.0")] +[assembly: AssemblyFileVersion("0.9.0")] diff --git a/src/DocNet/SimpleNavigationElement.cs b/src/DocNet/SimpleNavigationElement.cs index 436838e..d7daf16 100644 --- a/src/DocNet/SimpleNavigationElement.cs +++ b/src/DocNet/SimpleNavigationElement.cs @@ -65,7 +65,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat if(File.Exists(sourceFile)) { this.MarkdownFromFile = File.ReadAllText(sourceFile); - content = Utils.ConvertMarkdownToHtml(this.MarkdownFromFile, _relativeH2LinksOnPage); + content = Utils.ConvertMarkdownToHtml(this.MarkdownFromFile, Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage); } else { @@ -87,7 +87,7 @@ public override void GenerateOutput(Config activeConfig, NavigatedPath activePat defaultMarkdown.AppendFormat("* [{0}]({1}){2}", sibling.Name, HttpUtility.UrlPathEncode(sibling.TargetURL), Environment.NewLine); } defaultMarkdown.Append(Environment.NewLine); - content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), _relativeH2LinksOnPage); + content = Utils.ConvertMarkdownToHtml(defaultMarkdown.ToString(), Path.GetDirectoryName(destinationFile), activeConfig.Destination, _relativeH2LinksOnPage); } else { diff --git a/src/DocNet/Utils.cs b/src/DocNet/Utils.cs index c3e9428..aeb20e4 100644 --- a/src/DocNet/Utils.cs +++ b/src/DocNet/Utils.cs @@ -31,15 +31,16 @@ namespace Docnet { public static class Utils { - public static string ConvertMarkdownToHtml(string toConvert, List> createdAnchorCollector) + /// + /// Converts the markdown to HTML. + /// + /// The markdown string to convert. + /// The document path (without the document filename). + /// The site root. + /// The created anchor collector, for ToC sublinks for H2 headers. + /// + public static string ConvertMarkdownToHtml(string toConvert, string documentPath, string siteRoot, List> createdAnchorCollector) { - //var parser = new Markdown(new MarkdownOptions() { EmptyElementSuffix = ">"}); - //var toReturn = parser.Transform(toConvert); - //if(createdAnchorCollector != null) - //{ - // createdAnchorCollector.AddRange(parser.CollectedH2AnchorNameTuples); - //} - var parser = new MarkdownDeep.Markdown { ExtraMode = true, @@ -47,10 +48,10 @@ public static string ConvertMarkdownToHtml(string toConvert, List row, string ty public void Render(Markdown m, StringBuilder b) { - b.Append("\n"); + b.Append("
\n"); if (Headers != null) { b.Append("\n\n"); diff --git a/src/MarkdownDeepTests/testfiles/extramode/Issue26(ExtraMode).html b/src/MarkdownDeepTests/testfiles/extramode/Issue26(ExtraMode).html index a2edeaf..82582f9 100644 --- a/src/MarkdownDeepTests/testfiles/extramode/Issue26(ExtraMode).html +++ b/src/MarkdownDeepTests/testfiles/extramode/Issue26(ExtraMode).html @@ -1,6 +1,6 @@ 

pre

-
+
diff --git a/src/MarkdownDeepTests/testfiles/extramode/TableAlignment(ExtraMode).html b/src/MarkdownDeepTests/testfiles/extramode/TableAlignment(ExtraMode).html index 3bb766c..217dc1b 100644 --- a/src/MarkdownDeepTests/testfiles/extramode/TableAlignment(ExtraMode).html +++ b/src/MarkdownDeepTests/testfiles/extramode/TableAlignment(ExtraMode).html @@ -1,6 +1,6 @@ 

pre

-
Fruit
+
diff --git a/src/MarkdownDeepTests/testfiles/extramode/TableFormatting(ExtraMode).html b/src/MarkdownDeepTests/testfiles/extramode/TableFormatting(ExtraMode).html index 293dceb..9050992 100644 --- a/src/MarkdownDeepTests/testfiles/extramode/TableFormatting(ExtraMode).html +++ b/src/MarkdownDeepTests/testfiles/extramode/TableFormatting(ExtraMode).html @@ -1,5 +1,5 @@ 

pre

-
Unspecified
+
diff --git a/src/MarkdownDeepTests/testfiles/extramode/Tables(ExtraMode).html b/src/MarkdownDeepTests/testfiles/extramode/Tables(ExtraMode).html index 21eeed2..f1b5d83 100644 --- a/src/MarkdownDeepTests/testfiles/extramode/Tables(ExtraMode).html +++ b/src/MarkdownDeepTests/testfiles/extramode/Tables(ExtraMode).html @@ -1,6 +1,6 @@ 

pre

-
Fruit
+
Fruit