Bump libasciidoc

This commit is contained in:
2022-03-03 14:28:15 +01:00
parent 8b376694d3
commit 442fa5d660
3 changed files with 78 additions and 58 deletions

View File

@@ -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
}