Functionality
This gem processes Asciidoctor documents following a template for generating CSD International Standards.
The gem currently inherits from the https://github.com/metanorma/metanorma-standoc gem, and aligns closely to it. Refer to the ISO gem documentation for guidance, including https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring
The following outputs are generated.
-
(Optional) An HTML preview generated directly from the Asciidoctor document, using native Asciidoc formatting.
-
AsciiMathML is to be used for mathematical formatting. The gem uses the Ruby AsciiMath parser, which is syntactically stricter than the common MathJax processor; if you do not get expected results, try bracketting terms your in AsciiMathML expressions.
-
-
an XML representation of the document, intended as a document model for CSD International Standards.
-
The XML representation is processed in turn to generate the following outputs as end deliverable CSD standard drafts.
-
HTML
-
PDF
-
This AsciiDoc syntax for writing CSD standards is hereby named "AsciiCSD".
Usage
The preferred way to invoke this gem is via the metanorma
script:
$ metanorma --type csd a.adoc # output HTML and PDF
$ metanorma --type csd --extensions html a.adoc # output just HTML
$ metanorma --type csd --extensions pdf a.adoc # output just PDF
$ metanorma --type csd --extensions xml a.adoc # output CSD XML
The gem translates the document into CSD XML format, and then validates its output against the CSD XML document model; errors are reported to console against the XML, and are intended for users to check that they have provided all necessary components of the document.
The gem then converts the XML into HTML and PDF.
Installation
If you are using a Mac, the https://github.com/metanorma/metanorma-macos-setup repository has instructions on setting up your machine to run Metanorma scripts such as this one. You need only run the following in a Terminal console:
$ bash <(curl -s https://raw.githubusercontent.com/metanorma/metanorma-macos-setup/master/metanorma-setup)
$ gem install metanorma-csd
PDF output
PDF output is generated by printing the HTML output as PDF. This is done within the gem, using Headless Chrome, via the Puppeteer Node library.
To get the PDF output working, do the following:
-
Install Node, with at least version 7.6.0: https://nodejs.org/en/download/, https://nodejs.org/en/download/package-manager/ . (For Mac,
brew install node
) -
Install npm: https://docs.npmjs.com/getting-started/installing-node
-
Install puppeteer:
npm install -g --save --save-exact puppeteer
The https://github.com/metanorma/metanorma-macos-setup script includes Puppeteer installation.
Documentation
Examples
-
Example documents are avalable at the mn-samples-cc repository.
-
Document templates are available at the mn-templates-csd repository.