Using the Metanorma CLI

Usage sample

$ metanorma --type iso -x html iso-my-standard-document.adoc

Full syntax & options

$ metanorma --type <chosen-type> \
  [--format input-format] \
  [--extensions EXT1,EXT2...] \
  iso-my-standard-document.adoc
type

(mandatory, specified via --type or -t) takes one of the following types: rfc2, rfc3, iso, gb, csd, csand, m3d, rsd. Each of these corresponds to a standards class and a Metanorma gem; the list of standards classes supported by the script by default will grow (see also require).

extension

(optional) specifies the output formats to be generated. If not specified, all possible output formats are generated. The output formats generated are constrained by what has been defined for each standard type. All standards can generate Metanorma XML (xml), and at least one of HTML (html), DOC (doc), PDF (pdf). Some standards generate alternative HTML renderings (e.g. html_alt for ISO).

wrapper

create a separate folder for each instance of HTML output generated; the folder is named the same as the output file, without the .html suffix. Used to make distribution of HTML outputs more straightforward.

format

(optional, defaults to asciidoc, specified via --format or -f) only accepts asciidoc for now

require

If you wish to use metanorma with a document class which has not been included in the types recognised by the metanorma script, you will need to name the corresponding Metnorma gem explicitly with the -r option. For example:

$ metanorma -t mpfd mpfd-bpn.adoc

[metanorma] Error: mpfd is not a supported standard type.

$ metanorma -t mpfd -r metanorma-mpfd mpfd-bpn.adoc

Command-line help

$ metanorma -h
Usage: metanorma [options] <file>
  -t, --type TYPE                       Type of standard to generate: rfc2, rfc3, iso, gb, csd, csand, m3d
  -x, --extensions EXT1,EXT2,... | all  Type of extension to generate per type:
  {
    :rfc2=>{:xmlrfc=>"v2.xml"},
    :rfc3=>{:xmlrfc=>"v3.xml"},
    :iso=>{:html=>"html", :html_alt=>"alt.html", :doc=>"doc"},
    :gb=>{:html=>"html", :doc=>"doc"},
    :csd=>{:html=>"html", :pdf=>"pdf"},
    :csand=>{:html=>"html"},
    :m3d=>{:html=>"html", :doc=>"doc"},
    :rsd=>{:html=>"html"}
  }
  In addition, xml (outside of rfc2, rfc3) generates IsoDoc XML. If the argument is "all" or the option is
  missing, all available extensions are generated.
  -f, --format FORMAT              Format of source file: asciidoc (current default, only format supported)
  -r, --require LIBRARY            Require LIBRARY prior to execution
  -w, --wrapper                    Create wrapper folder for HTML output
  -h, --help                       Show this message