pugneum-linker
v1.1.0
Published
Link together multiple pugneum abstract syntax trees
Readme
pugneum-linker
Link multiple pugneum ASTs together using include/extends
Installation
npm install pugneum-linkerUsage
var link = require('pugneum-linker');link(ast, options)
Flatten the pugneum AST of inclusion and inheritance.
This function merely links the AST together.
It doesn't read the file system to resolve
and parse included and extended files.
Thus, the main AST must already have the ASTs
of the included and extended files embedded
in the FileReference nodes.
pugneum-loader is designed to do that.
options can contain the following properties:
source(string): pugneum source code; used for error contextmaxLinkDepth(number): maximum template inheritance/include chain depth; default256
The linker also resolves:
- Reference links/images —
@[name]and![name]nodes are resolved against areferencesblock. Definitions can include optional default display text:name url Default Text. - Footnotes —
^[name]nodes are resolved against afootnotesblock. Three-pass architecture: collect definitions, resolve all references (including nested refs in definition content), then generate the<section role="doc-endnotes">structure with numbered markers and DPUB-ARIA accessibility roles. - Table of contents —
tocnodes are replaced with a<nav role="doc-toc">containing nested<ol>lists linking to headings with explicitidattributes.
License
MIT
