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() {
|
||||
if inList && !line.isListItem {
|
||||
str += "</ul>"
|
||||
inList = false
|
||||
}
|
||||
|
||||
switch line {
|
||||
|
|
|
@ -97,5 +97,16 @@ class GeminiHTMLRendererTests: XCTestCase {
|
|||
let html = GeminiHTMLRenderer().renderDocumentToHTML(doc)
|
||||
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