From 1469a3cae77976a36462b2d990f6deca0fe352ac Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 19 Dec 2022 23:41:07 +0700 Subject: all: update reference for preamble and add unit test --- README | 2 +- _doc/SPECS.adoc | 2 ++ document_test.go | 4 ++++ testdata/html/preamble.adoc | 11 +++++++++++ testdata/html/preamble.exp.html | 44 +++++++++++++++++++++++++++++++++++++++++ testdata/html/to-html.sh | 1 + 6 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 testdata/html/preamble.adoc create mode 100644 testdata/html/preamble.exp.html diff --git a/README b/README index 4770e22..a4688a7 100644 --- a/README +++ b/README @@ -34,7 +34,7 @@ The numbered one is based on the old documentation. ** {url_ref}/document/author-information/[Author information^] ** {url_ref}/document/revision-information/[Revision information^] ** {url_ref}/document/metadata/[Metadata^] -* 15. Preamble +* {url_ref}/blocks/preamble-and-lead/[Preamble^] * 16. Sections ** 16.1. Titles as HTML headings ** 16.2. Auto-generated IDs diff --git a/_doc/SPECS.adoc b/_doc/SPECS.adoc index 7bfae81..3ceb8ae 100644 --- a/_doc/SPECS.adoc +++ b/_doc/SPECS.adoc @@ -157,6 +157,8 @@ HTML format for rendering section header, == Document preamble +{url_ref}/blocks/preamble-and-lead/[Reference^] + Any content after document title and before the new section is considered as document preamble and its rendered inside the "content", not "header". diff --git a/document_test.go b/document_test.go index 42e9b03..f36be73 100644 --- a/document_test.go +++ b/document_test.go @@ -108,6 +108,10 @@ func TestDocument_ToHTML(t *testing.T) { name: `header`, fileAdoc: `testdata/html/header.adoc`, fileExpHtml: `testdata/html/header.exp.html`, + }, { + name: `preamble`, + fileAdoc: `testdata/html/preamble.adoc`, + fileExpHtml: `testdata/html/preamble.exp.html`, }} c testCase diff --git a/testdata/html/preamble.adoc b/testdata/html/preamble.adoc new file mode 100644 index 0000000..2eaec88 --- /dev/null +++ b/testdata/html/preamble.adoc @@ -0,0 +1,11 @@ += Title +John Doe +v1.0, 15 Dec 2022 +:last-update-label!: +:idprefix: + +This is preamble. + +== Section 2 + +Section 2 content. diff --git a/testdata/html/preamble.exp.html b/testdata/html/preamble.exp.html new file mode 100644 index 0000000..b4b5b23 --- /dev/null +++ b/testdata/html/preamble.exp.html @@ -0,0 +1,44 @@ + + + + + + + + +Title + + + +
+
+
+
+

This is preamble.

+
+
+
+
+

Section 2

+
+
+

Section 2 content.

+
+
+
+
+ + + \ No newline at end of file diff --git a/testdata/html/to-html.sh b/testdata/html/to-html.sh index 7d45b15..85a4ea8 100755 --- a/testdata/html/to-html.sh +++ b/testdata/html/to-html.sh @@ -3,3 +3,4 @@ ## Script to convert all adoc files to HTML without stylesheet. asciidoctor -a stylesheet! -o header.exp.html header.adoc +asciidoctor -a stylesheet! -o preamble.exp.html preamble.adoc -- cgit v1.3