Documentation
¶
Overview ¶
Package render converts the representations of a page tree with asciidoctorg and titles its pages (PG-3, PG-8..10, MC-3): what every output needs, whatever it writes the pages to. The HTML site (package site) lays the result out as files; another output can take the same result.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Logger receives debug records (page durations) and Asciidoctor's own
// messages, with the page and model location (asciidocLog); nil uses
// slog.Default.
Logger *slog.Logger
// Pages decides the macros' links between pages (MC-18); nil uses the
// tree's relative links (tree.Tree.Href), as in the HTML site.
Pages macros.Pages
// Views renders the views sysml-view shows (MC-21); nil leaves every
// sysml-view a failure (MC-19).
Views macros.Views
}
Options are how Tree renders.
type Page ¶
type Page struct {
Title Title
Own, Inherited []template.HTML // asciidoctorg output, secure safe mode
}
Page is a page's title and converted representations: its own, then the inherited ones, nearest first (PG-7). An empty ancestor page (PG-6) has a title and no representations.
type Result ¶
type Result struct {
Tree *tree.Tree
// Pages has every page of Tree.Pages; the root (the landing page, PT-5)
// has none.
Pages map[*tree.Node]*Page
// Warnings are the macros' warnings, each once per page and macro, in
// the order first seen, failing macros included, with their location
// filled when found (MC-7, MC-19).
Warnings []macros.Warning
}
Result is a rendered page tree.
func Tree ¶
Tree converts the representations of every page of t, on every page that shows them, since macros may render them differently per page (MC-3), then titles the pages. Cancelling ctx stops the rendering (CLI-7): between pages, inside a conversion at asciidoctorg's next checkpoint (before each block is parsed or converted, and at each macro), and inside macro evaluations. A macro that fails leaves a placeholder on its page and a warning, and rendering goes on (MC-19); only a cancelled ctx or a rendering bug returns an error.