Skip to content

Commit

Permalink
refactor(types): use Kind field for quoted text kind (#277)
Browse files Browse the repository at this point in the history
Fixes #275

Signed-off-by: Xavier Coulon <[email protected]>
  • Loading branch information
xcoulon authored Jan 20, 2019
1 parent 4c29467 commit 4e1c15d
Show file tree
Hide file tree
Showing 13 changed files with 107 additions and 306 deletions.
24 changes: 7 additions & 17 deletions pkg/parser/delimited_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,9 +495,7 @@ with *bold content*
Content: "with ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "bold content",
Expand Down Expand Up @@ -691,9 +689,7 @@ ____`
Content: "some ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "quote",
Expand Down Expand Up @@ -1055,9 +1051,7 @@ ____`
Content: "some ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "verse",
Expand Down Expand Up @@ -1340,7 +1334,7 @@ end
----`
expectedResult := types.DelimitedBlock{
Attributes: types.ElementAttributes{
types.AttrKind: types.Source,
types.AttrKind: types.Source,
types.AttrLanguage: "ruby",
},
Kind: types.Source,
Expand Down Expand Up @@ -1389,7 +1383,7 @@ end
----`
expectedResult := types.DelimitedBlock{
Attributes: types.ElementAttributes{
types.AttrKind: types.Source,
types.AttrKind: types.Source,
types.AttrLanguage: "ruby",
types.AttrID: "id-for-source-block",
types.AttrTitle: "app.rb",
Expand Down Expand Up @@ -1446,9 +1440,7 @@ some *verse* content
Content: "some ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "verse",
Expand Down Expand Up @@ -1489,9 +1481,7 @@ bar
Content: "some ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "verse",
Expand Down
4 changes: 1 addition & 3 deletions pkg/parser/document_attributes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,7 @@ a paragraph with *bold content*`
{
types.StringElement{Content: "a paragraph with "},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "bold content"},
},
Expand Down
4 changes: 1 addition & 3 deletions pkg/parser/footnote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ var _ = Describe("footnotes", func() {
Content: "some ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "rich",
Expand Down
12 changes: 3 additions & 9 deletions pkg/parser/inline_elements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ var _ = Describe("inline elements", func() {
actualContent := "*some bold content*"
expectedResult := types.InlineElements{
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "some bold content"},
},
Expand All @@ -29,9 +27,7 @@ var _ = Describe("inline elements", func() {
expectedResult := types.InlineElements{
types.StringElement{Content: "("},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "some bold content"},
},
Expand Down Expand Up @@ -62,9 +58,7 @@ var _ = Describe("inline elements", func() {
actualContent := "**foo**bar"
expectedResult := types.InlineElements{
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "foo"},
},
Expand Down
12 changes: 3 additions & 9 deletions pkg/parser/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1502,9 +1502,7 @@ another fenced block
{
types.StringElement{Content: "a second item with "},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "bold content"},
},
Expand Down Expand Up @@ -1716,9 +1714,7 @@ another fenced block
{
types.StringElement{Content: "a second item with "},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "bold content"},
},
Expand Down Expand Up @@ -1878,9 +1874,7 @@ another fenced block
{
types.StringElement{Content: "a second item with "},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "bold content"},
},
Expand Down
8 changes: 2 additions & 6 deletions pkg/parser/paragraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ var _ = Describe("paragraphs", func() {
{
types.StringElement{Content: "a paragraph with "},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{Content: "some bold content"},
},
Expand Down Expand Up @@ -288,9 +286,7 @@ this is a
},
{
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "caution",
Expand Down
8 changes: 2 additions & 6 deletions pkg/parser/passthrough_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,7 @@ var _ = Describe("passthroughs", func() {
Kind: types.PassthroughMacro,
Elements: types.InlineElements{
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "hello",
Expand Down Expand Up @@ -353,9 +351,7 @@ var _ = Describe("passthroughs", func() {
Content: " a ",
},
types.QuotedText{
Attributes: types.ElementAttributes{
types.AttrKind: types.Bold,
},
Kind: types.Bold,
Elements: types.InlineElements{
types.StringElement{
Content: "hello",
Expand Down
Loading

0 comments on commit 4e1c15d

Please sign in to comment.