aboutsummaryrefslogtreecommitdiff
path: root/document.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-02-13 19:20:19 +0700
committerShulhan <ms@kilabit.info>2025-02-13 20:32:18 +0700
commit56a1e4c4bfa2adb882bd9f0fc33b16110a2d09bd (patch)
tree701b1a8aef458a13595da4adf7e6659c1b205b1e /document.go
parente0504ba09e1113b9638baff89442679a437db63b (diff)
downloadasciidoctor-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.go14
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