From 442fa5d6607d6188be01d342e1bc7d24b977bd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Thu, 3 Mar 2022 14:28:15 +0100 Subject: Bump libasciidoc --- hswg/main.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'hswg/main.go') 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("") } - meta.Attributes = doc.Attributes + meta.Attributes = config.Attributes return } -- cgit v1.2.3