metanorma/metanorma-gb

View on GitHub
README.adoc

Summary

Maintainability
Test Coverage
= metanorma-gb: Authoring Chinese standards (GuoBiao, sector...) in AsciiDoc

image:https://img.shields.io/gem/v/metanorma-gb.svg["Gem Version", link="https://rubygems.org/gems/metanorma-gb"]
image:https://github.com/metanorma/metanorma-gb/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-gb/actions?workflow=rake"]
image:https://codeclimate.com/github/metanorma/metanorma-gb/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-gb"]
image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-gb.svg["Pull Requests", link="https://github.com/metanorma/metanorma-gb/pulls"]
image:https://img.shields.io/github/commits-since/metanorma/metanorma-gb/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-gb/releases"]

THIS GEM IS FROZEN AND WILL NO LONGER BE ACTIVELY MAINTAINED

== Functionality

This gem processes https://www.metanorma.com[Metanorma documents] following
the Metanorma model for generating https://en.wikipedia.org/wiki/Guobiao_standards[Guobiao standards]
(Chinese national standards).

This gem implements the https://github.com/metanorma/metanorma-model-gb[GbDoc] data model,
which inherits from
https://github.com/metanorma/metanorma-model-standoc[StandardDocument document model].

The code of this gem inherits from
https://github.com/metanorma/metanorma-iso[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
https://github.com/metanorma/metanorma-iso/wiki/Guidance-for-authoring[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.
** http://asciimath.org[AsciiMathML] is to be used for mathematical formatting.
The gem uses the https://github.com/asciidoctor/asciimath[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:

[source,console]
----
$ 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:

[source,console]
----
$ 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:

[source,console]
----
$ bash <(curl -s https://raw.githubusercontent.com/metanorma/metanorma-macos-setup/master/metanorma-setup)
$ gem install metanorma-gb
----


== Documentation

See https://www.metanorma.com/author/gb/[Author Chinese Guobiao standards using Metanorma].

== Examples

* Example documents are avalable at the https://github.com/metanorma/mn-samples-gb[mn-samples-gb] repository.

////
* Document templates are available at the https://github.com/metanorma/mn-templates-itu[mn-templates-itu] repository.
////