From d759c0b7ebcbc1c1a744fc2376f4cc5629342ce6 Mon Sep 17 00:00:00 2001 From: Xavier Coulon Date: Sat, 23 May 2020 17:03:06 +0200 Subject: [PATCH] fix(types): `CalloutListItem` must implement `DocumentElement` (#569) fixes #568 Signed-off-by: Xavier Coulon --- pkg/renderer/html5/delimited_block_test.go | 3 ++- pkg/types/types.go | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/pkg/renderer/html5/delimited_block_test.go b/pkg/renderer/html5/delimited_block_test.go index b911804e..458791c7 100644 --- a/pkg/renderer/html5/delimited_block_test.go +++ b/pkg/renderer/html5/delimited_block_test.go @@ -135,13 +135,14 @@ import <1> Expect(RenderHTML(source)).To(MatchHTML(expected)) }) - It("with multiple callouts on different lines", func() { + It("with multiple callouts and blankline between calloutitems", func() { source := `---- import <1> func foo() {} <2> ---- <1> an import + <2> a func` expected := `
diff --git a/pkg/types/types.go b/pkg/types/types.go index 3170f73d..fd5c09ad 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -734,7 +734,7 @@ func NewOrderedListItem(prefix OrderedListItemPrefix, elements []interface{}, at }, nil } -// GetAttributes returns the elements of this UnorderedListItem +// GetAttributes returns the elements of this OrderedListItem func (i OrderedListItem) GetAttributes() ElementAttributes { return i.Attributes } @@ -1007,7 +1007,7 @@ func NewLabeledListItem(level int, term []interface{}, description interface{}, }, nil } -// GetAttributes returns the elements of this UnorderedListItem +// GetAttributes returns the elements of this LabeledListItem func (i LabeledListItem) GetAttributes() ElementAttributes { return i.Attributes } @@ -1421,6 +1421,15 @@ type CalloutListItem struct { Elements []interface{} } +var _ ListItem = &CalloutListItem{} + +var _ DocumentElement = &CalloutListItem{} + +// GetAttributes returns the elements of this CalloutListItem +func (i CalloutListItem) GetAttributes() ElementAttributes { + return i.Attributes +} + // AddElement add an element to this CalloutListItem func (i *CalloutListItem) AddElement(element interface{}) { i.Elements = append(i.Elements, element)