Gem Version Build Status (macOS) Build Status (ubuntu) Build Status (Windows) Code Climate Pull Requests Commits since latest

Functionality

This gem generates Guobiao standards (Chinese national standards), using AsciiDoc.

This gem implements the GbDoc data model, which inherits from StandardDocument document model.

The code of this gem inherits from metanorma-iso, a gem used to generate ISO standards using Asciidoc.

The two standards formats are closely aligned. Refer to the ISO gem for guidance, including IsoDoc: Guidance for authoring

The gem can also be used to generate Chinese local or sector standards, which have the same format; the gem formats the title page to have the correct metadata displayed.

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 GB International Standards.

  • The XML representation is processed in turn to generate the following outputs as end deliverable GB standard drafts.

    • HTML

    • Word

The Word output of the gem is strictly aligned to the GB/T 1.1 specification, including the fonts and font sizes prescribed, and the measurements for element positioning on the page.

Usage

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

$ metanorma --type gb a.adoc                   # output HTML and DOC
$ metanorma --type gb --extensions html a.adoc # output just HTML
$ metanorma --type gb --extensions doc a.adoc  # output just DOC
$ metanorma --type gb --extensions xml a.adoc  # output GB XML

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

The gem can also be invoked directly within asciidoctor, though this is deprecated:

$ asciidoctor -b gb -r 'metanorma-gb' a.adoc

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-gb

Examples

  • Example documents are avalable at the mn-samples-gb repository.