@techwriter/pmodel

Query adoc files for structure


License
MIT
Install
npm install @techwriter/pmodel@0.0.1

Documentation

Analysing AsciiDoc using pmodel

pmodel runs against adoc files and produces reports.

To install pmodel:

npm i -g @techwriter/pmodel

To test an adoc file:

pmodel <adoc-file>

Example output shows that all elements exist:

{
"filename":"README.adoc",
"ID":"analysing_{context}",
"heading":"Analysing AsciiDoc using `pmodel`",
"abstract":"`pmodel` runs against `adoc` files and produces reports.",
"dummy":0}

To test a directory:

cd <dir>
pmodel parse

The parse keyword triggers pmodel to recursively search for AsciiDoc files and run the test, output can be queried with alasql.

pmodel parse > test.json

alasql 'select heading, abstract from JSON("test.json") where abstract is not null'

Tests

The following tests are performed:

  • Capture Level 1 heading. If there are two level 1 headings, both are captured.

  • Capture first line after [role="_ abstract"]

  • Capture id value