Skip to content

Commit

Permalink
feature(renderer): Closing html tag should have a newline appended (#718
Browse files Browse the repository at this point in the history
)

Fixes #702
  • Loading branch information
gdamore authored Jul 12, 2020
1 parent 533e63d commit 6774f18
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 29 deletions.
15 changes: 10 additions & 5 deletions libasciidoc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
filename := "test/includes/chapter-a.adoc"
stat, err := os.Stat(filename)
Expect(err).NotTo(HaveOccurred())
Expand Down Expand Up @@ -390,7 +391,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithAttribute(types.AttrDocType, "manpage"),
configuration.WithLastUpdated(lastUpdated),
Expand Down Expand Up @@ -469,7 +471,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithAttribute(types.AttrDocType, "manpage"),
configuration.WithLastUpdated(lastUpdated),
Expand Down Expand Up @@ -505,7 +508,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(Render(source,
configuration.WithBackEnd("html5"),
configuration.WithLastUpdated(lastUpdated),
Expand Down Expand Up @@ -540,7 +544,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(Render(source,
configuration.WithBackEnd("xhtml5"),
configuration.WithLastUpdated(lastUpdated),
Expand Down
18 changes: 12 additions & 6 deletions pkg/renderer/sgml/html5/document_details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithHeaderFooter(true), configuration.WithLastUpdated(now))).To(MatchHTMLTemplate(expected, now))
})
Expand Down Expand Up @@ -93,7 +94,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithHeaderFooter(true), configuration.WithLastUpdated(now))).
To(MatchHTMLTemplate(expected, now))
Expand Down Expand Up @@ -132,7 +134,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -163,7 +166,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -198,7 +202,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -228,7 +233,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down
2 changes: 1 addition & 1 deletion pkg/renderer/sgml/html5/html5.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
"</div>\n" +
"</div>\n{{ end }}" +
"</body>\n" +
"</html>"
"</html>\n"

articleHeaderTmpl = "<div id=\"header\">\n" +
"<h1>{{ .Header }}</h1>\n" +
Expand Down
12 changes: 8 additions & 4 deletions pkg/renderer/sgml/html5/html5_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -70,7 +71,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -103,7 +105,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -321,7 +324,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderHTML(source, configuration.WithFilename("test.adoc"),
configuration.WithAttributes(map[string]string{
Expand Down
24 changes: 16 additions & 8 deletions pkg/renderer/sgml/xhtml5/document_details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithHeaderFooter(true), configuration.WithLastUpdated(now))).To(MatchHTMLTemplate(expected, now))
})
Expand Down Expand Up @@ -93,7 +94,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithHeaderFooter(true), configuration.WithLastUpdated(now))).
To(MatchHTMLTemplate(expected, now))
Expand Down Expand Up @@ -132,7 +134,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -163,7 +166,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -206,7 +210,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -249,7 +254,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -284,7 +290,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down Expand Up @@ -314,7 +321,8 @@ a paragraph`
</div>
</div>
</body>
</html>`
</html>
`
Expect(RenderXHTML(source,
configuration.WithHeaderFooter(true),
configuration.WithLastUpdated(now),
Expand Down
2 changes: 1 addition & 1 deletion pkg/renderer/sgml/xhtml5/xhtml5.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ const (
"</div>\n" +
"</div>\n{{ end }}" +
"</body>\n" +
"</html>"
"</html>\n"
)
12 changes: 8 additions & 4 deletions pkg/renderer/sgml/xhtml5/xhtml5_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -70,7 +71,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -103,7 +105,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithHeaderFooter(true),
configuration.WithCSS("/path/to/style.css"),
Expand Down Expand Up @@ -321,7 +324,8 @@ Last updated {{.LastUpdated}}
</div>
</div>
</body>
</html>`
</html>
`
now := time.Now()
Expect(RenderXHTML(source, configuration.WithFilename("test.adoc"),
configuration.WithAttributes(map[string]string{
Expand Down

0 comments on commit 6774f18

Please sign in to comment.