Skip to content

Commit

Permalink
fix(parser): expose authors and revision in the document attributes (#…
Browse files Browse the repository at this point in the history
…521)

also, expand the attributes so we can substitute the 'author',
'firstname', etc. attributes in the document during the processing

fixes #517

Signed-off-by: Xavier Coulon <xcoulon@redhat.com>
  • Loading branch information
xcoulon authored Mar 29, 2020
1 parent 3ccad1f commit 9335817
Show file tree
Hide file tree
Showing 17 changed files with 820 additions and 648 deletions.
5 changes: 4 additions & 1 deletion cmd/libasciidoc/root_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ var _ = Describe("root cmd", func() {
// when
err := root.Execute()
// then
GinkgoT().Logf("out: %v", buf.String())
Expect(err).ToNot(HaveOccurred())
Expect(buf.String()).ToNot(BeEmpty())
Expect(buf.String()).To(Equal(`<div class="paragraph">
// console output also includes a warning message
Expect(buf.String()).To(Equal(`level=warning msg="unable to find attribute 'foo2'"
<div class="paragraph">
<p>bar1 and {foo2}</p>
</div>`))
})
Expand Down
2 changes: 1 addition & 1 deletion libasciidoc.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func ConvertToHTML(r io.Reader, output io.Writer, config configuration.Configura
return types.Metadata{}, err
}
rendererCtx := renderer.NewContext(doc, config)
// insert tables of contents, preamble and process file inclusions
// insert tables of contents and preamble
err = renderer.Prerender(rendererCtx)
if err != nil {
return types.Metadata{}, err
Expand Down
Loading

0 comments on commit 9335817

Please sign in to comment.