aboutsummaryrefslogtreecommitdiff
path: root/hswg/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'hswg/main.go')
-rw-r--r--hswg/main.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/hswg/main.go b/hswg/main.go
index 313d2ff..458fe87 100644
--- a/hswg/main.go
+++ b/hswg/main.go
@@ -63,7 +63,7 @@ func (m *Metadata) AttrList(name string) []string {
// Render converts an io.Reader with an AsciiDoc document to HTML. So long as
// the file could be read at all, it will always return a non-empty document.
-func Render(r io.Reader, config configuration.Configuration) (
+func Render(r io.Reader, config *configuration.Configuration) (
html *bytes.Buffer, meta Metadata, err error) {
html = bytes.NewBuffer(nil)
@@ -81,9 +81,11 @@ func Render(r io.Reader, config configuration.Configuration) (
// io.Copy(os.Stdout, pr)
// return
- var doc types.Document
+ var doc *types.Document
if doc, err = parser.ParseDocument(pr, config); err == nil {
- problems, verr := validator.Validate(&doc)
+ doctype := config.Attributes.GetAsStringWithDefault(
+ types.AttrDocType, "article")
+ problems, verr := validator.Validate(doc, doctype)
if verr != nil {
fmt.Fprintln(os.Stderr, verr)
}
@@ -104,7 +106,7 @@ func Render(r io.Reader, config configuration.Configuration) (
}
_, _ = html.WriteString("</pre>")
}
- meta.Attributes = doc.Attributes
+ meta.Attributes = config.Attributes
return
}