aboutsummaryrefslogtreecommitdiff
path: root/html_backend.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-12-16 00:54:47 +0700
committerShulhan <ms@kilabit.info>2022-12-16 00:54:47 +0700
commitab6eaa00847d5b468acbc503b7b19b3cc99fb8b8 (patch)
treecfe691a0315d91258d24b12bd831f8988e4f5911 /html_backend.go
parent4b1ade55e50aa2768deecf101cb8d7c24f3bb6b3 (diff)
downloadasciidoctor-go-ab6eaa00847d5b468acbc503b7b19b3cc99fb8b8.tar.xz
all: add support for document attribute "last-update-label"
By default the last-update-label value set to "Last updated" and the value is the document modification time. If the label is suppressed with "!", no "Last updated" will be print on the footer.
Diffstat (limited to 'html_backend.go')
-rw-r--r--html_backend.go29
1 files changed, 17 insertions, 12 deletions
diff --git a/html_backend.go b/html_backend.go
index 1bbefcb..1635328 100644
--- a/html_backend.go
+++ b/html_backend.go
@@ -880,28 +880,33 @@ func htmlWriteBody(doc *Document, out *bytes.Buffer) {
}
func htmlWriteFooter(doc *Document, out io.Writer) {
+ var (
+ label string
+ value string
+ ok bool
+ )
+
fmt.Fprint(out, `
<div id="footer">
<div id="footer-text">`)
if len(doc.Revision.Number) > 0 {
- var (
- prefix string
- ok bool
- )
-
- prefix, ok = doc.Attributes[metaNameVersionLabel]
- if ok && len(prefix) == 0 {
- prefix = `Version `
+ label, ok = doc.Attributes[metaNameVersionLabel]
+ if ok && len(label) == 0 {
+ label = `Version `
} else {
- prefix = ` `
+ label = ` `
}
- fmt.Fprintf(out, "\n%s%s<br>", prefix, doc.Revision.Number)
+ fmt.Fprintf(out, "\n%s%s<br>", label, doc.Revision.Number)
}
- if len(doc.LastUpdated) > 0 {
- fmt.Fprintf(out, "\nLast updated %s", doc.LastUpdated)
+ label, ok = doc.Attributes[metaNameLastUpdateLabel]
+ if ok {
+ value = doc.Attributes[metaNameLastUpdateValue]
+ if len(value) != 0 {
+ fmt.Fprintf(out, "\n%s %s", label, value)
+ }
}
fmt.Fprint(out, "\n</div>\n</div>")