GitHub - metanorma/metanorma-iso: Metanorma processor for ISO standards

GitHub

3 min read Original article ↗

Functionality and Approach

For the conceptual underpinnings of this gem, and the other gems in the Metanorma suite, see the metanorma-standoc README.

Outputs

This gem processes Metanorma documents following a template for generating ISO International Standards. The following outputs are generated.

  • The XML representation of the document, intended as a document model for ISO International Standards.

  • Microsoft Word output (.doc), following the style conventions of the ISO Standard Microsoft Word template, via the html2doc MHT pipeline.

  • Microsoft Word output (.docx), a native OOXML format produced directly from the XML model via the Uniword builder, with no HTML intermediate.

  • HTML. For ISO, two HTML files are generated: the .html file follows ISO conventions in rendering, which looks very similar to the Word output, while the -alt.html file has richer styling.

  • PDF. Not supported for the ISO gem, but available for other specifications, generated from the HTML file.

The following input formats are supported:

  • Asciidoctor (This AsciiDoc syntax for writing ISO standards is hereby named "AsciiISO".)

Usage

The preferred way to invoke this gem is via the metanorma script:

$ metanorma --type iso a.adoc                    # output HTML and DOC
$ metanorma --type iso --extensions docx a.adoc  # output DOCX (native OOXML)
$ metanorma --type iso --extensions html a.adoc  # output just HTML
$ metanorma --type iso --extensions doc a.adoc   # output just DOC (MHT)
$ metanorma --type iso --extensions xml a.adoc   # output ISO XML

To specify output formats in an AsciiDoc document, use the :mn-output-extensions: attribute:

:mn-output-extensions: xml,html,docx,pdf

DOCX template selection

The DOCX output supports two ISO Word templates, controlled by the :iso-word-template: attribute:

DIS

:iso-word-template: dis — DIS/FDIS template (461 styles, for stages 40–60 and 90)

Simple

:iso-word-template: simple — Simple template (72 styles, for stages 00–30)

If not set, the template is auto-detected from the document stage. Both templates are bundled in data/iso-dis/ and data/iso-simple/.

The gem translates the document into ISO XML format, and then validates its output against the ISO 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, DOC, and DOCX.

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-iso
$ gem install metanorma-cli

The metanorma-cli gem is the command-line interface for the Metanorma tool suite (incorporating the metanorma executable seen above).

Documentation

Examples

Notes

Metanorma-ISO was formerly published as asciidoctor-iso.