Skip to content

Commit

Permalink
fix(types): CalloutListItem must implement DocumentElement (#569)
Browse files Browse the repository at this point in the history
fixes #568

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored May 23, 2020
1 parent 9b5a26c commit d759c0b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pkg/renderer/html5/delimited_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 := `<div class="listingblock">
<div class="content">
Expand Down
13 changes: 11 additions & 2 deletions pkg/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d759c0b

Please sign in to comment.