diff options
| author | Shulhan <ms@kilabit.info> | 2020-12-20 22:16:22 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2020-12-20 22:16:22 +0700 |
| commit | 5f5d58018a18e8da98da0ae2ae967347a6d1ec5b (patch) | |
| tree | 8a82b7fd0f6b56c817fc8ddd74fe33c6d7105fa0 /html_backend.go | |
| parent | 2792059be446ef08c93d7d85a3034deb86683736 (diff) | |
| download | asciidoctor-go-5f5d58018a18e8da98da0ae2ae967347a6d1ec5b.tar.xz | |
all: do not wrap document with content and preamble on ToEmbeddedHTML
Previously, HTMl document generated from ToEmbeddedHTML contains div
with id "content" and sub div "preamble".
This changes, make the ToEmbeddedHTML generate the HTML document without
those divs wrapper.
Diffstat (limited to 'html_backend.go')
| -rw-r--r-- | html_backend.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/html_backend.go b/html_backend.go index f5ad7fb..4e68233 100644 --- a/html_backend.go +++ b/html_backend.go @@ -286,7 +286,9 @@ func htmlWriteBlockVideo(node *adocNode, out io.Writer) { } func htmlWriteBody(doc *Document, out *bytes.Buffer) { - fmt.Fprint(out, "\n<div id=\"content\">") + if !doc.isEmbedded { + fmt.Fprint(out, "\n<div id=\"content\">") + } if doc.content.child != nil { doc.content.child.toHTML(doc, out, false) @@ -295,7 +297,9 @@ func htmlWriteBody(doc *Document, out *bytes.Buffer) { doc.content.next.toHTML(doc, out, false) } - fmt.Fprint(out, "\n</div>") + if !doc.isEmbedded { + fmt.Fprint(out, "\n</div>") + } } func htmlWriteFooter(doc *Document, out io.Writer) { @@ -327,7 +331,7 @@ func htmlWriteHeader(doc *Document, out io.Writer) { _, ok := doc.Attributes[metaNameShowTitle] if ok { _, ok = doc.Attributes[metaNameNoTitle] - if !ok { + if !ok && doc.Title.node != nil { fmt.Fprint(out, "\n<h1>") doc.Title.node.toHTML(doc, out, false) fmt.Fprint(out, "</h1>") @@ -664,7 +668,9 @@ func htmlWriteTableRow(doc *Document, table *adocTable, row *tableRow, out io.Wr switch format.style { case colStyleAsciidoc: subdoc := parseSub(doc, contentTrimmed) + fmt.Fprint(out, "\n<div id=\"content\">") _ = subdoc.ToEmbeddedHTML(out) + fmt.Fprint(out, "\n</div>") case colStyleDefault: rawParagraphs := bytes.Split(contentTrimmed, []byte("\n\n")) |
