aboutsummaryrefslogtreecommitdiff
path: root/html_backend.go
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-12-05 19:39:11 +0700
committerShulhan <m.shulhan@gmail.com>2020-12-05 20:05:10 +0700
commit7cc14a22ade15f577729fdc03d7e0f9f6012e6ae (patch)
tree8d7b0ac57ee78b204fd5cd782f19f92721104269 /html_backend.go
parent89c6d811223117665824f046f66ed6c5c2bfb064 (diff)
downloadasciidoctor-go-7cc14a22ade15f577729fdc03d7e0f9f6012e6ae.tar.xz
all: render the table caption with auto numbering
Diffstat (limited to 'html_backend.go')
-rw-r--r--html_backend.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/html_backend.go b/html_backend.go
index 08d2775..1d922b5 100644
--- a/html_backend.go
+++ b/html_backend.go
@@ -554,6 +554,25 @@ func htmlWriteTable(doc *Document, node *adocNode, out io.Writer) {
}
fmt.Fprint(out, ">")
+ if len(node.rawTitle) > 0 {
+ var (
+ caption string
+ ok bool
+ )
+
+ doc.counterTable++
+ _, withTableCaption := doc.Attributes[metaNameTableCaption]
+
+ if withTableCaption {
+ caption, ok = node.Attrs[attrNameCaption]
+ if !ok {
+ caption = fmt.Sprintf("Table %d.", doc.counterTable)
+ }
+ }
+ fmt.Fprintf(out, "\n<caption class=%q>%s %s</caption>",
+ attrValueTitle, caption, node.rawTitle)
+ }
+
fmt.Fprint(out, "\n<colgroup>")
for _, format := range table.formats {
if format.width != nil {