Fix HTML renderer inserting extra </ul>s
This commit is contained in:
parent
d6ff2141dc
commit
0d85c6f6ea
|
@ -27,6 +27,7 @@ public class GeminiHTMLRenderer {
|
||||||
for (index, line) in doc.lines.enumerated() {
|
for (index, line) in doc.lines.enumerated() {
|
||||||
if inList && !line.isListItem {
|
if inList && !line.isListItem {
|
||||||
str += "</ul>"
|
str += "</ul>"
|
||||||
|
inList = false
|
||||||
}
|
}
|
||||||
|
|
||||||
switch line {
|
switch line {
|
||||||
|
|
|
@ -98,4 +98,15 @@ class GeminiHTMLRendererTests: XCTestCase {
|
||||||
XCTAssertEqual(html, "<blockquote>quoted</blockquote>")
|
XCTAssertEqual(html, "<blockquote>quoted</blockquote>")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testStuffAfterList() {
|
||||||
|
doc.lines = [
|
||||||
|
.unorderedListItem("a"),
|
||||||
|
.unorderedListItem("b"),
|
||||||
|
.text("c"),
|
||||||
|
.text("d"),
|
||||||
|
]
|
||||||
|
let html = GeminiHTMLRenderer().renderDocumentToHTML(doc)
|
||||||
|
XCTAssertEqual(html, "<ul><li>a</li><li>b</li></ul><p>c</p><p>d</p>")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue