Skip to content

Commit

Permalink
fix(parser): support line breaks in footnotes (#979)
Browse files Browse the repository at this point in the history
fixes #970

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
  • Loading branch information
xcoulon authored Mar 14, 2022
1 parent 1028ff0 commit 2123d11
Show file tree
Hide file tree
Showing 6 changed files with 8,033 additions and 7,918 deletions.
35 changes: 33 additions & 2 deletions pkg/parser/footnote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,44 @@ var _ = Describe("footnotes", func() {

It("footnote with single-line content", func() {
footnoteContent := "some content"
source := fmt.Sprintf(`foo footnote:[%s]`, footnoteContent)
source := fmt.Sprintf(`here is a footnote:[%s]`, footnoteContent)
expected := &types.Document{
Elements: []interface{}{
&types.Paragraph{
Elements: []interface{}{
&types.StringElement{
Content: "foo ",
Content: "here is a ",
},
&types.FootnoteReference{
ID: 1,
},
},
},
},
Footnotes: []*types.Footnote{
{
ID: 1,
Elements: []interface{}{
&types.StringElement{
Content: footnoteContent,
},
},
},
},
}
Expect(ParseDocument(source)).To(MatchDocument(expected)) // need to get the whole document here
})

It("footnote with multi-line content", func() {
footnoteContent := `This is a very
long paragraph.`
source := fmt.Sprintf("here is a footnote:[%s]", footnoteContent)
expected := &types.Document{
Elements: []interface{}{
&types.Paragraph{
Elements: []interface{}{
&types.StringElement{
Content: "here is a ",
},
&types.FootnoteReference{
ID: 1,
Expand Down
Loading

0 comments on commit 2123d11

Please sign in to comment.