Skip to content

Commit

Permalink
fix(parser): unordered list element with continuation (bytesparadise#860
Browse files Browse the repository at this point in the history
)

adding tests to verify that it works, since it was most
certainly fixed in bytesparadise#843

clises bytesparadise#852

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Nov 20, 2021
1 parent ef5cc9d commit efe9f73
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
41 changes: 41 additions & 0 deletions pkg/parser/unordered_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,47 @@ The {plus} symbol is on a new line.
Expect(ParseDocument(source)).To(MatchDocument(expected))
})

It("with list element continuation - case 3", func() {
source := `- here
+
_there_`
expected := &types.Document{
Elements: []interface{}{
&types.List{
Kind: types.UnorderedListKind,
Elements: []types.ListElement{
&types.UnorderedListElement{
BulletStyle: types.Dash,
CheckStyle: types.NoCheck,
Elements: []interface{}{
&types.Paragraph{
Elements: []interface{}{
&types.StringElement{
Content: "here",
},
},
},
&types.Paragraph{
Elements: []interface{}{
&types.QuotedText{
Kind: types.SingleQuoteItalic,
Elements: []interface{}{
&types.StringElement{
Content: "there",
},
},
},
},
},
},
},
},
},
},
}
Expect(ParseDocument(source)).To(MatchDocument(expected))
})

It("without item continuation", func() {
source := `* foo
Expand Down
22 changes: 21 additions & 1 deletion pkg/renderer/sgml/html5/unordered_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ foo
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

It("unordered list with item continuation", func() {
It("unordered list with item continuation - case 1", func() {
source := `* foo
+
----
Expand Down Expand Up @@ -252,6 +252,25 @@ another delimited block
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

It("unordered list with item continuation - case 2", func() {
source := `- here
+
_there_
`
expected := `<div class="ulist">
<ul>
<li>
<p>here</p>
<div class="paragraph">
<p><em>there</em></p>
</div>
</li>
</ul>
</div>
`
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

It("unordered list without item continuation", func() {
source := `* foo
----
Expand Down Expand Up @@ -288,4 +307,5 @@ another delimited block
`
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

})

0 comments on commit efe9f73

Please sign in to comment.