AsciiISO syntax reference

AsciiISO syntax reference

AsciiISO is syntax based on AsciiDoc, with some extensions specific to authoring ISO documents.

ISO specific syntax

Tip
Full details of Asciidoctor-ISO–specific markup and conventions is given in the Asciidoctor-ISO Readme and the Guidance for authoring.

The sections that have a fixed position according to ISO/IEC DIR 2 (Introduction, Scope, Normative References, Terms and Definitions, Symbols and Abbreviations, Bibliography) need to be titled as such, as first-level headings.

AsciiDoc syntax supported

The Rice document illustrates almost the full range of formatting available via Asciidoctor; Annex E (which is not in the original) illustrates features not demonstrated in the original document.

Syntax includes the following; the links are to the Asciidoctor User Manual. All examples are taken from the Metanorma Asciidoctor Rice document.

Document header

Attributes of the document, which typically appear in the coverpage (if at all), rather than in the document proper. The permitted attributes for all Metanorma documents, and their expected values, are documented in the metanorma-standoc Readme; each standards-specific gem adds documentation of its own specific attributes (e.g. https://github.com/riboseinc/metanorma-iso#document-attributes).

Note that the initial title line and author line expected in Asciidoctor are ignored in favour of specific document attributes, although they still need to be supplied for the document to be valid.

= Rice model
Author
:docnumber: 17301
:revdate: 2010-01-02
:title:  Cereals and pulses -- Specifications and test methods -- Rice
:language: en
:status: published

...

Inline formatting

This document specifies minimum requirements and test methods for rice (_Oryza sativa L._).
  • Anchors (for internal cross-references): these can be defined for any section or subsection, and any block (e.g. images, lists, examples, formulas, and so forth). The numbering of all blocks and clauses is automated, and does not need to be provided in the text.

  • Internal Cross-references reference anchors within the document. By default, the text for these is also automatically generated, including naming the container of a block where required (e.g. B.6, Formula (B.1) for a formula in an annex). However, cross-references can supply their own text as an override, following a comma (e.g. <<AnnexB,the following annex>>).

The International Organization for Standardization (ISO) draws attention to the fact that it is claimed that compliance with this document may involve the use of a patent concerning sample dividers given in <<AnnexA>> and shown in <<figureA-1>>.

...
[[figureA-1]]
.Split-it-right sample divider
image::images/rice_image1.png[]
http://www.iso.org/obp[OBP]
  • STEM support (mathematical expressions), as both inline and block formatting. (Numbered formulae are expressed as stem blocks.) Asciidoctor natively uses AsciiMath for its mathematical expressions; the :stem: document attribute must be present for AsciiMath to be recognised. The gem will ensure that any AsciiMath is rendered in the HTML output, and converted to Microsoft Office’s OOXML (via MathML) in the Word output. Asciidoctor also supports LaTeX, but the gem does not cater for converting LaTeX to a Word-compatible output.

[[formulaA-1,A.1]]
[stem]
++++
w = (m_D) / (m_s)
++++

where

stem:[w]:: is the mass fraction of grains with a particular defect in the test sample;
  • Footnotes. Note that footnotes are treated as inline formatting, so they cannot straightforwardly span more than a single paragraph in Asciidoctor. Footnotes within figures and tables are rendered within their blocks.

containing a mass fraction of 4,1 % iodine and 6,3 % potassium iodide in deionized water such as Lugols.footnote:[Lugols is an example of a suitable product available commercially. This information is given for the convenience of users of this document and does not constitute an endorsement by ISO of this product.]

Blocks

Blocks are groupings of paragraphs and text into larger units, commonly delimited, and optionally including a title and metadata.

Tip
For UNECE, paragraph numbering is generated automatically by the gem, which treats each paragraph as a leaf-node section. Paragraph numbers must not be entered in the Asciidoctor source.
The main changes compared to the previous edition are:

* updated normative references;
* deletion of 4.3.
  • Ordered lists. The gem automatically creates labels for the nested levels of ordered lists (in the sequence lowercase letter–Arabic numeral–lowercase Roman numeral–upppercase letter–uppercase Roman numeral), and ignores any numbering styles indicated by the user.

. the sampling method used;
. the test method used;
. the test result(s) obtained or, if the repeatability has been checked, the final quoted result obtained;
  • Definition lists. These are used for all keys of figures and formulae, and as the content of Symbols and Abbreviations clauses and subclauses:

stem:[w]:: is the mass fraction of grains with a particular defect in the test sample;
stem:[m_D]:: is the mass, in grams, of grains with that defect;
stem:[m_S]:: is the mass, in grams, of the test sample.

Note that the key to a figure must be preceded by the paragraph Key, and the key to a formula must be preceded by the paragraph where.

  • Tables. Asciidoctor supports a rich range of table formatting:

[[tableD-1]]
[cols="<,^,^,^,^",headerrows=2]
.Repeatability and reproducibility of husked rice yield
|===
.2+| Description 4+| Rice sample
| Arborio | Drago footnote:[Parboiled rice.] | Balilla | Thaibonnet

| Number of laboratories retained after eliminating outliers | 13 | 11 | 13 | 13
| Mean value, g/100 g | 81,2 | 82,0 | 81,8 | 77,7
|===
  • Images, which are mapped to Metanorma figures, with accompanying titles:

[[figureC-1]]
.Typical gelatinization curve
image::images/rice_image2.png[]
footnote:[The time stem:[t_90] was estimated to be 18,2 min for this example.]
  • Admonitions, which express Notes, Warnings, Cautions, etc.

CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
Tip
For UNECE, admonitions are used to render boxes. Admonitions can have titles.
[quote, ISO, "ISO7301,clause 1"]
_____
This International Standard gives the minimum specifications for rice (_Oryza sativa_ L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).
_____
.Sample Code
====

[source,ruby]
--
puts "Hello, world."
%w{a b c}.each do |x| (1)
  puts x
end
--
<1> This is an annotation
====
  • Comments (which are not rendered in the output)

// all terms and defs references are dated

Sections

  • The Asciidoctor Document preamble is treated as the document Foreword: it is the text appearing between the document header and the first section header. (Note that the foreword is here given a block title, but that will be provided automatically anyway.)

[[foreword]]
.Foreword
ISO (the International Organization for Standardization)
  • The Asciidoctor Sections correspond to Metanorma clauses, starting with the Introduction (if present). Each section and subsection is delimited with a header; the number of equal signs before the header indicate the level of nesting of the section, starting with two equal signs. No numbering should be given for any header: numbering is done automatically by the gem.

== Sampling
Sampling shall be carried out in accordance with <<ISO24333,clause 5>>

== Test methods

Section styles are used to indicate specific types of section: [abstract] for Abstracts, [bibliography] for Normative References and Bibliography, [appendix] for Annexes, and [%appendix] for Appendixes (annexes of annexes). These styles must be provided for the sections to be processed correctly: bibliographic references will not be recognised as such, for example, without the [bibliography] style applied:

[bibliography]
== Bibliography

* [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_

Sections whose position is set by the standard (e.g., for ISO, Introduction, Scope, Normative References, Terms and Definitions, Symbols and Abbreviations, Bibliography; this also applies to Abstracts) need to be titled as such, as first-level headings.

Tip
Abstracts are not rendered in ISO and GB standards, but they are still incorporated into the document metadata (bibdata) at the start of the Metanorma XML generated.

Terms and Definitions

Terms and Definitions sections follow a strict grammar in their Metanorma-ISO markup, as ISO/IEC DIR 2 prescribes their structure so strictly. The following illustrates the complete structure of a term entry; the Rice document splits up these features among several terms.

[[paddy]]
=== paddy
alt:[paddy rice]
alt:[rough rice]
deprecated:[cargo rice]
domain:[rice]

rice retaining its husk after threshing

[example]
Foreign seeds, husks, bran, sand, dust.

NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.

[.source]
<<ISO7301,section 3.2>>, The term "cargo rice" is shown as deprecated,
and Note 1 to entry is not included here

Term banks such as the IEV must be treated like any other document, with terms treated as clauses; e.g. clause "103-01-01". The IEV must be explictly referenced with that label; when the XML is generated, it will be replaced by the official references to IEC 60050-nnn:2001 standards documents.

Exceptionally, an introductory section can be treated as a subclause instead of a term, by prefixing it with the style attribute [.nonterm].

References (Normative, Informative)

All bibliographic entries must be given as unordered lists. Normative references are expected to include only ISO and related standards; informative references may include any source.

For ISO and related standards, the reference is given as a bibliographic anchor (in triple brackets), consisting of an internal identifier followed by the ISO identifier. The internal identifier can be used in cross-references (citations). The date may be added to the ISO identifier, as required by ISO/IEC DIR 2; standards under preparation have their date given as --, and should be accompanied by a footnote detailing the status of the standard.

Grade 3 quality as specified in <<ISO3696>>.

...

* [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
* [[[ISO7301,ISO 7301:2011]]], _Rice -- Specification_
* [[[ISO16634,ISO 16634:--]]] footnote:[Under preparation. (Stage at the time of publication ISO/DIS 16634)], _Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs -- Determination of the total nitrogen content by combustion according to the Dumas principle and calculation of the crude protein content_

Non-ISO references under normative references are still cited by document identifier. Under informative references, non-ISO documents are both displayed and cited with reference numbers in brackets. In Metanorma-ISO, the cross-reference is a normal anchor identifier; the bracket numbering for informative references is automatic.

For details concerning the use of the Dumas method, see References <<ref10>> and <<ref16>>.

...

* [[[ref10,10]]] [smallcap]#Standard No I.C.C 167#. _Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method_ (see http://www.icc.or.at)

* [[[ref16,16]]] [smallcap]#Tkachuk R.# Nitrogen-to-protein conversion factors for cereals and oilseed meals. _Cereal Chem._ 1969, *46* (4) pp 419-423

In cross-references, bibliographic localities (e.g. page numbers, clause numbers) can be added directly after the comma, as part of the cross-reference text. Bibliographic localities are expressed as a sequence of lowercase locality type, then an equal sign, then by the locality number or range:

<<ISO7301,clause=3.1>>

NOTE: This table is based on <<ISO7301,table=1>>.

Sampling shall be carried out in accordance with <<ISO24333,clause=5>>

ISO clause references in particular will suppress the word "Clause" before a subclause reference, following ISO/IEC DIR 2: <<ISO24333,clause=5>> will be rendered as ISO 24333, Clause 5, but <<ISO7301,clause=3.1>> will be rendered as ISO 7301, 3.1.

Annexes

For ISO standards, annexes are treated as normative by default; if they are informative, they must additionally be tagged with an obligation of "informative" (so [appendix, obligation=informative]).

The numbering of annexes and appendices is automatic: do not insert "Annex A" or "Appendix 1" as part of the title.