diff --git a/pkg/renderer/html5/blank_line_test.go b/pkg/renderer/html5/blank_line_test.go index 298617cf..2eb55e82 100644 --- a/pkg/renderer/html5/blank_line_test.go +++ b/pkg/renderer/html5/blank_line_test.go @@ -19,7 +19,7 @@ second paragraph`

second paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("blank line with spaces and tabs between 2 paragraphs", func() { @@ -32,7 +32,7 @@ second paragraph`

second paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("blank lines (tabs) at end of document", func() { @@ -43,7 +43,7 @@ second paragraph` expected := `

first paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("blank lines (spaces) at end of document", func() { @@ -54,6 +54,6 @@ second paragraph` expected := `

first paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/comment_test.go b/pkg/renderer/html5/comment_test.go index ffa5f50c..625df931 100644 --- a/pkg/renderer/html5/comment_test.go +++ b/pkg/renderer/html5/comment_test.go @@ -14,7 +14,7 @@ var _ = Describe("comments", func() { It("single line comment alone", func() { source := `// A single-line comment.` expected := "" - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single line comment at end of line", func() { @@ -22,7 +22,7 @@ var _ = Describe("comments", func() { expected := `

foo // A single-line comment.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single line comment within a paragraph", func() { @@ -33,7 +33,7 @@ another line`

a first line another line

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -45,7 +45,7 @@ a *comment* block with multiple lines ////` expected := "" - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("comment block with paragraphs around", func() { @@ -61,7 +61,7 @@ a second paragraph`

a second paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/cross_reference_test.go b/pkg/renderer/html5/cross_reference_test.go index d00ae7607..42713397 100644 --- a/pkg/renderer/html5/cross_reference_test.go +++ b/pkg/renderer/html5/cross_reference_test.go @@ -25,7 +25,7 @@ with some content linked to <>!` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("cross-reference with custom id and label", func() { @@ -41,7 +41,7 @@ with some content linked to <>!` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("invalid section reference", func() { @@ -58,7 +58,7 @@ with some content linked to <>!` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/delimited_block_test.go b/pkg/renderer/html5/delimited_block_test.go index dc6cda7c..9906b55a 100644 --- a/pkg/renderer/html5/delimited_block_test.go +++ b/pkg/renderer/html5/delimited_block_test.go @@ -20,7 +20,7 @@ var _ = Describe("delimited blocks", func() { here ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("fenced block with id and title", func() { @@ -33,7 +33,7 @@ here here ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("fenced block with external link inside", func() { @@ -49,7 +49,7 @@ and more text on the next lines ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -68,7 +68,7 @@ here here ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("listing block with ID and title", func() { @@ -83,7 +83,7 @@ some source code
some source code
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -108,7 +108,7 @@ get '/hi' do end ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with title, source and languages attributes", func() { @@ -131,7 +131,7 @@ get '/hi' do end ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with id, title, source and languages attributes", func() { @@ -155,7 +155,7 @@ get '/hi' do end ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with html content", func() { @@ -167,7 +167,7 @@ end
<a>link</a>
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with other content", func() { @@ -179,7 +179,7 @@ end
  a<<b
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -207,7 +207,7 @@ with bold content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("example block with multiple elements - case 2", func() { @@ -226,7 +226,7 @@ and more content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("example block with multiple elements - case 3", func() { @@ -245,7 +245,7 @@ and "more" content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("example block with ID and title", func() { @@ -262,7 +262,7 @@ foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -298,7 +298,7 @@ with bold content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition block with ID and title", func() { @@ -334,7 +334,7 @@ with bold content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition block with ID, title and icon", func() { source := `:icons: font @@ -371,7 +371,7 @@ with bold content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition paragraph and admonition block with multiple elements", func() { @@ -416,7 +416,7 @@ this is an admonition paragraph. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition paragraph with an icon", func() { @@ -437,7 +437,7 @@ an admonition text on ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition paragraph with ID, title and icon", func() { @@ -459,7 +459,7 @@ an admonition text on 1 line. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -481,7 +481,7 @@ ____` quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single-line quote with author and title, and ID and title ", func() { @@ -503,7 +503,7 @@ ____` quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multi-line quote with author and title", func() { @@ -534,7 +534,7 @@ ____` quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multi-line quote with author only and nested listing", func() { @@ -572,7 +572,7 @@ ____` — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single-line quote with title only", func() { @@ -590,7 +590,7 @@ ____` — quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multi-line quote without author and title", func() { @@ -610,7 +610,7 @@ are preserved, but not trailing spaces

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("empty quote without author and title", func() { @@ -623,7 +623,7 @@ ____` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -642,7 +642,7 @@ ____` verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single-line verse with author, id and title ", func() { @@ -660,7 +660,7 @@ ____` verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multi-line verse with author and title", func() { @@ -683,7 +683,7 @@ and more! verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single-line verse with author only", func() { @@ -697,7 +697,7 @@ ____` — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("single-line verse with title only", func() { @@ -711,7 +711,7 @@ ____` — verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multi-line verse without author and title", func() { @@ -727,7 +727,7 @@ ____` and tabs are preserved ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("empty verse without author and title", func() { @@ -737,7 +737,7 @@ ____` expected := `

 
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -755,7 +755,7 @@ some *verse* content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("sidebar block with id, title, paragraph and sourcecode block", func() { @@ -782,7 +782,7 @@ bar ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/distinct_lists_test.go b/pkg/renderer/html5/distinct_lists_test.go index 394f0729..0bb9cab1 100644 --- a/pkg/renderer/html5/distinct_lists_test.go +++ b/pkg/renderer/html5/distinct_lists_test.go @@ -33,7 +33,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("same list with attribute on middle item", func() { @@ -59,7 +59,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("distinct lists separated by blankline and item attribute - case 1", func() { @@ -90,7 +90,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("distinct lists separated by blankline and item attribute - case 2", func() { @@ -124,7 +124,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -142,7 +142,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("same list with multiple comment lines inside", func() { @@ -161,7 +161,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("distinct lists separated by single comment line", func() { @@ -183,7 +183,7 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("distinct lists separated by multiple comment lines", func() { @@ -207,6 +207,6 @@ var _ = Describe("lists of items", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/document.go b/pkg/renderer/html5/document.go index 87dd34db..111f7112 100644 --- a/pkg/renderer/html5/document.go +++ b/pkg/renderer/html5/document.go @@ -107,6 +107,7 @@ func renderDocument(ctx *renderer.Context, output io.Writer) (map[string]interfa if len(renderedTitle) > 0 { metadata[types.AttrTitle] = string(renderedTitle) } + metadata["LastUpdated"] = ctx.LastUpdated() return metadata, nil } diff --git a/pkg/renderer/html5/document_attribute_substitution_test.go b/pkg/renderer/html5/document_attribute_substitution_test.go index 8d97f3aa..c049f4de 100644 --- a/pkg/renderer/html5/document_attribute_substitution_test.go +++ b/pkg/renderer/html5/document_attribute_substitution_test.go @@ -22,7 +22,7 @@ a paragraph` expected := `

a paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a paragraph then some attributes", func() { @@ -34,7 +34,7 @@ a paragraph` expected := `

a paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a paragraph with substitution", func() { @@ -44,7 +44,7 @@ a paragraph written by {author}` expected := `

a paragraph written by Xavier

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraphs with definitions, substitutions and resets", func() { @@ -70,7 +70,7 @@ author is now {author}.`

author is now {author}.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("front-matter then paragraph with substitutions", func() { @@ -82,7 +82,7 @@ author is {author}.` expected := `

author is Xavier.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -94,7 +94,7 @@ author is {author}.` expected := `

foo

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -106,7 +106,7 @@ author is {author}.` expected := fmt.Sprintf(`

the %s symbol

`, rendered) - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }, Entry("sp symbol", "sp", " "), Entry("blank symbol", "blank", ""), @@ -146,7 +146,7 @@ a {blank} here.` expected := `

a foo here.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/document_details_test.go b/pkg/renderer/html5/document_details_test.go index 751d1851..e882d08a 100644 --- a/pkg/renderer/html5/document_details_test.go +++ b/pkg/renderer/html5/document_details_test.go @@ -51,7 +51,7 @@ Last updated {{.LastUpdated}} ` - Expect(source).To(RenderHTML5Element(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) + Expect(source).To(RenderHTML5Body(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) }) It("header with 2 authors and no revision", func() { @@ -88,7 +88,7 @@ Last updated {{.LastUpdated}} ` - Expect(source).To(RenderHTML5Element(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) + Expect(source).To(RenderHTML5Body(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) }) }) diff --git a/pkg/renderer/html5/document_test.go b/pkg/renderer/html5/document_test.go index 3a3f4cf3..5ca00fad 100644 --- a/pkg/renderer/html5/document_test.go +++ b/pkg/renderer/html5/document_test.go @@ -39,7 +39,7 @@ Last updated {{.LastUpdated}} ` - Expect(source).To(RenderHTML5Element(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) + Expect(source).To(RenderHTML5Body(expected, renderer.IncludeHeaderFooter(true), renderer.LastUpdated(time.Now()))) }) }) diff --git a/pkg/renderer/html5/file_inclusion_test.go b/pkg/renderer/html5/file_inclusion_test.go index 1e1a38ea..40e4da7e 100644 --- a/pkg/renderer/html5/file_inclusion_test.go +++ b/pkg/renderer/html5/file_inclusion_test.go @@ -20,7 +20,7 @@ var _ = Describe("file inclusions", func() {

last line of grandchild

` - Expect(source).To(RenderHTML5Element(expected, WithFilename("foo.adoc"))) + Expect(source).To(RenderHTML5Body(expected, WithFilename("foo.adoc"))) // verify no error/warning in logs Expect(console).ToNot(ContainAnyMessageWithLevels(log.ErrorLevel, log.WarnLevel)) }) @@ -36,7 +36,7 @@ var _ = Describe("file inclusions", func() {

last line of grandchild

` - Expect(source).To(RenderHTML5Element(expected, WithFilename("tmp/foo.adoc"))) + Expect(source).To(RenderHTML5Body(expected, WithFilename("tmp/foo.adoc"))) // verify no error/warning in logs Expect(console).ToNot(ContainAnyMessageWithLevels(log.ErrorLevel, log.WarnLevel)) }) @@ -62,7 +62,7 @@ include::../../../test/includes/chapter-a.adoc[leveloffset=+1]` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("include non adoc file", func() { @@ -85,7 +85,7 @@ include::../../../test/includes/hello_world.go.txt[]` fmt.Println("hello, world!") }

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("include 2 files", func() { @@ -116,7 +116,7 @@ include::../../../test/includes/hello_world.go.txt[]` fmt.Println("hello, world!") }

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("include file and append following elements in included section", func() { @@ -144,7 +144,7 @@ a third paragraph` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) Context("file inclusion in delimited blocks", func() { @@ -169,7 +169,7 @@ include::../../../test/includes/chapter-a.adoc[] content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within fenced block", func() { @@ -183,7 +183,7 @@ content content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within example block", func() { @@ -200,7 +200,7 @@ include::../../../test/includes/chapter-a.adoc[] ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within quote block", func() { @@ -217,7 +217,7 @@ ____` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within verse block", func() { @@ -230,7 +230,7 @@ ____` content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within sidebar block", func() { @@ -247,7 +247,7 @@ include::../../../test/includes/chapter-a.adoc[] ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include adoc file within passthrough block", func() { @@ -256,7 +256,7 @@ include::../../../test/includes/chapter-a.adoc[] include::../../../test/includes/chapter-a.adoc[] ++++` expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -284,7 +284,7 @@ func helloworld() { } ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include go file within fenced block", func() { @@ -302,7 +302,7 @@ func helloworld() { } ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include go file within example block", func() { @@ -324,7 +324,7 @@ include::../../../test/includes/hello_world.go.txt[] ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include go file within quote block", func() { @@ -346,7 +346,7 @@ ____` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include go file within verse block", func() { @@ -363,7 +363,7 @@ func helloworld() { fmt.Println("hello, world!") } ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include go file within sidebar block", func() { @@ -385,7 +385,7 @@ include::../../../test/includes/hello_world.go.txt[] ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) @@ -399,7 +399,7 @@ include::../../../test/includes/hello_world.go.txt[] expected := `

package includes

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include multiple lines as paragraph", func() { @@ -409,7 +409,7 @@ include::../../../test/includes/hello_world.go.txt[] fmt.Println("hello, world!") }

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include multiple ranges as paragraph", func() { @@ -422,7 +422,7 @@ include::../../../test/includes/hello_world.go.txt[] fmt.Println("hello, world!") }

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -437,7 +437,7 @@ include::../../../test/includes/hello_world.go.txt[lines=1]
package includes
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include multiple lines in listing block", func() { @@ -451,7 +451,7 @@ include::../../../test/includes/hello_world.go.txt[lines=5..7] } ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include multiple ranges in listing block", func() { @@ -467,7 +467,7 @@ func helloworld() { } ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) @@ -481,7 +481,7 @@ func helloworld() {
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("file inclusion with surrounding tag", func() { @@ -494,7 +494,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("file inclusion with unclosed tag", func() { @@ -507,7 +507,7 @@ func helloworld() {

end

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( @@ -521,7 +521,7 @@ func helloworld() { defer reset() source := `include::../../../test/includes/tag-include.adoc[tag=unknown]` expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( @@ -543,7 +543,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) Context("permutations", func() { @@ -561,7 +561,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("all tagged regions", func() { @@ -574,7 +574,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("all the lines outside and inside of tagged regions", func() { @@ -590,7 +590,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("regions tagged doc, but not nested regions tagged content", func() { @@ -600,7 +600,7 @@ func helloworld() {
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("all tagged regions, but excludes any regions tagged content", func() { @@ -610,7 +610,7 @@ func helloworld() {
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("all tagged regions, but excludes any regions tagged content", func() { @@ -623,7 +623,7 @@ func helloworld() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("**;!* — selects only the regions of the document outside of tags", func() { @@ -631,7 +631,7 @@ func helloworld() { expected := `

end

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) @@ -658,7 +658,7 @@ func helloworld() {

last line of parent

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should include child and grandchild content in listing block", func() { @@ -680,7 +680,7 @@ last line of child last line of parent ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -696,7 +696,7 @@ include::{includedir}/grandchild-include.adoc[]`

last line of grandchild

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should resolve path with attribute in delimited block", func() { @@ -712,7 +712,7 @@ include::{includedir}/grandchild-include.adoc[] last line of grandchild ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -729,7 +729,7 @@ last line of grandchild expected := `

Unresolved directive in test.adoc - include::../../../test/includes/unknown.adoc[leveloffset=+1]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( @@ -747,7 +747,7 @@ last line of grandchild expected := `

Unresolved directive in test.adoc - include::{includedir}/unknown.adoc[leveloffset=+1]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( @@ -772,7 +772,7 @@ include::../../../test/includes/unknown.adoc[leveloffset=+1]
Unresolved directive in test.adoc - include::../../../test/includes/unknown.adoc[leveloffset=+1]
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( @@ -794,7 +794,7 @@ include::{includedir}/unknown.adoc[leveloffset=+1]
Unresolved directive in test.adoc - include::{includedir}/unknown.adoc[leveloffset=+1]
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) // verify error in logs Expect(console).To( ContainMessageWithLevel( diff --git a/pkg/renderer/html5/footnote_test.go b/pkg/renderer/html5/footnote_test.go index 16de70fc..2bb39b27 100644 --- a/pkg/renderer/html5/footnote_test.go +++ b/pkg/renderer/html5/footnote_test.go @@ -25,7 +25,7 @@ var _ = Describe("footnotes", func() { 1. a note for foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("rich footnote in a paragraph", func() { @@ -39,7 +39,7 @@ var _ = Describe("footnotes", func() { 1. some rich content ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("footnoteref with valid ref in a paragraph", func() { @@ -53,7 +53,7 @@ var _ = Describe("footnotes", func() { 1. a note for foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("footnoteref with invalid ref in a paragraph", func() { @@ -67,7 +67,7 @@ var _ = Describe("footnotes", func() { 1. a note for foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("footnotes everywhere", func() { @@ -108,6 +108,6 @@ a paragraph with another footnote:[baz]` 3. baz ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/image_test.go b/pkg/renderer/html5/image_test.go index 5e5b2049..ebdc467f 100644 --- a/pkg/renderer/html5/image_test.go +++ b/pkg/renderer/html5/image_test.go @@ -19,7 +19,7 @@ var _ = Describe("images", func() { foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with alt", func() { @@ -30,7 +30,7 @@ var _ = Describe("images", func() { foo image ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with alt and dimensions", func() { @@ -41,7 +41,7 @@ var _ = Describe("images", func() { foo image ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with title, alt and dimensions", func() { @@ -55,7 +55,7 @@ image::images/foo.png[the foo.png image,600,400]`
Figure 1. A title to foobar
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with role above", func() { @@ -69,7 +69,7 @@ image::foo.png[foo image, 600, 400]`
Figure 1. mytitle
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with id, title and role inline", func() { @@ -80,7 +80,7 @@ image::foo.png[foo image, 600, 400]`
Figure 1. mytitle
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("2 block images", func() { @@ -96,7 +96,7 @@ image::appa.png[]` appa ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -110,7 +110,7 @@ image::appa.png[]` expected := `

app

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("inline image with id, title and role", func() { @@ -118,7 +118,7 @@ image::appa.png[]` expected := `

foo

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("inline image with alt", func() { @@ -126,7 +126,7 @@ image::appa.png[]` expected := `

foo image

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("inline image with alt and dimensions", func() { @@ -134,7 +134,7 @@ image::appa.png[]` expected := `

foo image

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph with inline image with alt and dimensions", func() { @@ -142,7 +142,7 @@ image::appa.png[]` expected := `

a foo foo image bar

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -153,7 +153,7 @@ image::appa.png[]` expected := `

a foo image::foo.png[foo image, 600, 400] bar

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) @@ -169,7 +169,7 @@ image::foo.png[]` foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("2 block images with relative locations and imagedir changed in-between", func() { @@ -189,7 +189,7 @@ image::bar.png[]` bar ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with absolute URL", func() { @@ -201,7 +201,7 @@ image::https://example.com/foo.png[]` foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with absolute filepath", func() { @@ -213,7 +213,7 @@ image::/bar/foo.png[]` foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("block image with absolute file scheme and path", func() { @@ -225,7 +225,7 @@ image::file:///bar/foo.png[]` foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/labeled_list_test.go b/pkg/renderer/html5/labeled_list_test.go index 0c8d4577..8419f536 100644 --- a/pkg/renderer/html5/labeled_list_test.go +++ b/pkg/renderer/html5/labeled_list_test.go @@ -39,7 +39,7 @@ on 2 lines, too.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with an empty entry", func() { @@ -54,7 +54,7 @@ item 2:: description 2.` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with an image", func() { @@ -72,7 +72,7 @@ item 2:: description 2.` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with script injection", func() { @@ -85,7 +85,7 @@ item 2:: description 2.` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with fenced block", func() { @@ -112,7 +112,7 @@ item 2:: description 2.` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with nested lists using regular layout", func() { @@ -149,7 +149,7 @@ item 2:: something simple` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with title", func() { @@ -169,7 +169,7 @@ second term:: definition of the second term` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -209,7 +209,7 @@ on 2 lines, too.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with nested lists using horizontal layout", func() { @@ -255,7 +255,7 @@ item 2 ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -283,7 +283,7 @@ item 2:: description 2.` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list with blockcontinuation", func() { @@ -319,7 +319,7 @@ another delimited block ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("labeled list without continuation", func() { @@ -355,7 +355,7 @@ another delimited block ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -392,7 +392,7 @@ Item 3 description` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -418,7 +418,7 @@ What is the answer to the Ultimate Question?:: 42` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -462,7 +462,7 @@ paragraph attached to grandparent list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to parent labeled list item", func() { @@ -502,7 +502,7 @@ paragraph attached to parent list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to child labeled list item", func() { @@ -541,7 +541,7 @@ paragraph attached to child list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/link_test.go b/pkg/renderer/html5/link_test.go index 527aa40a..e898325b 100644 --- a/pkg/renderer/html5/link_test.go +++ b/pkg/renderer/html5/link_test.go @@ -17,7 +17,7 @@ var _ = Describe("links", func() { expected := `

a link to https://foo.com.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("external link with quoted text", func() { @@ -25,7 +25,7 @@ var _ = Describe("links", func() { expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("external link with text having comma", func() { @@ -33,7 +33,7 @@ var _ = Describe("links", func() { expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("external link inside a multiline paragraph", func() { @@ -46,7 +46,7 @@ next lines` and more text on the next lines

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -57,7 +57,7 @@ next lines

expected := `

a link to foo.adoc.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("relative link to doc with text", func() { @@ -65,7 +65,7 @@ next lines

expected := `

a link to foo doc.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("relative link with text having comma", func() { @@ -73,7 +73,7 @@ next lines

expected := `

a link to A, B, and C

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("relative link to external URL with text", func() { @@ -81,7 +81,7 @@ next lines

expected := `

a link to foo doc.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("invalid relative link to doc", func() { @@ -89,7 +89,7 @@ next lines

expected := `

a link to link:foo.adoc.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("relative link with quoted text", func() { @@ -97,7 +97,7 @@ next lines

expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/literal_block_test.go b/pkg/renderer/html5/literal_block_test.go index 8722c465..0028da62 100644 --- a/pkg/renderer/html5/literal_block_test.go +++ b/pkg/renderer/html5/literal_block_test.go @@ -18,7 +18,7 @@ var _ = Describe("literal blocks", func() {
some literal content
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("literal block from paragraph with single space on first line", func() { @@ -32,7 +32,7 @@ on 3 lines. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("literal block from paragraph with same spaces on each line", func() { @@ -46,7 +46,7 @@ on 3 lines. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("literal block from paragraph with single spaces on each line", func() { @@ -60,7 +60,7 @@ lines. has some heading spaces preserved. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("mixing literal block with attributes followed by a paragraph ", func() { @@ -78,7 +78,7 @@ a normal paragraph.`

a normal paragraph.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -100,7 +100,7 @@ a normal paragraph.`

a normal paragraph.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -124,7 +124,7 @@ a normal paragraph.`

a normal paragraph.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("literal block from 2-lines paragraph with attribute", func() { @@ -145,7 +145,7 @@ on two lines.

a normal paragraph.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/ordered_list_test.go b/pkg/renderer/html5/ordered_list_test.go index c3d3928a..9e67825f 100644 --- a/pkg/renderer/html5/ordered_list_test.go +++ b/pkg/renderer/html5/ordered_list_test.go @@ -22,7 +22,7 @@ var _ = Describe("ordered lists", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list item with explicit start only", func() { @@ -35,7 +35,7 @@ var _ = Describe("ordered lists", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list item with explicit quoted numbering and start", func() { @@ -48,7 +48,7 @@ var _ = Describe("ordered lists", func() { ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list with paragraph continuation", func() { @@ -65,7 +65,7 @@ foo` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list with delimited block continuation", func() { @@ -86,7 +86,7 @@ foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list with unnumbered items", func() { @@ -134,7 +134,7 @@ foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list mixed with unordered list - simple case", func() { @@ -178,7 +178,7 @@ foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("ordered list mixed with unordered list - complex case", func() { @@ -303,7 +303,7 @@ extra lines.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("all kinds of lists - complex case 3", func() { @@ -347,7 +347,7 @@ a. foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("drop principal text in list item", func() { @@ -381,7 +381,7 @@ print("one") ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) Context("attach to ordered list item ancestor", func() { @@ -418,7 +418,7 @@ paragraph attached to grandparent list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to parent ordered list item", func() { @@ -452,7 +452,7 @@ paragraph attached to parent list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to child ordered list item", func() { @@ -485,7 +485,7 @@ paragraph attached to child list item` ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/paragraph_test.go b/pkg/renderer/html5/paragraph_test.go index c5bfaa40..6e42139f 100644 --- a/pkg/renderer/html5/paragraph_test.go +++ b/pkg/renderer/html5/paragraph_test.go @@ -18,7 +18,7 @@ var _ = Describe("paragraphs", func() {

bold content & more content afterwards

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a standalone paragraph with trailing spaces", func() { @@ -28,7 +28,7 @@ var _ = Describe("paragraphs", func() {

bold content & more content afterwards…​

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a standalone paragraph with an ID and a title", func() { @@ -39,7 +39,7 @@ var _ = Describe("paragraphs", func() {
a title

bold content with more content afterwards…​

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("2 paragraphs and blank line", func() { @@ -55,7 +55,7 @@ and here another paragraph

and here another paragraph

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph with single quotes", func() { @@ -63,7 +63,7 @@ and here another paragraph expected := `

a 'subsection' paragraph.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -78,7 +78,7 @@ baz` bar baz

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with paragraph attribute", func() { @@ -92,7 +92,7 @@ baz` bar
baz

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("with document attribute", func() { @@ -105,7 +105,7 @@ baz` bar
baz

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -125,7 +125,7 @@ this is a note. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multiline warning admonition paragraph", func() { @@ -144,7 +144,7 @@ warning! ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("admonition note paragraph with id and title", func() { @@ -164,7 +164,7 @@ this is a note. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -185,7 +185,7 @@ this is a caution! ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multiline caution admonition paragraph with title and id", func() { @@ -208,7 +208,7 @@ this is a ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -224,7 +224,7 @@ I am a verse paragraph.` verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a verse with author, title and other attributes", func() { @@ -240,7 +240,7 @@ I am a verse paragraph.` verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a verse with empty title", func() { @@ -252,7 +252,7 @@ I am a verse paragraph.` — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a verse without title", func() { @@ -264,7 +264,7 @@ I am a verse paragraph.` — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a verse with empty author", func() { @@ -273,7 +273,7 @@ I am a verse paragraph.` expected := `
I am a verse paragraph.
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a verse without author", func() { @@ -282,7 +282,7 @@ I am a verse paragraph.` expected := `
I am a verse paragraph.
` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("image block as a verse", func() { @@ -295,7 +295,7 @@ image::foo.png[]` verse title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -313,7 +313,7 @@ some quote content quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a quote with author, title and other attributes", func() { @@ -331,7 +331,7 @@ I am a quote paragraph. quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a quote with empty title", func() { @@ -345,7 +345,7 @@ I am a quote paragraph. — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a quote without title", func() { @@ -359,7 +359,7 @@ I am a quote paragraph. — john doe ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a quote with empty author", func() { @@ -370,7 +370,7 @@ I am a quote paragraph.` I am a quote paragraph. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("paragraph as a quote without author", func() { @@ -381,7 +381,7 @@ I am a quote paragraph.` I am a quote paragraph. ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("inline image within a quote", func() { @@ -396,7 +396,7 @@ a foo foo quote title ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("image block is NOT a quote", func() { @@ -407,7 +407,7 @@ image::foo.png[]` foo ` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/passthrough_test.go b/pkg/renderer/html5/passthrough_test.go index b7b7e7ba..a0b5c073 100644 --- a/pkg/renderer/html5/passthrough_test.go +++ b/pkg/renderer/html5/passthrough_test.go @@ -14,7 +14,7 @@ var _ = Describe("passthroughs", func() { It("an empty standalone tripleplus passthrough", func() { source := `++++++` expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("an empty tripleplus passthrough in a paragraph", func() { @@ -22,7 +22,7 @@ var _ = Describe("passthroughs", func() { expected := `

with more content afterwards…​

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a standalone tripleplus passthrough", func() { @@ -30,7 +30,7 @@ var _ = Describe("passthroughs", func() { expected := `

*bold content*

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("tripleplus passthrough in paragraph", func() { @@ -38,7 +38,7 @@ var _ = Describe("passthroughs", func() { expected := `

The text underline & me is underlined.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -49,7 +49,7 @@ var _ = Describe("passthroughs", func() { expected := `

++

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("an empty singleplus passthrough in a paragraph", func() { @@ -57,7 +57,7 @@ var _ = Describe("passthroughs", func() { expected := `

++ with more content afterwards…​

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("a singleplus passthrough", func() { @@ -65,7 +65,7 @@ var _ = Describe("passthroughs", func() { expected := `

*bold content*

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("singleplus passthrough in paragraph", func() { @@ -73,7 +73,7 @@ var _ = Describe("passthroughs", func() { expected := `

The text <u>underline me</u> is not underlined.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("invalid singleplus passthrough in paragraph", func() { @@ -81,7 +81,7 @@ var _ = Describe("passthroughs", func() { expected := `

The text + hello, world + is not passed through.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -92,7 +92,7 @@ var _ = Describe("passthroughs", func() { expected := `

hello

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("passthrough macro with words", func() { @@ -100,13 +100,13 @@ var _ = Describe("passthroughs", func() { expected := `

hello, world

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("empty passthrough macro", func() { source := `pass:[]` expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("passthrough macro with spaces", func() { @@ -114,7 +114,7 @@ var _ = Describe("passthroughs", func() { expected := `

*hello*, world

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("passthrough macro with line break", func() { @@ -123,7 +123,7 @@ var _ = Describe("passthroughs", func() {

hello, world

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -134,7 +134,7 @@ world

expected := `

hello

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("passthrough macro with quoted word in sentence and trailing spaces", func() { @@ -142,7 +142,7 @@ world

expected := `

a hello, world

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("passthrough macro within paragraph", func() { @@ -150,7 +150,7 @@ world

expected := `

an hello, world mention

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/quoted_text_test.go b/pkg/renderer/html5/quoted_text_test.go index 32d5d9e9..5ea72dd1 100644 --- a/pkg/renderer/html5/quoted_text_test.go +++ b/pkg/renderer/html5/quoted_text_test.go @@ -16,7 +16,7 @@ var _ = Describe("quoted texts", func() { expected := `

bold content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("bold content in sentence", func() { @@ -24,7 +24,7 @@ var _ = Describe("quoted texts", func() { expected := `

some bold content.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -35,7 +35,7 @@ var _ = Describe("quoted texts", func() { expected := `

italic content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("italic content in sentence", func() { @@ -44,7 +44,7 @@ var _ = Describe("quoted texts", func() { expected := `

some italic content.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -55,7 +55,7 @@ var _ = Describe("quoted texts", func() { expected := `

monospace content

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("monospace content in sentence", func() { @@ -64,7 +64,7 @@ var _ = Describe("quoted texts", func() { expected := `

some monospace content.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -75,7 +75,7 @@ var _ = Describe("quoted texts", func() { expected := `

subscriptcontent

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("subscript content in sentence", func() { @@ -84,7 +84,7 @@ var _ = Describe("quoted texts", func() { expected := `

some subscriptcontent.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -95,7 +95,7 @@ var _ = Describe("quoted texts", func() { expected := `

superscriptcontent

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("superscript content in sentence", func() { @@ -104,7 +104,7 @@ var _ = Describe("quoted texts", func() { expected := `

some superscriptcontent.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -116,7 +116,7 @@ var _ = Describe("quoted texts", func() { expected := `

some *nested bold content*.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("italic content within bold quote in sentence", func() { @@ -124,7 +124,7 @@ var _ = Describe("quoted texts", func() { expected := `

some bold and italic content together.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -135,7 +135,7 @@ var _ = Describe("quoted texts", func() { expected := `

some *bold and italic content * together.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("invalid italic content within bold quote in sentence", func() { @@ -144,7 +144,7 @@ var _ = Describe("quoted texts", func() { expected := `

some bold and _italic content _ together.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -155,7 +155,7 @@ var _ = Describe("quoted texts", func() { expected := `

some *bold content*.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("italic content within escaped bold quote in sentence", func() { @@ -163,7 +163,7 @@ var _ = Describe("quoted texts", func() { expected := `

some *bold and italic content* together.

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -175,7 +175,7 @@ var _ = Describe("quoted texts", func() { expected := `

*a

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("unbalanced bold in monospace - case 2", func() { @@ -183,7 +183,7 @@ var _ = Describe("quoted texts", func() { expected := `

a*b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("italic in monospace", func() { @@ -191,7 +191,7 @@ var _ = Describe("quoted texts", func() { expected := `

a

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("unbalanced italic in monospace", func() { @@ -199,7 +199,7 @@ var _ = Describe("quoted texts", func() { expected := `

a_b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("unparsed bold in monospace", func() { @@ -207,7 +207,7 @@ var _ = Describe("quoted texts", func() { expected := `

a*b*

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("parsed subscript in monospace", func() { @@ -215,7 +215,7 @@ var _ = Describe("quoted texts", func() { expected := `

ab

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multiline in monospace - case 1", func() { @@ -224,7 +224,7 @@ var _ = Describe("quoted texts", func() {

a b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("multiline in monospace - case 2", func() { @@ -233,7 +233,7 @@ b

a b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("link in bold", func() { @@ -241,7 +241,7 @@ b

expected := `

a b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("image in bold", func() { @@ -249,7 +249,7 @@ b

expected := `

a foo

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("singleplus passthrough in bold", func() { @@ -257,7 +257,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("tripleplus passthrough in bold", func() { @@ -265,7 +265,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("link in italic", func() { @@ -273,7 +273,7 @@ b

expected := `

a b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("image in italic", func() { @@ -281,7 +281,7 @@ b

expected := `

a foo

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("singleplus passthrough in italic", func() { @@ -289,7 +289,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("tripleplus passthrough in italic", func() { @@ -297,7 +297,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("link in monospace", func() { @@ -305,7 +305,7 @@ b

expected := `

a b

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("image in monospace", func() { @@ -313,7 +313,7 @@ b

expected := `

a foo

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("singleplus passthrough in monospace", func() { @@ -321,7 +321,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("tripleplus passthrough in monospace", func() { @@ -329,7 +329,7 @@ b

expected := `

a image:foo.png[]

` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/section_test.go b/pkg/renderer/html5/section_test.go index ec0ed75c..3f2ada6d 100644 --- a/pkg/renderer/html5/section_test.go +++ b/pkg/renderer/html5/section_test.go @@ -16,7 +16,7 @@ var _ = Describe("sections", func() { // top-level section is not rendered per-say, // but the section will be used to set the HTML page's element expected := `` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 1 alone", func() { @@ -28,7 +28,7 @@ var _ = Describe("sections", func() { <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 2 alone", func() { @@ -38,7 +38,7 @@ var _ = Describe("sections", func() { expected := `<div class="sect2"> <h3 id="_a_title">a title</h3> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 1 with just bold content", func() { @@ -48,7 +48,7 @@ var _ = Describe("sections", func() { <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 2 with nested bold content", func() { @@ -56,7 +56,7 @@ var _ = Describe("sections", func() { expected := `<div class="sect2"> <h3 id="_a_section_title_with_bold_content">a section title, with <strong>bold content</strong></h3> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 1 with custom ID", func() { @@ -70,7 +70,7 @@ var _ = Describe("sections", func() { <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section level 1 with custom prefix id", func() { @@ -83,7 +83,7 @@ var _ = Describe("sections", func() { <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("sections with same title", func() { @@ -100,7 +100,7 @@ var _ = Describe("sections", func() { <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -125,7 +125,7 @@ and a second paragraph` </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section with just a paragraph", func() { @@ -137,7 +137,7 @@ a paragraph` expected := `<div class="paragraph"> <p>a paragraph</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("header with preamble then section level 1", func() { @@ -170,7 +170,7 @@ with some text` </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("header with preamble then 2 sections level 1", func() { @@ -215,7 +215,7 @@ with some text, too` </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("section with listing block and subsection", func() { @@ -247,7 +247,7 @@ Listing block content is commonly used to preserve code input.</pre> </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -278,7 +278,7 @@ here</p> </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("should not include preamble wrapper", func() { @@ -301,7 +301,7 @@ here</p> </div> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/string_test.go b/pkg/renderer/html5/string_test.go index a2019e80..bf31d5aa 100644 --- a/pkg/renderer/html5/string_test.go +++ b/pkg/renderer/html5/string_test.go @@ -18,7 +18,7 @@ var _ = Describe("strings", func() { expected := `<div class="paragraph"> <p>some text…​</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/table_of_contents_test.go b/pkg/renderer/html5/table_of_contents_test.go index 2fe8f847..b72d7a37 100644 --- a/pkg/renderer/html5/table_of_contents_test.go +++ b/pkg/renderer/html5/table_of_contents_test.go @@ -82,7 +82,7 @@ A preamble... <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("toc with custom level", func() { @@ -170,7 +170,7 @@ A preamble... <div class="sectionbody"> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("document with no section", func() { @@ -182,7 +182,7 @@ level 1 sections not exists.` expected := `<div class="paragraph"> <p>level 1 sections not exists.</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/table_test.go b/pkg/renderer/html5/table_test.go index 40e06df8..baf34c8c 100644 --- a/pkg/renderer/html5/table_test.go +++ b/pkg/renderer/html5/table_test.go @@ -25,7 +25,7 @@ var _ = Describe("tables", func() { </tr> </tbody> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("1-line table with 3 cells", func() { @@ -46,7 +46,7 @@ var _ = Describe("tables", func() { </tr> </tbody> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("table with title, headers and 1 line per cell", func() { @@ -83,7 +83,7 @@ var _ = Describe("tables", func() { </tr> </tbody> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("empty table ", func() { @@ -91,7 +91,7 @@ var _ = Describe("tables", func() { |===` expected := `<table class="tableblock frame-all grid-all stretch"> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("2 tables with 1 counter", func() { @@ -128,7 +128,7 @@ var _ = Describe("tables", func() { </tr> </tbody> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("2 tables with 2 counters", func() { @@ -167,7 +167,7 @@ var _ = Describe("tables", func() { </tr> </tbody> </table>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) diff --git a/pkg/renderer/html5/unordered_list_test.go b/pkg/renderer/html5/unordered_list_test.go index 34e14a7d..9891f6e3 100644 --- a/pkg/renderer/html5/unordered_list_test.go +++ b/pkg/renderer/html5/unordered_list_test.go @@ -26,7 +26,7 @@ var _ = Describe("unordered lists", func() { </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("simple unordered list with no title then a paragraph", func() { @@ -51,7 +51,7 @@ and a standalone paragraph` <div class="paragraph"> <p>and a standalone paragraph</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("simple unordered list with title and role", func() { @@ -71,7 +71,7 @@ and a standalone paragraph` </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("simple unordered list with continuation", func() { @@ -93,7 +93,7 @@ foo </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("nested unordered lists without a title", func() { @@ -121,7 +121,7 @@ foo </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("nested unordered lists with a title", func() { @@ -150,7 +150,7 @@ foo </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("unordered list with item continuation", func() { @@ -185,7 +185,7 @@ another delimited block </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("unordered list without item continuation", func() { @@ -221,7 +221,7 @@ another delimited block <pre>another delimited block</pre> </div> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) @@ -250,7 +250,7 @@ var _ = Describe("checklists", func() { </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("parent checklist with title and nested checklist", func() { @@ -284,7 +284,7 @@ var _ = Describe("checklists", func() { </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("parent checklist with role and nested normal list", func() { @@ -313,7 +313,7 @@ var _ = Describe("checklists", func() { </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) Context("attach to unordered list item ancestor", func() { @@ -350,7 +350,7 @@ paragraph attached to grandparent list item` </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to parent unordered list item", func() { @@ -384,7 +384,7 @@ paragraph attached to parent list item` </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("attach to child unordered list item", func() { @@ -417,7 +417,7 @@ paragraph attached to child list item` </li> </ul> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) }) }) diff --git a/pkg/renderer/html5/user_macro_test.go b/pkg/renderer/html5/user_macro_test.go index 6fa8d38e..f30bb0d1 100644 --- a/pkg/renderer/html5/user_macro_test.go +++ b/pkg/renderer/html5/user_macro_test.go @@ -23,7 +23,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>hello::[]</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("user macro block", func() { @@ -34,7 +34,7 @@ var _ = Describe("user macros", func() { <span>hello world</span> </div> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("user macro block with attribute", func() { @@ -45,7 +45,7 @@ var _ = Describe("user macros", func() { <span>hello world!!!!</span> </div> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("user macro block with value", func() { @@ -56,7 +56,7 @@ var _ = Describe("user macros", func() { <span>hello JohnDoe</span> </div> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("user macro block with value and attributes", func() { @@ -67,7 +67,7 @@ var _ = Describe("user macros", func() { <span>Hi JohnDoe!!</span> </div> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("undefined inline macro", func() { @@ -76,7 +76,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>hello:[]</p> </div>` - Expect(source).To(RenderHTML5Element(expected)) + Expect(source).To(RenderHTML5Body(expected)) }) It("inline macro", func() { @@ -85,7 +85,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>AAA <span>hello world</span></p> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("inline macro with attribute", func() { @@ -94,7 +94,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>AAA <span>hello world!!!!!</span></p> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("inline macro with value", func() { @@ -103,7 +103,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>AAA <span>hello JohnDoe</span></p> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) It("inline macro with value and attributes", func() { @@ -112,7 +112,7 @@ var _ = Describe("user macros", func() { expected := `<div class="paragraph"> <p>AAA <span>Hi JohnDoe!!</span></p> </div>` - Expect(source).To(RenderHTML5Element(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) + Expect(source).To(RenderHTML5Body(expected, renderer.DefineMacro(helloMacroTmpl.Name(), helloMacroTmpl))) }) }) diff --git a/pkg/renderer/options.go b/pkg/renderer/options.go index ebab78c6..07205c50 100644 --- a/pkg/renderer/options.go +++ b/pkg/renderer/options.go @@ -2,18 +2,20 @@ package renderer import ( "time" + + "github.com/bytesparadise/libasciidoc/pkg/types" ) //Option the options when rendering a document type Option func(ctx *Context) const ( - //keyLastUpdated the key to specify the last update of the document to render. + // keyLastUpdated the key to specify the last update of the document to render. // Can be a string or a time, which will be formatted using the 2006/01/02 15:04:05 MST` pattern - keyLastUpdated string = "LastUpdated" - //keyIncludeHeaderFooter a bool value to indicate if the header and footer should be rendered + keyLastUpdated string = types.AttrLastUpdated + // keyIncludeHeaderFooter a bool value to indicate if the header and footer should be rendered keyIncludeHeaderFooter string = "IncludeHeaderFooter" - //keyEntrypoint a bool value to indicate if the entrypoint to start with when parsing the document + // keyEntrypoint a bool value to indicate if the entrypoint to start with when parsing the document keyEntrypoint string = "Entrypoint" // LastUpdatedFormat the time format for the `last updated` document attribute LastUpdatedFormat string = "2006/01/02 15:04:05 MST" diff --git a/pkg/types/element_attributes.go b/pkg/types/element_attributes.go index ab5179cb..5d7f4939 100644 --- a/pkg/types/element_attributes.go +++ b/pkg/types/element_attributes.go @@ -57,6 +57,8 @@ const ( AttrLineRanges = "lines" // AttrTagRanges the `tag`/`tags` attribute used in file inclusions AttrTagRanges = "tags" + // AttrLastUpdated the "last updated" data in the document, i.e., the output/generation time + AttrLastUpdated = "LastUpdated" ) // ElementWithAttributes an element on which attributes can be added/set diff --git a/testsupport/comparison.go b/testsupport/comparison.go index c435a703..78095e1c 100644 --- a/testsupport/comparison.go +++ b/testsupport/comparison.go @@ -27,6 +27,6 @@ func compare(actual interface{}, expected interface{}) comparison { } GinkgoT().Logf("actual:\n%s", c.actual) GinkgoT().Logf("expected:\n%s", c.expected) - // GinkgoT().Logf("diff:\n%s", c.diffs) + GinkgoT().Logf("diff:\n%s", c.diffs) return c } diff --git a/testsupport/html5_rendering_matcher.go b/testsupport/html5_rendering_matcher.go index e67b5dc9..c0bdee47 100644 --- a/testsupport/html5_rendering_matcher.go +++ b/testsupport/html5_rendering_matcher.go @@ -8,9 +8,7 @@ import ( "time" "github.com/bytesparadise/libasciidoc" - "github.com/bytesparadise/libasciidoc/pkg/parser" "github.com/bytesparadise/libasciidoc/pkg/renderer" - "github.com/bytesparadise/libasciidoc/pkg/renderer/html5" "github.com/bytesparadise/libasciidoc/pkg/types" gomegatypes "github.com/onsi/gomega/types" @@ -18,12 +16,12 @@ import ( ) // -------------------- -// Render HTML5 Element +// Render HTML5 Body // -------------------- -// RenderHTML5Element a custom matcher to verify that a block renders as the expectation -func RenderHTML5Element(expected string, options ...interface{}) gomegatypes.GomegaMatcher { - m := &html5ElementMatcher{ +// RenderHTML5Body a custom matcher to verify that a block renders as the expectation +func RenderHTML5Body(expected string, options ...interface{}) gomegatypes.GomegaMatcher { + m := &html5BodyMatcher{ expected: expected, filename: "test.adoc", opts: []renderer.Option{}, @@ -38,11 +36,11 @@ func RenderHTML5Element(expected string, options ...interface{}) gomegatypes.Gom return m } -func (m *html5ElementMatcher) setFilename(f string) { +func (m *html5BodyMatcher) setFilename(f string) { m.filename = f } -type html5ElementMatcher struct { +type html5BodyMatcher struct { opts []renderer.Option filename string expected string @@ -50,72 +48,6 @@ type html5ElementMatcher struct { comparison comparison } -func (m *html5ElementMatcher) Match(actual interface{}) (success bool, err error) { - content, ok := actual.(string) - if !ok { - return false, errors.Errorf("RenderHTML5Element matcher expects a string (actual: %T)", actual) - } - r := strings.NewReader(content) - doc, err := parser.ParseDocument(m.filename, r) - if err != nil { - return false, err - } - buff := bytes.NewBuffer(nil) - rendererCtx := renderer.Wrap(context.Background(), doc, m.opts...) - // insert tables of contents, preamble and process file inclusions - err = renderer.Prerender(rendererCtx) - if err != nil { - return false, err - } - _, err = html5.Render(rendererCtx, buff) - if err != nil { - return false, err - } - if strings.Contains(m.expected, "{{.LastUpdated}}") { - m.expected = strings.Replace(m.expected, "{{.LastUpdated}}", rendererCtx.LastUpdated(), 1) - } - m.actual = buff.String() - m.comparison = compare(m.actual, m.expected) - return m.comparison.diffs == "", nil -} - -func (m *html5ElementMatcher) FailureMessage(_ interface{}) (message string) { - return fmt.Sprintf("expected HTML5 elements to match:\n%s", m.comparison.diffs) -} - -func (m *html5ElementMatcher) NegatedFailureMessage(_ interface{}) (message string) { - return fmt.Sprintf("expected HTML5 elements not to match:\n%s", m.comparison.diffs) -} - -// -------------------- -// Render HTML5 Body -// -------------------- - -// RenderHTML5Body a custom matcher to verify that a block renders as the expectation -func RenderHTML5Body(expected string, options ...interface{}) gomegatypes.GomegaMatcher { - m := &html5BodyMatcher{ - expected: expected, - filename: "test.adoc", - } - for _, o := range options { - if configure, ok := o.(FilenameOption); ok { - configure(m) - } - } - return m -} - -func (m *html5BodyMatcher) setFilename(f string) { - m.filename = f -} - -type html5BodyMatcher struct { - filename string - expected string - actual string - opts []renderer.Option -} - func (m *html5BodyMatcher) Match(actual interface{}) (success bool, err error) { content, ok := actual.(string) if !ok { @@ -123,12 +55,18 @@ func (m *html5BodyMatcher) Match(actual interface{}) (success bool, err error) { } contentReader := strings.NewReader(content) resultWriter := bytes.NewBuffer(nil) - _, err = libasciidoc.ConvertToHTML(context.Background(), m.filename, contentReader, resultWriter, renderer.IncludeHeaderFooter(false)) + metadata, err := libasciidoc.ConvertToHTML(context.Background(), m.filename, contentReader, resultWriter, m.opts...) if err != nil { return false, err } + if strings.Contains(m.expected, "{{.LastUpdated}}") { + if lastUpdated, ok := metadata[types.AttrLastUpdated].(string); ok { + m.expected = strings.Replace(m.expected, "{{.LastUpdated}}", lastUpdated, 1) + } + } m.actual = resultWriter.String() - return m.expected == m.actual, nil + m.comparison = compare(m.actual, m.expected) + return m.comparison.diffs == "", nil } func (m *html5BodyMatcher) FailureMessage(_ interface{}) (message string) { diff --git a/testsupport/html5_rendering_matcher_test.go b/testsupport/html5_rendering_matcher_test.go index a24a913c..bb329238 100644 --- a/testsupport/html5_rendering_matcher_test.go +++ b/testsupport/html5_rendering_matcher_test.go @@ -11,52 +11,6 @@ import ( var _ = Describe("html5 rendering assertions", func() { - Context("HTML5 element matcher", func() { - - expected := `<div class="paragraph"> -<p>hello, world!</p> -</div>` - - It("should match", func() { - // given - matcher := testsupport.RenderHTML5Element(expected) - actual := "hello, world!" - // when - result, err := matcher.Match(actual) - // then - Expect(err).ToNot(HaveOccurred()) - Expect(result).To(BeTrue()) - }) - - It("should not match", func() { - // given - matcher := testsupport.RenderHTML5Element(expected) - actual := "foo" - // when - result, err := matcher.Match(actual) - // then - Expect(err).ToNot(HaveOccurred()) - Expect(result).To(BeFalse()) - // also verify the messages - obtained := `<div class="paragraph"> -<p>foo</p> -</div>` - Expect(matcher.FailureMessage(actual)).To(Equal(fmt.Sprintf("expected HTML5 elements to match:\n%s", compare(obtained, expected)))) - Expect(matcher.NegatedFailureMessage(actual)).To(Equal(fmt.Sprintf("expected HTML5 elements not to match:\n%s", compare(obtained, expected)))) - }) - - It("should return error when invalid type is input", func() { - // given - matcher := testsupport.RenderHTML5Element("") - // when - result, err := matcher.Match(1) // not a string - // then - Expect(err).To(HaveOccurred()) - Expect(err.Error()).To(Equal("RenderHTML5Element matcher expects a string (actual: int)")) - Expect(result).To(BeFalse()) - }) - }) - Context("HTML5 body matcher", func() { expected := `<div class="paragraph">