This gem introduces a module called Sourcerer, by which AsciiDoc files can be parsed and their contents harvested for use in the application build. The module also handles Liquid template processing with enhanced attribute resolution capabilities.
|
Note
|
Sourcerer is intended to be spun off as its own gem once it successfully proves the concept in this gem. It will probably be called AsciiSourcerer and may replace an older and unmaintained utility of mine called LiquiDoc. |
It is invoked in the Rakefile, establishing global namespaces:
-
ReleaseHx::ATTRIBUTES[:globals](derived from thisREADME.adocfile) -
ReleaseHx.read_built_snippet(:<name>)(such as:helpscreen)
The Sourcerer module also generates files like build/docs/manpage.adoc, which generates the formatted terminal manual, using content from build/docs/config-reference.adoc and this README (tags="cli_options", for instance).
It also generates an AsciiDoc-formatted configuration reference, a machine-readable JSON reference, and a sample config using the specs/data/config-def.yml file.
The Sourcerer system now supports attribute resolution from AsciiDoc source files, enabling templates to access README attributes during rendering, ensuring configuration documentation reflects actual default values.
Sourcerer also performs basic testing of select commands in the ASciiDoc file that have been assigned a testable role.
This is mostly just showing off what Sourcerer can do, and hopefully setting into habit some best practices for my more complicated apps.
Sourcerer is also where integration with Jekyll’s extensions of Liquid occurs, bringing ReleaseHx’s templating powers closely in line with how Jekyll’s work, as described in [custom-liquid].