Skip to content

Commit

Permalink
test(parser/renderer): verify quoted text case
Browse files Browse the repository at this point in the history
verifies that `*a_b* _c_` is parsed and renderer as expected
bug itself ws fixed in eecd0bb

Fixes bytesparadise#1078

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon committed Sep 19, 2022
1 parent 481ef43 commit 3dee7dc
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
28 changes: 28 additions & 0 deletions pkg/parser/quoted_text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,34 @@ var _ = Describe("quoted texts", func() {
Expect(ParseDocument(source)).To(MatchDocument(expected))
})

It("unbalanced italic in bold", func() {
source := `*a_b* _c_`
expected := &types.Document{
Elements: []interface{}{
&types.Paragraph{
Elements: []interface{}{
&types.QuotedText{
Kind: types.SingleQuoteBold,
Elements: []interface{}{
&types.StringElement{Content: "a_b"},
},
},
&types.StringElement{
Content: " ",
},
&types.QuotedText{
Kind: types.SingleQuoteItalic,
Elements: []interface{}{
&types.StringElement{Content: "c"},
},
},
},
},
},
}
Expect(ParseDocument(source)).To(MatchDocument(expected))
})

It("unparsed bold in monospace", func() {
source := "`a*b*`"
expected := &types.Document{
Expand Down
9 changes: 9 additions & 0 deletions pkg/renderer/sgml/html5/quoted_text_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,15 @@ content</mark>.</p>
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

It("unbalanced italic in bold", func() {
source := `*a_b* _c_`
expected := `<div class="paragraph">
<p><strong>a_b</strong> <em>c</em></p>
</div>
`
Expect(RenderHTML(source)).To(MatchHTML(expected))
})

It("unparsed bold in monospace", func() {
source := "`a*b*`"
expected := `<div class="paragraph">
Expand Down

0 comments on commit 3dee7dc

Please sign in to comment.