aboutsummaryrefslogtreecommitdiff
path: root/filehtml.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-07-24 21:49:40 +0700
committerShulhan <ms@kilabit.info>2022-07-24 21:49:40 +0700
commitb1ac34fb775bcf0d15ac61de7dcbb6c30d03f46d (patch)
tree6e9479db8f1ce1d0f3b503b2e246a4fceb11a49f /filehtml.go
parent73584411dcb3563e373e5b4d6c6a40cc0656bfc6 (diff)
downloadciigo-b1ac34fb775bcf0d15ac61de7dcbb6c30d03f46d.tar.xz
all: generate HTML meta data and replace the top header title
The following metadata are rendered based on the same asciidoc attributes: author, description, generator, and keywords. This changes also replace the topbar title with the document title, cleanup the HTML header syntax by replacing "/>" with ">", trim leading and trailing spaces on Body and embedded CSS.
Diffstat (limited to 'filehtml.go')
-rw-r--r--filehtml.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/filehtml.go b/filehtml.go
index 96c6e21..202c605 100644
--- a/filehtml.go
+++ b/filehtml.go
@@ -12,6 +12,10 @@ import (
"git.sr.ht/~shulhan/asciidoctor-go"
)
+const (
+ metadataStylesheet = "stylesheet"
+)
+
// fileHtml represent an HTML metadata for header and its body.
type fileHtml struct {
Title string
@@ -42,7 +46,11 @@ func (fhtml *fileHtml) unpackAdocMetadata(doc *asciidoctor.Document) {
switch k {
case metadataStylesheet:
fhtml.Styles = append(fhtml.Styles, v)
- default:
+ case asciidoctor.MetaNameAuthorNames:
+ fhtml.Metadata[asciidoctor.MetaNameAuthor] = v
+ case asciidoctor.MetaNameDescription,
+ asciidoctor.MetaNameGenerator,
+ asciidoctor.MetaNameKeywords:
fhtml.Metadata[k] = v
}
}