diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | document.go | 13 | ||||
| -rw-r--r-- | document_test.go | 7 | ||||
| -rw-r--r-- | testdata/empty.css | 0 | ||||
| -rw-r--r-- | testdata/test.exp.html | 7 | ||||
| -rw-r--r-- | testdata/test.got.html | 7 |
6 files changed, 16 insertions, 20 deletions
@@ -14,7 +14,7 @@ test: go tool cover -html=cover.out -o cover.html test-parser: - asciidoctor --attribute stylesheet=empty.css \ + asciidoctor --attribute stylesheet! \ --out-file=testdata/test.exp.html \ testdata/test.adoc go test -v -run=Open . diff --git a/document.go b/document.go index aa6672a..653a3e1 100644 --- a/document.go +++ b/document.go @@ -186,9 +186,9 @@ func (doc *Document) ToHTML(out io.Writer) (err error) { fmt.Fprint(buf, _htmlBegin) - metaValue = doc.Attributes[MetaNameAuthorNames] + metaValue = doc.Attributes[MetaNameGenerator] if len(metaValue) > 0 { - fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameAuthor, metaValue) + fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameGenerator, metaValue) } metaValue = doc.Attributes[MetaNameDescription] @@ -196,21 +196,20 @@ func (doc *Document) ToHTML(out io.Writer) (err error) { fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameDescription, metaValue) } - metaValue = doc.Attributes[MetaNameGenerator] + metaValue = doc.Attributes[MetaNameKeywords] if len(metaValue) > 0 { - fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameGenerator, metaValue) + fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameKeywords, metaValue) } - metaValue = doc.Attributes[MetaNameKeywords] + metaValue = doc.Attributes[MetaNameAuthorNames] if len(metaValue) > 0 { - fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameKeywords, metaValue) + fmt.Fprintf(buf, "\n<meta name=%q content=%q>", MetaNameAuthor, metaValue) } var title string = doc.Title.String() if len(title) > 0 { fmt.Fprintf(buf, "\n<title>%s</title>", title) } - fmt.Fprint(buf, "\n<style>\n\n</style>") fmt.Fprintf(buf, "\n</head>\n<body class=%q>", doc.classes.String()) diff --git a/document_test.go b/document_test.go index 12a9439..a6f60e7 100644 --- a/document_test.go +++ b/document_test.go @@ -22,8 +22,11 @@ func TestOpen(t *testing.T) { t.Fatal(err) } - fout, err = os.OpenFile(`testdata/test.got.html`, - os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) + // Since we cannot overwrite the asciidoctor output for + // generator, we override ourself. + doc.Attributes[MetaNameGenerator] = `Asciidoctor 2.0.18` + + fout, err = os.OpenFile(`testdata/test.got.html`, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { t.Fatal(err) } diff --git a/testdata/empty.css b/testdata/empty.css deleted file mode 100644 index e69de29..0000000 --- a/testdata/empty.css +++ /dev/null diff --git a/testdata/test.exp.html b/testdata/test.exp.html index 30eddd9..6af6df4 100644 --- a/testdata/test.exp.html +++ b/testdata/test.exp.html @@ -4,14 +4,11 @@ <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -<meta name="generator" content="Asciidoctor 2.0.17"> +<meta name="generator" content="Asciidoctor 2.0.18"> <meta name="description" content="meta description"> <meta name="keywords" content="key, words"> <meta name="author" content="Author A, Author mid dle B"> <title>Example Document title</title> -<style> - -</style> </head> <body class="article"> <div id="header"> @@ -2998,7 +2995,7 @@ this sidebar.</p> <div id="footer"> <div id="footer-text"> 1.1.1<br> -Last updated 2022-09-04 23:41:43 +0700 +Last updated 2022-10-18 00:21:57 +0700 </div> </div> </body> diff --git a/testdata/test.got.html b/testdata/test.got.html index d21e7a4..512f9a7 100644 --- a/testdata/test.got.html +++ b/testdata/test.got.html @@ -4,14 +4,11 @@ <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> -<meta name="author" content="Author A, Author mid dle B"> +<meta name="generator" content="Asciidoctor 2.0.18"> <meta name="description" content="meta description"> -<meta name="generator" content="asciidoctor-go 0.3.2"> <meta name="keywords" content="key, words"> +<meta name="author" content="Author A, Author mid dle B"> <title>Example Document title</title> -<style> - -</style> </head> <body class="article"> <div id="header"> |
