Skip to content

Commit

Permalink
fix(parser): allow empty lines between attributes and element (bytesp…
Browse files Browse the repository at this point in the history
…aradise#496)

One or more empty lines can be inserted between a group of attributes
and their target element

fixes bytesparadise#493

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Mar 9, 2020
1 parent 79c454c commit 4d3ef23
Show file tree
Hide file tree
Showing 3 changed files with 3,369 additions and 3,153 deletions.
53 changes: 52 additions & 1 deletion pkg/parser/element_attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,57 @@ a paragraph`
Expect(ParseDocumentBlock(source)).To(Equal(expected))
})
})
})

It("blank line after role attribute", func() {
source := `[.a role]
a paragraph`
expected := types.DraftDocument{
Blocks: []interface{}{
types.Paragraph{
Attributes: types.ElementAttributes{
types.AttrRole: "a role",
},
Lines: [][]interface{}{
{
types.StringElement{
Content: "a paragraph",
},
},
},
},
},
}
Expect(ParseDraftDocument(source)).To(Equal(expected))
})

It("blank lines after id, role and title attributes", func() {
source := `[.a role]
[[ID]]
.title
a paragraph`
expected := types.DraftDocument{
Blocks: []interface{}{
types.Paragraph{
Attributes: types.ElementAttributes{
types.AttrRole: "a role",
types.AttrTitle: "title",
types.AttrID: "ID",
types.AttrCustomID: true,
},
Lines: [][]interface{}{
{
types.StringElement{
Content: "a paragraph",
},
},
},
},
},
}
Expect(ParseDraftDocument(source)).To(Equal(expected))
})
})
})
Loading

0 comments on commit 4d3ef23

Please sign in to comment.