diff options
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | _doc/SPECS.adoc | 2 | ||||
| -rw-r--r-- | document_test.go | 4 | ||||
| -rw-r--r-- | testdata/html/preamble.adoc | 11 | ||||
| -rw-r--r-- | testdata/html/preamble.exp.html | 44 | ||||
| -rwxr-xr-x | testdata/html/to-html.sh | 1 |
6 files changed, 63 insertions, 1 deletions
@@ -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 <john@doe.tld> +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 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="UTF-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="generator" content="Asciidoctor 2.0.18"> +<meta name="author" content="John Doe"> +<title>Title</title> +</head> +<body class="article"> +<div id="header"> +<h1>Title</h1> +<div class="details"> +<span id="author" class="author">John Doe</span><br> +<span id="email" class="email"><a href="mailto:john@doe.tld">john@doe.tld</a></span><br> +<span id="revnumber">version 1.0,</span> +<span id="revdate">15 Dec 2022</span> +</div> +</div> +<div id="content"> +<div id="preamble"> +<div class="sectionbody"> +<div class="paragraph"> +<p>This is preamble.</p> +</div> +</div> +</div> +<div class="sect1"> +<h2 id="section_2">Section 2</h2> +<div class="sectionbody"> +<div class="paragraph"> +<p>Section 2 content.</p> +</div> +</div> +</div> +</div> +<div id="footer"> +<div id="footer-text"> +Version 1.0<br> +</div> +</div> +</body> +</html>
\ 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 |
