diff options
| author | Shulhan <ms@kilabit.info> | 2025-02-13 19:20:19 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2025-02-13 20:32:18 +0700 |
| commit | 56a1e4c4bfa2adb882bd9f0fc33b16110a2d09bd (patch) | |
| tree | 701b1a8aef458a13595da4adf7e6659c1b205b1e /document.go | |
| parent | e0504ba09e1113b9638baff89442679a437db63b (diff) | |
| download | asciidoctor-go-56a1e4c4bfa2adb882bd9f0fc33b16110a2d09bd.tar.xz | |
all: add default HTML stylesheet
The generated HTML now contains the default stylesheet.
The stylesheet is copied from HTML file generated by Asciidoctor v2.0.23.
Diffstat (limited to 'document.go')
| -rw-r--r-- | document.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/document.go b/document.go index cfa3eeb..29d589e 100644 --- a/document.go +++ b/document.go @@ -203,12 +203,18 @@ func (doc *Document) ToHTML(out io.Writer) (err error) { fmt.Fprintf(buf, "\n<title>%s</title>", title) } + var ok bool + + _, ok = doc.Attributes.Entry[docAttrStylesheet] + if ok { + buf.WriteByte('\n') + buf.WriteString(_defaultCSS) + } + fmt.Fprintf(buf, "\n</head>\n<body class=%q>\n", doc.classes.String()) - var ( - isWithHeaderFooter = true - ok bool - ) + var isWithHeaderFooter = true + _, ok = doc.Attributes.Entry[docAttrNoHeaderFooter] if ok { isWithHeaderFooter = false |
