metanorma-iso 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,29 @@
1
1
  = Guidance for Authoring
2
- The Asciidoc approach to authoring ISO standards (and other related standards under Metanorma) is not https://en.wikipedia.org/wiki/WYSIWYG[WYSIWYG]: you are dealing with a text editor and a console rather than a Word document, and you are authoring something that looks more like HTML than the final product. On the other hand, editing documents with a markup system like Asciidoc makes it much easier to automate key validation and formatting processes, such as checking for missing document components, autonumbering, and generating output in multiple formats.
3
2
 
4
- The documents you will be authoring will be in the http://asciidoctor.org[Asciidoc] formatting language, so you need to be familiar with that language's markup conventions: the http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] will be your companion (supplemented by the https://github.com/riboseinc/metanorma-iso#asciidoctor-model-additions[additions to markup made for ISO standards]. However we have tried to make things easier for you by preparing an https://github.com/riboseinc/metanorma-iso/blob/master/spec/examples/rice.adoc[AsciiDoc version] of the ISO Standard exemplar, the https://www.iso.org/publication/PUB100407.html["Rice document"]. If you use this document as a template for your own ISO standard document, you will find most of the formatting you need illustrated there.
3
+ TIP: This guide has been authored for ISO standards, but most of it applies to all Metanorma standards. We indicate where guidance differs for different standards classes.
5
4
 
6
- == Usage
5
+ The Asciidoctor approach to authoring ISO standards (and other related standards under Metanorma) is not https://en.wikipedia.org/wiki/WYSIWYG[WYSIWYG]: you are dealing with a text editor and a console rather than a Word document, and you are authoring something that looks more like HTML than the final product. On the other hand, editing documents with a markup system like Asciidoctor makes it much easier to automate key validation and formatting processes, such as checking for missing document components, autonumbering, and generating output in multiple formats.
7
6
 
8
- See the README on https://github.com/riboseinc/metanorma-iso#usage[how to deploy and use the gem].
7
+ The documents you will be authoring will be in the http://asciidoctor.org[Asciidoc] formatting language, so you need to be familiar with that language's markup conventions.
8
+
9
+ * http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] will be your companion.
10
+ * https://www.metanorma.com/software/metanorma-iso/docs/asciiiso-syntax/[AsciiISO syntax] provides a quick reference for both standard Asciidoctor markup and custom ISO-related features.
11
+ * See also https://github.com/riboseinc/metanorma-iso#asciidoctor-model-additions[Additions to markup made for ISO standards] in README Metanorma-ISO.
12
+
13
+ We have tried to make things easier for you by preparing an https://github.com/riboseinc/metanorma-iso/blob/master/spec/examples/rice.adoc[AsciiDoc version] of the ISO Standard exemplar, the https://www.iso.org/publication/PUB100407.html["Rice document"].
14
+ If you use this document as a template for your own ISO standard document, you will find most of the formatting you need illustrated there.
9
15
 
10
16
  == Output in different languages
11
17
 
12
- The gem allows generation of standards in different languages; the language of the document is specified in the `:language:` document attribute (and `:script:`, for languages with more than one script).
18
+ Metanorma allows generation of standards in different languages; the language of the document is specified in the `:language:` document attribute (and `:script:`, for languages with more than one script).
13
19
 
14
- For each language, language-specific templated text is specified for the boilerplate, labels and cross-references that are included in document output. The gem has predefined templates for English, Chinese (Simplified) and French. You can specify your own language by providing your own http://www.yaml.org/spec/1.2/spec.html[YAML] template file, and linking to it with the `:i18nyaml` document attribute. The YAML template you provide needs to match https://github.com/riboseinc/isodoc/blob/master/lib/isodoc/i18n-en.yaml, substituting translations for each of the fields given.
20
+ For each language, language-specific templated text is specified for the boilerplate, labels and cross-references that are included in document output. Metanorma has predefined templates for English, Chinese (Simplified) and French. You can specify your own language by providing your own http://www.yaml.org/spec/1.2/spec.html[YAML] template file, and linking to it with the `:i18nyaml` document attribute. The YAML template you provide needs to match https://github.com/riboseinc/isodoc/blob/master/lib/isodoc/i18n-en.yaml, substituting translations for each of the fields given.
15
21
 
16
22
  The Chinese (Simplified) template also localises punctuation and spacing, mapping them away from the default Latin punctuation used elsewhere in the gem.
17
23
 
18
24
  == Validation
19
25
 
20
- All AsciiISO documents that are processed by the Asciidoctor-ISO gem are validated against a formal schema for the document structure, as well as style rules around content. The gem will generate a sequence of warnings; you should pay attention to them.
26
+ All Metanorma XML documents that are generated by the Metanorma tool are validated against a formal schema for the document structure, as well as style rules around content. The gem will generate a sequence of warnings; you should pay attention to them.
21
27
 
22
28
  The content warnings come first, and are prefixed with `ISO Style`. They try to impose rules on content taken from http://www.iec.ch/members_experts/refdocs/iec/isoiecdir-2%7Bed7.0%7Den.pdf[ISO/IEC DIR 2], including restrictions on where requirements may be stated, usage of decimal points, hanging clauses, and subclauses that are the only child of their parent clause. While the error detection is not infallible, they should be reviewed at least once. Where possible, the gem will give the ID or section heading associated with the error. For example:
23
29
 
@@ -29,7 +35,9 @@ ISO style: invalid technical committee type XYZ
29
35
  ISO style: AnnexA-4-1:Preparation of test sample: subsection is only child
30
36
  --
31
37
 
32
- The syntax errors come afterwards, and they report the line number and line position of the syntax error in the intermediate XML format generated by the gem. (For example, the AsciiDoc document `rice.adoc` generates the intermediate XML file `rice.xml`.) These errors deal with restrictions on what kinds of text can appear where, pointers within the document that are orphaned, and elements that appear in the wrong sequence. Deciphering what has gone wrong with them may take more effort, but the errors they point to are more serious than the style errors, and need to be resolved for the document to be well-formed. The gem will usually (but not always!) generate HTML and Word output despite the presence of those errors.
38
+ TIP: Style rules around content are currently only applied to ISO standards. Within ISO, style rules are currently specific to content in English.
39
+
40
+ The syntax errors come afterwards, and they report the line number and line position of the syntax error in the Metanorma XML document generated by the gem. (For example, the Asciidoctor document `rice.adoc` generates the Metanorma XML file `rice.xml`.) These errors deal with restrictions on what kinds of text can appear where, pointers within the document that are orphaned, and elements that appear in the wrong sequence. Deciphering what has gone wrong with them may take more effort, but the errors they point to are more serious than the style errors, and need to be resolved for the document to be well-formed. The gem will usually (but not always!) generate HTML and Word output despite the presence of those errors.
33
41
 
34
42
  For example:
35
43
 
@@ -44,25 +52,29 @@ IDREF "last_conformance_class" without matching ID @ 649:236
44
52
  IDREF "Annex-A" without matching ID @ 308:141
45
53
  --
46
54
 
47
- Currently validation only processes English-language text for language-specific rules (e.g. requirements); French validation is planned.
48
-
49
- The gem also validates terms cited from the IEV against the online IEV Electropedia entries: if the preferred term does not match the form given in the IEV for that entry, it will issue a warning.
55
+ The tool also validates terms cited from the Internatinal Electrotechnical Vocabulary (IEV) against the online http://www.electropedia.org[IEV Electropedia] entries: if the preferred term does not match the form given in the IEV for that entry, it will issue a warning.
50
56
 
51
57
  == Document header
52
58
 
53
- The core metadata about the standard comes from the Asciidoc document header (the list of colon-delimited attributes at the start of the document), and the https://github.com/riboseinc/metanorma-iso#document-attributes[README documents what those fields should be]. Use the Rice document as a template, and be careful about sticking to the guidelines on populating them.
59
+ The core metadata about the standard comes from the Asciidoctor document header (the list of colon-delimited attributes at the start of the document). The https://github.com/riboseinc/metanorma-standoc#document-attributes[metanorma-standoc README] and the README of each standard-specific gem documents what those fields should be. Use the Rice document as a template, and be careful about sticking to the guidelines on populating them.
54
60
 
55
- The Rice document contains some additional fields that are not essential to ISO rendering, and help Asciidoctor preview the document with its native renderer, should you so choose. (For example, `:appendix-caption: Annex` ensures that the native Asciidoctor renderer calls appendices Annexes; but the Word and HTML output of the gem will do so regardless of how this value is populated.) You will need to leave the `:stem:` field in if you have any AsciiMath or MathML to include in the document; otherwise they will not be detected.
61
+ You will need to use the `:stem:` document attribute in if you have any AsciiMath or MathML to include in the document; otherwise they will not be detected.
56
62
 
57
- The document header, unlike the document proper, cannot deal with HTML entities. If you need to enter accented characters for the French title, or dashes for compound titles, you will need to enter them directly as Unicode (even if your console text editor doesn't like it): `:title-main-fr: Spécification et méthodes d'essai`, not `:title-main-fr: Sp\écification et m\éthodes d'essai`; `:title-part-en:Information Technology—Security`, not `:title-part-en:Information Technology\—Security`.
63
+ The document header, unlike the document proper, cannot deal with HTML entities. If you need to enter non-Ascii characters for a title, or dashes for compound titles, you will need to enter them directly as Unicode (even if your console text editor doesn't like it): e.g. `:title-main-fr: Spécification et méthodes d'essai`, not `:title-main-fr: Sp\écification et m\éthodes d'essai`; `:title-part-en:Information Technology—Security`, not `:title-part-en:Information Technology\—Security`.
58
64
 
59
65
  == Document sections
60
66
 
61
- Sections are marked off in Asciidoc with titles prefixed by double equal signs, `==`. The gem depends on the titles given to identify the different kinds of sections in the document. As a result, you cannot choose to modify the titles of sections; the `Introduction`, `Scope`, `Normative References`, `Terms and Definitions`, `Symbols and Abbreviations`, and `Bibliography` need to be titled as such.
67
+ Sections are marked off in Asciidoc with titles prefixed by double equal signs, `==`. The gem depends on the titles given to identify the different kinds of sections in the document. As a result, you cannot choose to modify the titles of sections; the `Abstract`, `Introduction`, `Scope`, `Normative References`, `Terms and Definitions`, `Symbols and Abbreviations`, and `Bibliography` need to be titled as such. As an alternative (if the document deviates from that naming structure, or is in a language other than English), the section can be prefixed with a `heading=` attribute, giving the English canonical form of the section name.
68
+
69
+ [source,asciidoc]
70
+ --
71
+ == Normative References
62
72
 
63
- The Foreword of an ISO standard is detected as any text between the document header and the first section header (the document preamble). The Rice document gives the `.Foreword` title to the preamble, but the gem will supply the "Foreword" title regardless of what title is present.
73
+ [heading=terms and definitions]
74
+ == Terms, definitions and abbreviations
75
+ --
64
76
 
65
- In the Rice document, Asciidoctor section numbering is disabled for the Foreword and Introduction, and reenabled for the Scope. Again, the gem will number those sections correctly whatever the markup.
77
+ The Foreword of a standard is detected as any text between the document header and the first section header (the "document preamble" in Asciidoctor). The Rice document gives the `.Foreword` title to the preamble, but the gem will supply the "Foreword" title regardless of what title is present.
66
78
 
67
79
 
68
80
  === Bibliographies
@@ -71,11 +83,11 @@ The Normative References and the Bibliography must be preceded by the style attr
71
83
 
72
84
  All bibliographic entries must be given as unordered lists.
73
85
 
74
- Currently the gem only supports formatted citations, which are given as such in the Asciidoc source. In the future, we expect to integrate the documents with http://www.bibtex.org[BibTex] databases, through the https://github.com/riboseinc/asciidoctor-bibliography[asciidoctor-bibliography] gem.
86
+ Currently the gem only supports formatted citations, which are given as such in the Asciidoc source. In the future, we expect to integrate the documents with rendering of Relaton-model bibliographies.
75
87
 
76
- ==== ISO References
88
+ ==== References to standards
77
89
 
78
- For ISO and related standards, the entry must be preceded by a bibliographic anchor, in triple brackets: this consists of an internal identifier (used in citations), followed by the ISO identifier for the reference as its label. For example:
90
+ For references to standards with a document identifier, the entry must be preceded by a bibliographic anchor, in triple brackets: this consists of an arbitrary internal identifier (used in citations), followed by the canonical document identifier for the reference as its label. All references under Normative References are expected to have such an identifier. For example:
79
91
 
80
92
  [source,asciidoc]
81
93
  --
@@ -84,8 +96,10 @@ For ISO and related standards, the entry must be preceded by a bibliographic anc
84
96
  --
85
97
 
86
98
  [subs="quotes"]
87
- ISO 6646 is cited from elsewhere in the document through crossreferences to the `ricepotentialmilling` identifier; e.g. `<< ricepotentialmilling>>` (which will be rendered as `ISO 6646`), `<<``ricepotentialmilling, section 5``>>` (which will be rendered as `ISO 6646, Section 5`), `<<``ricepotentialmilling,section 5: the foregoing discussion``>>` (which will be tagged in the XML representation as Section 5 of ISO 6646, but will be displayed as `the foregoing discussion`.)
99
+ ISO 6646 in this example would be cited from elsewhere in the document through crossreferences to the `ricepotentialmilling` identifier; e.g. `<< ricepotentialmilling>>` (which will be rendered as `ISO 6646`), `<<``ricepotentialmilling, section 5``>>` (which will be rendered as `ISO 6646, Section 5`), `<<``ricepotentialmilling,section 5: the foregoing discussion``>>` (which will be tagged in the XML representation as Section 5 of ISO 6646, but will be displayed as `the foregoing discussion`.)
88
100
 
101
+ TIP
102
+ ----
89
103
  If an ISO reference is in preparation, ISO/IEC DIR 2 dictates that details of the reference status be given as a footnote. In Asciidoc, this is done by giving the date as a double dash, and following the bibliographic anchor with a footnote macro:
90
104
 
91
105
  [source,asciidoc]
@@ -99,9 +113,9 @@ If an ISO reference includes all parts of the standard, that is indicated by app
99
113
  --
100
114
  * [[[ISO16634,ISO 16634 (all parts)]]] _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_
101
115
  --
116
+ ----
102
117
 
103
-
104
- In informative references, ISO references are still given with the same format of bibliographic anchor, and they are cited by ISO document code -- although they are displayed with an incrementing reference number in brackets instead. So
118
+ In informative references, references to standards documents are still given with the same format of bibliographic anchor, and they are cited by their document identifier -- although they are displayed with an incrementing reference number in brackets, for consistency with any bibliographic entries that are not standards documents. (This convention is taken from ISO.) So
105
119
 
106
120
  [source,asciidoc]
107
121
  --
@@ -109,6 +123,8 @@ In informative references, ISO references are still given with the same format o
109
123
  == Bibliography
110
124
 
111
125
  * [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
126
+ ...
127
+ * [[[ref11,11]]] Nitrogen-ammonia-protein modified Kjeldahl method -- Titanium oxide and copper sulfate catalyst. _Official Methods and Recommended Practices of the AOCS_ (ed. Firestone, D.E.), AOCS Official Method Ba Ai 4-91, 1997, AOCS Press, Champaign, IL
112
128
  --
113
129
 
114
130
  is displayed as:
@@ -118,36 +134,21 @@ ____
118
134
  *Bibliography*
119
135
 
120
136
  [1] ISO 3696, _Water for analytical laboratory use -- Specification and test methods_
137
+ ...
138
+ [11] Nitrogen-ammonia-protein modified Kjeldahl method -- Titanium oxide and copper sulfate catalyst. _Official Methods and Recommended Practices of the AOCS_ (ed. Firestone, D.E.), AOCS Official Method Ba Ai 4-91, 1997, AOCS Press, Champaign, IL
121
139
  ____
122
140
 
123
- ==== ISO Reference Fetching
124
-
125
- If any bibliographic entry has a label prefixed with `ISO`, e.g. `[[` `[ricepotentialmilling,ISO 6646]` `]]`, the gem accesses the ISO website (via the `isobib` stem), and screenscrapes the details of that item. The screenscraped data overrides any content about the item provided in the document, since the ISO website is treated as the bibliographic source of truth on ISO documents.
141
+ The bracketed reference numbers are expected to be correct and in order: they are not overriden in rendering.
126
142
 
127
- ==== Non-ISO References
143
+ ==== Relaton Reference Fetching
128
144
 
129
- In normative references, non-ISO documents must still be given a document code (or title) in their bibliographic anchor:
130
-
131
- [source,asciidoc]
132
- --
133
- * [[[RFC4291,IETC RFC 4193]]] _Unique Local IPc6 Unicast Addresses_, October 2005. http://www.ietf.org/rfc/rfc4291.txt
134
- * [[IANAMediaTypes,IANA Media Types Assignment]]], March 2017. http://www.iana.org/assignments/media-types/media-types.xthml
135
- --
136
-
137
- In informative references, non-ISO documents are both displayed and cited with reference numbers in brackets. Those numbers are given in the reference anchor instead of the ISO document code. ISO references appear before non-ISO references; the reference number is expected to be correct in context:
138
-
139
- [source,asciidoc]
140
- --
141
- * [[[IEC61010-2,IEC 61010-2:1998]]], _Safety requirements for electric equipment for measurement, control, and laboratory use -- Part 2: Particular requirements for laboratory equipment for the heating of material_
142
-
143
- * [[[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)
144
- --
145
+ The https://github.com/riboseinc/relaton[`relaton`] can fetch bibliographic entries for any standards known to have online bibliographic databases (ISO, IEC, IETF, GB). Any bibliographic entry recognised through its document identifier prefix will by default have its bibliographic entry fetched by that gem. The fetched data overrides any content about the item provided in the document, since the online bibliography is treated as the source of truth for that standards document.
145
146
 
146
147
  ==== Cross-References
147
148
 
148
149
  Normally in Asciidoctor, any text in a cross-reference that follows a comma constitutes custom text for the cross-reference. So a cross-reference `<<ISO7301,the foregoing reference>>` will be rendered as "the foregoing reference", and hyperlinked to the ISO7301 reference.
149
150
 
150
- In AsciiISO cross-references, bibliographic localities (e.g. page numbers, clause numbers) can be added directly after the comma, as part of the cross-reference text: this overrides the normal Asciidoctor treatment of custom text. Bibliographic localities are expressed as a sequence of lowercase locality type, then an equal sign, then the locality value or range of values. The locality can appear in quotations, if it contains special characters (like dashes or commas).
151
+ In Metanorma Asciidoctor cross-references, bibliographic localities (e.g. page numbers, clause numbers) can be added directly after the comma, as part of the cross-reference text: this overrides the normal Asciidoctor treatment of custom text. Bibliographic localities are expressed as a sequence of lowercase locality type, then an equal sign, then the locality value or range of values. The locality can appear in quotations, if it contains special characters (like dashes or commas).
151
152
 
152
153
  [source,asciidoctor]
153
154
  --
@@ -160,18 +161,20 @@ Sampling shall be carried out in accordance with <<xxx,section="5-3-1,bis">>
160
161
 
161
162
  Any text after the bibliographic localities is still treated as custom cross-reference text; e.g. `<<ISO7301,clause=5,table=1,the foregoing reference>>`.
162
163
 
163
- Custom cross-references should not be used in ISO standards, either for an external reference, or for a section of the current document: ISO/IEC DIR 2 requires any cross-references to be transparent in text. For example, a cross-reference to the anchor `[[tabular]]` on clause 5 should be given as just `<<tabular>>`, without any custom text: it will be automatically rendered as `Clause 5` by the gem.
164
+ TIP: Custom cross-references should not be used in ISO standards, either for an external reference, or for a section of the current document: ISO/IEC DIR 2 requires any cross-references to be transparent in text. For example, a cross-reference to the anchor `[[tabular]]` on clause 5 should be given as just `<<tabular>>`, without any custom text: it will be automatically rendered as `Clause 5` by the gem.
164
165
 
165
- 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_.
166
+ TIP: 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_.
166
167
 
167
168
 
168
169
  === Terms and Definitions
169
170
 
171
+ // TODO: This paragraph will be removed when https://github.com/riboseinc/metanorma-iso/issues/222 is implemented
172
+
170
173
  The title of a top-level Terms and Definitions clause is populated automatically, overriding the title provided by the user: if it contains a Symbols and Abbreviated Terms subclause, it is titled _Terms, definitions, symbols and abbreviated terms_, otherwise it is titled _Terms and definitions_. A Terms and Definitions clause will be recognised if either title is given, regardless of case. Symbols and Abbreviated Terms subclauses are also automatically titled; other subclauses of Terms and Definitions clauses are not.
171
174
 
172
- If the Terms and Definitions are partly or fully sourced from another standard, that document is named as a `[source=REFERENCE]` attribute to the section. (The attribute needs to be applied to the top-level clause, if there are subclauses.) If there are no terms and definitions defined in this standard, no terms should be included in the section body (it should be blank). The boilerplate at the start of the section is adjusted to reflect both possibilities; any paragraphs or lists in the Asciidoctor input (which can replicate the expected boilerplate) is stripped in the intermediate XML format.
175
+ If the Terms and Definitions are partly or fully sourced from another standard, that document is named as a `[source=REFERENCE]` attribute to the section. (The attribute needs to be applied to the top-level clause, if there are subclauses.) If there are no terms and definitions defined in this standards document, no terms should be included in the section body (it should be blank). The boilerplate at the start of the section is adjusted to reflect both possibilities; any paragraphs or lists in the Asciidoctor input (which can replicate the expected boilerplate) is stripped in the intermediate XML format.
173
176
 
174
- Terms and Definitions sections follow a strict grammar, which is reflected in their Asciidoc markup:
177
+ Terms and Definitions sections follow a strict grammar, which is reflected in their Asciidoctor markup:
175
178
 
176
179
  * The term is given as a subheading at the appropriate level (three equal signs, unless there are subsections in the Terms and Definition section). The term may be crossreferenced from other terms, in which case it should have an anchor.
177
180
  * The term is optionally followed by alternative/admitted terms, which must be marked up in an `+alt:[...]+` macro; deprecated terms, which must be marked up in a `+deprecated:[...]+` macro; and a term domain, which must be marked up in a `+domain:[...]+` macro.
@@ -204,7 +207,7 @@ NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kerne
204
207
  and Note 1 to entry is not included here
205
208
  --
206
209
 
207
- The requirement that the source of a term be given in a citation also applies when the source is a term bank, such as http://www.electropedia.org[IEV]. Formally, IEV references should be cited as `IEC 60050-nnn:20xx`, where `n` is the top-level clause, and `20xx` is the year when that particular specification was published; e.g. `IEC 60050-113:2011, 113-01-07`. For convenience, this gem requires all Electropedia references to be to a single reference, named `IEV` in the normative references. In rendering the Asciidoctor into ISO XML, this reference will be replaced by the various required IEC 60050-nnn:20xx references. (That means that you should not insert your own instances of Electropedia references with id `IEC 60050-nnn`: they will be duplicated by the automatically generated references.)
210
+ The requirement that the source of a term be given in a citation also applies when the source is a term bank, such as the http://www.electropedia.org[International Electrotechnical Vocabulary (IEV)]. Formally, IEV references should be cited as `IEC 60050-nnn:20xx`, where `n` is the top-level clause, and `20xx` is the year when that particular specification was published; e.g. `IEC 60050-113:2011, 113-01-07`. For convenience, this gem requires all IEV references to be to a single reference, named `IEV` in the normative references. In rendering the Asciidoctor into Metanorma XML, this reference will be replaced by the various required IEC 60050-nnn:20xx references. (That means that you should not insert your own instances of IEC 60050 references for IEV citations: they will be duplicated by the automatically generated references.)
208
211
 
209
212
  [source,asciidoc]
210
213
  --
@@ -220,7 +223,7 @@ The requirement that the source of a term be given in a citation also applies wh
220
223
 
221
224
  Note that, for IEV entries to be validated, the IEV reference must be given as a Clause, and in quotes (otherwise the locality syntax would be interpreted as a range); so `<<ievtermbank,clause="103-01-02">>` for IEV 103-01-02.
222
225
 
223
- Asciidoc does not permit macros to be nested inside other macros; so the following markup, introducing a stem expression as an admitted term, is illegal. (The use of stem expressions as preferred terms is not a problem, because the macro appears as a header.)
226
+ Asciidoctor does not permit macros to be nested inside other macros; so the following markup, introducing a stem expression as an admitted term, is illegal. (The use of stem expressions as preferred terms is not a problem, because the macro appears as a header.)
224
227
 
225
228
  [source,asciidoc]
226
229
  --
@@ -258,7 +261,7 @@ metrical foot consisting of a short, a long, and a short
258
261
 
259
262
  === Symbols and Abbreviations
260
263
 
261
- Symbols and Abbreviations sections are expected to be simple definition lists (http://asciidoctor.org/docs/user-manual/#labeled-list["labelled lists"] in Asciidoc nomenclature). The gem takes care of sorting the symbols in the order prescribed by ISO/IEC DIR 2, provided the symbols are in AsciiMath; sorting MathML entries is not currently supported.
264
+ Symbols and Abbreviations sections are expected to be simple definition lists (http://asciidoctor.org/docs/user-manual/#labeled-list["labelled lists"] in Asciidoctor nomenclature). The gem takes care of sorting the symbol entries in the order prescribed by ISO/IEC DIR 2, provided the symbols are in AsciiMath; sorting MathML entries is not currently supported.
262
265
 
263
266
  === Clauses
264
267
 
@@ -281,6 +284,7 @@ ____
281
284
  *4.2.1.* The mass fraction of moisture, determined in accordance with...
282
285
  ____
283
286
 
287
+ TIP: This notation should not be used to implement paragraph numbering, as required for UNECE: the UNECE gem automatically treats each paragraph as a distinct clause, and automatically numbers it.
284
288
 
285
289
  Inline subclause headings (e.g. for test methods) are indicated by preceding the heading with the `[%inline-header]` option attribute. So in the Rice Model document,
286
290
 
@@ -299,13 +303,15 @@ ____
299
303
  ____
300
304
 
301
305
 
302
- Normative clauses are indicated with the attribute `[obligation=informative]`; they are normative by default.
306
+ Informative clauses are indicated with the attribute `[obligation=informative]`; clauses are normative by default.
303
307
 
304
308
  === Annexes
305
309
 
306
- All annexes must be preceded by the style attribute `[appendix]`, in order to be recognised correctly. 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]`).
310
+ All annexes must be preceded by the style attribute `[appendix]`, in order to be recognised correctly. Like all clauses, annexes are normative by default, an informative annex is indicated with `[appendix,obligation=informative]`.
307
311
 
308
- Appendixes to annexes can occur, although they are not mentioned in ISO/IEC DIR 2; ISO/IEC DIR 1 features them. They are marked up as immediate subsections of annexes, and must be tagged with an option attribute of "appendix":
312
+ TIP
313
+ ----
314
+ In ISO, Appendixes to annexes can occur, although they are not mentioned in ISO/IEC DIR 2; ISO/IEC DIR 1 features them. They are marked up as immediate subsections of annexes, and must be tagged with an option attribute of "appendix":
309
315
 
310
316
  [source,asciidoc]
311
317
  --
@@ -317,6 +323,7 @@ Text
317
323
  === Appendix 1
318
324
  Text
319
325
  --
326
+ ---
320
327
 
321
328
  The numbering of annexes and appendices is automatic: do not insert "Annex A" or "Appendix 1" as part of the title. Annex and Appendix titles can be left blank, as with Clauses.
322
329
 
@@ -324,7 +331,7 @@ The numbering of annexes and appendices is automatic: do not insert "Annex A" or
324
331
 
325
332
  === Mathematical formatting
326
333
 
327
- Mathematical formatting is done using the `[stem]` macro. Asciidoc supports http://asciimath.org[AsciiMath] and LaTeX natively (AsciiMath by default); as of this writing the gem only supports AsciiMath. AsciiMath is converted to Microsoft Word's OOML via MathML, using the https://github.com/asciidoctor/asciimath[AsciiMath] Ruby gem; the syntax of the Ruby gem may be at odds with the usual MathJax processor of AsciiMath. (We have found that the Ruby gem insists on numerators being bracketed.)
334
+ Mathematical formatting is done using the `[stem]` macro. Asciidoctor supports http://asciimath.org[AsciiMath] and LaTeX natively (AsciiMath by default); as of this writing Metanorma only supports AsciiMath. AsciiMath is converted to Microsoft Word's OOXML via MathML, using the https://github.com/asciidoctor/asciimath[AsciiMath] Ruby gem; the syntax of the Ruby gem may be at odds with the usual MathJax processor of AsciiMath. (We have found that the Ruby gem insists on numerators being bracketed.)
328
335
 
329
336
  === Formulae
330
337
 
@@ -366,7 +373,7 @@ P:: point of the curve corresponding to a cooking time of stem:[t_90]
366
373
  NOTE: These results are based on a study carried out on three different types of kernel.
367
374
  --
368
375
 
369
- Subfigures are entered by including images in an Asciidoc example:
376
+ Subfigures (which appear in ISO) are entered by including images in an Asciidoc example:
370
377
 
371
378
  [source,asciidoc]
372
379
  --
@@ -387,17 +394,19 @@ image::rice_images/rice_image3_3.png[]
387
394
 
388
395
  === Tables
389
396
 
390
- Asciidoc tables are quite powerful for a non-XML markup language, but we have had to add the option of multiple header rows (attribute `headerrows=n`), to deal with the complexity of ISO tables with labels, variables, and units lining up in the header.
397
+ While Asciidoctor tables are quite powerful for a non-XML markup language, they still have not dealt with the full range of complexity required in Metanorma. Metanorma adds the option of multiple header rows (attribute `headerrows=n`), to deal with the complexity of ISO tables requiring labels, variables, and units to lining up in the header.
391
398
 
392
399
  Asciidoc allows table cells to have footnotes (which the gem renders inside the table), and notes following the table (which the gem moves inside the table footer.) Table 1 in the Rice document illustrates a large range of table formatting options.
393
400
 
394
401
  === Lists
395
402
 
396
- Unordered lists in Word are rendered with em-dashes instead of bullets, as preferred by ISO. Ordered lists in Word are rendered with their labels bracketed. (_a)_, _1)_, etc.) Ordered lists in both HTML and Word have their labels pre-configured, to align with ISO/IEC DIR 2: _a), b), c)_ for the first level, then _1), 2), 3)_ for the second level, then _i), ii), iii)_, then _A), B), C)_, then _I), II), III)_. The `type` attribute for ordered lists in Asciidoc, which allows the user to specify the label of an ordered list, is ignored.
403
+ Ordered lists in both HTML and Word have their labels pre-configured, to align with ISO/IEC DIR 2: _a), b), c)_ for the first level, then _1), 2), 3)_ for the second level, then _i), ii), iii)_, then _A), B), C)_, then _I), II), III)_. The `type` attribute for ordered lists in Asciidoctor, which allows the user to specify the label of an ordered list, is ignored.
404
+
405
+ TIP: The stylesheets for ISO render unordered lists with em-dashes instead of bullets, as preferred by ISO. Ordered lists in Word are rendered with their labels bracketed. (_a)_, _1)_, etc.)
397
406
 
398
407
  === Footnotes
399
408
 
400
- Asciidoc supports only single-paragraph footnotes through its footnote macro (which can only contain a single line of text); this reflects a stylistic bias against digressive text by the Asciidoc creator, and will not change. At best, it can be worked around by introducing line breaks into the macro (see https://github.com/asciidoctor/asciidoctor.org/issues/599, http://discuss.asciidoctor.org/footnotes-with-paragraph-breaks-td4130.html).
409
+ Asciidoctor supports only single-paragraph footnotes through its footnote macro (which can only contain a single line of text); this reflects a stylistic bias against digressive text by the Asciidoc creator, and will not change. It can be worked around by introducing line breaks into the macro (see https://github.com/asciidoctor/asciidoctor.org/issues/599, http://discuss.asciidoctor.org/footnotes-with-paragraph-breaks-td4130.html).
401
410
 
402
411
  === Notes
403
412
 
@@ -405,15 +414,15 @@ Notes that are not at the end of a clause are folded into the preceding block, i
405
414
 
406
415
  === Reviewer Notes
407
416
 
408
- We have introduced a mechanism in the gem to annotate arbitrary blocks of text, using Asciidoc sidebars and anchors for the beginning and end of the annotation; see https://github.com/riboseinc/metanorma-iso#reviewer-notes[discussion in the README].
417
+ We have introduced a mechanism in the gem to annotate arbitrary blocks of text, using Asciidoctor sidebars and anchors for the beginning and end of the annotation; see https://github.com/riboseinc/metanorma-standoc#reviewer-notes[discussion in the metanorma-standoc README].
409
418
 
410
419
  == Cross-references
411
420
 
412
- The gem follows the guidance given in ISO/IEC DIR 2 rigorously. In particular, if a formula, example, figure, list, list item or table is cross-referenced outside its (sub)clause, the clause containing the item is always given in the cross-reference, unless the item is being referenced in the same clause. In the case of notes, the containing clause is extended to containing example, figure or table.
421
+ The guidance given in ISO/IEC DIR 2 for internal cross-references guarantees unambiguous referencing, and it is followed rigorously by Metanorma. In particular, if a formula, example, figure, list, list item or table is cross-referenced outside its (sub)clause, the clause containing the item is always given in the cross-reference, unless the item is being referenced in the same clause. In the case of notes, the containing clause is extended to containing example, figure or table.
413
422
 
414
- So for example, in the Rice model document, formula B-.1 is defined in Annex B.6, and is referenced in B.6 and B.7. In the PDF Rice model document, both instances are cited as "Formula (B.1)"; but the gem follows ISO/IEC DIR 2 in citing the former as "Formula (B.1)", but the latter as "B.6, Formula (B.1)".
423
+ So for example, in the Rice model document, formula B.1 is defined in Annex B.6, and is referenced in B.6 and B.7. In the Rice model document published by ISO, both instances are cited as "Formula (B.1)"; but the gem follows ISO/IEC DIR 2 in citing the former as "Formula (B.1)", but the latter as "B.6, Formula (B.1)". (Metanorma in general is "more royalist than the king" in applying formatting rules and validation—which is what you would want of a computer-based tool.)
415
424
 
416
- The label of the item cross-referenced, the use of brackets, and the containing reference are all taken care of by the gem; the document author needs only give the item identifier in the Asciidoc (e.g. `<<``formulaB-1``>>` generates either "Formula (B.1)" or "B.6, Formula (B.1)", depending on where in the document it occurs.)
425
+ The label of the item cross-referenced, the use of brackets, and the containing reference are all taken care of by the gem; the document author needs only give the item identifier in the Asciidocto source (e.g. `<<``formulaB-1``>>` generates either "Formula (B.1)" or "B.6, Formula (B.1)", depending on where in the document it occurs.)
417
426
 
418
427
  List items can be cross-referenced by inserting a bookmark at the very start of the list item:
419
428
 
@@ -426,7 +435,7 @@ List items can be cross-referenced by inserting a bookmark at the very start of
426
435
 
427
436
  == Asciidoctor Tips
428
437
 
429
- As we have noted, the http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] should be your companion when authoring any Asciidoc documents, including Asciidoc documents under Metanorma. There are some more specialised aspects of Asciidoctor markup, which you might need to dig deeper to find in the manual; we list some of them here.
438
+ As noted, the http://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] should be your companion when authoring any Asciidoc documents, including Asciidoc documents under Metanorma. There are some more specialised aspects of Asciidoctor markup, which you might need to dig deeper to find in the manual; we list some of them here.
430
439
 
431
440
  * A note or admonition can be made to span multiple paragraphs (including lists and tables), by making it a https://asciidoctor.org/docs/user-manual/#delimited-blocks[delimited block]:
432
441
 
@@ -0,0 +1,57 @@
1
+ = How can I localize the resulting output?
2
+
3
+ [TIP]
4
+ ====
5
+ * Copy the `lib/isodoc/i18n-en.yaml` file from the isodoc gem to your gem.
6
+ * Edit the right-hand text in the file.
7
+ * Give the file location as the `i18nyaml` document attribute in any files you wish to use your localisation.
8
+ ====
9
+
10
+ Every piece of text generated by the toolset instead of the author is looked up in an internationalisation file; that means that if the language setting for the document changes, and there is an internationalisation file for that language, all output is localised to that language. Of the existing gems, metanorma-gb is localised in this way for English and Chinese, and metanorma-iso is localised for English, French and Chinese.
11
+
12
+ The localisation files are http://yaml.org[YAML] files stores in `lib/isodoc/`, named `i18n-{languagecode}.yaml`. (In the case of Chinese, the script code is added to the filename: `i18n-zh-Hans.yaml`.) Most localised text are direct mappings from English metalanguage to the target language (including English itself); there are also instances of hashes in the YAML files. Most localisation text consists of one- or two-word labels, such as "Figure" or "Annex"; some boilerplate text is also included in the localisation text, such as the ISO text describing the use of external sources in Terms and Definitions.
13
+
14
+ Localisation is mostly used for translation purposes, but they can also be used to customise the rendering of particular labels in English. For example, the default English label for a first-level supplementary section is "Annex", reflecting ISO practice; but in the metanorma-sample gem, as seen above, this label is overruled in code to be "Appendix" instead.
15
+
16
+ The YAML files are read into the `IsoDoc` classes through the `i18n_init()` method of `IsoDoc::...::HtmlConvert` and `Isodoc::...::WordConvert`. The localisation equivalents for the nominated language are read from the corresponding YAML file into the `@labels` hash. The base Isodoc instance of `i18n_init()` also assigns an instance variable for each label (e.g. `@annex_lbl` for English "Annex"). These instance variables are used to generate all automated text in the Isodoc classes.
17
+
18
+ All current gems inherit their localisation files from the base isodoc gem. The local `i18n_init()` instance can overwrite individual labels in code (metanorma-csd), or they can read in a local additional YAML file for the same language (metanorma-gb). If you are implementing a completely new language, you will need to replace the base `i18n_init()` method rather than inheriting from it, to ensure that the local YAML files are read in.
19
+
20
+ The foregoing describes how to incorporate localisation into your gem on a permanent basis; but the toolset also allows you to nominate a YAML localisation file just for the current document. In Asciidoc, the YAML file is nominated as the i18nyaml document attribute; for IsoDoc, it is passed in as the `i18nyaml` hash attribute to the initialisation method. You will still need to access the base IsoDoc YAML instances, to make sure that all necessary labels are given in your YAML document.
21
+
22
+ === Example internationalisation code
23
+
24
+ * metanorma-mpfd/lib/isodoc/mpfd/i18n-en.yaml: customisation of clause label in YAML
25
+
26
+ [source]
27
+ --
28
+ clause: Paragraph
29
+ --
30
+
31
+ * metanorma-m3d/lib/isodoc/m3d/m3dhtmlconvert.rb: customisation of annex label as class variable
32
+
33
+ [source,ruby]
34
+ --
35
+ def i18n_init(lang, script)
36
+ super
37
+ @annex_lbl = "Appendix"
38
+ end
39
+ --
40
+
41
+ * metanorma-gb/lib/isodoc/gb/gbhtmlconvert.rb: code to read in internationalisation YAML templates (merges superclass `@labels` map, derived from the parent Isodoc::HtmlConvert class, with the labels read in from the GB-specific YAML templates.)
42
+
43
+ [source,ruby]
44
+ --
45
+ def i18n_init(lang, script)
46
+ super
47
+ y = if lang == "en"
48
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-en.yaml"))
49
+ elsif lang == "zh" && script == "Hans"
50
+ YAML.load_file(File.join(File.dirname(__FILE__),
51
+ "i18n-zh-Hans.yaml"))
52
+ else
53
+ YAML.load_file(File.join(File.dirname(__FILE__), "i18n-zh-Hans.yaml"))
54
+ end
55
+ @labels = @labels.merge(y)
56
+ end
57
+ --
@@ -0,0 +1,23 @@
1
+ ---
2
+ sections:
3
+ - name: Introduction
4
+ items:
5
+ - quickstart
6
+ - name: Using Metanorma-ISO
7
+ items:
8
+ - guidance
9
+ - outputs
10
+ - htmloutput
11
+ - customisation
12
+ - asciiiso-syntax
13
+ - name: "Adopting Metanorma: FAQ"
14
+ items:
15
+ - adopting-spec
16
+ - adopting-toolchain
17
+ - styling-output-html
18
+ - styling-output-msword
19
+ - localizing-output
20
+ - replacing-asciidoc
21
+ ---
22
+
23
+ = Navigation
@@ -1,377 +1,179 @@
1
- = Quickstart Guide for AsciiISO
1
+ = Quickstart Guide
2
2
 
3
- This is a guide on how to get started using AsciiISO to create ISO standards documents compliant with http://www.iec.ch/members_experts/refdocs/iec/isoiecdir-2%7Bed7.0%7Den.pdf[ISO/IEC DIR 2 "Principles and rules for the structure and drafting of ISO and IEC documents"], in Microsoft Word and HTML formats.
3
+ TIP: This guide has been authored for ISO standards, but most of it applies to all Metanorma standards. We indicate where guidance differs for different standards classes. See link:https://www.metanorma.com/software/Metanorma_processor/[List of Metanorma processors].
4
4
 
5
- AsciiISO is the purposed-design syntax for creating ISO documents based on the AsciiDoc syntax.
6
-
7
- AsciiISO is currently used as input to the Asciidoctor-ISO renderer, which produces the corresponding https://github.com/riboseinc/isodoc-models[ISOXML schema] (in `.xml`), which in turn uses the https://github.com/riboseinc/isodoc[isodoc] gem to convert ISOXML into the final output formats, HTML (`.html`) and Word Document (`.doc`).
5
+ This is a guide on how to get started using Metanorma to create documents aligned with different standards classes (such as ISO, GB, CSD, etc), in Microsoft Word and HTML formats. This guide is written to apply generically across the standards classes that can be expressed in Metanorma; guidance specific to a particular standards class is given as TIPs.
8
6
 
7
+ Metanorma takes text in the _Asciidoctor markup language_ as input (consult the https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] on the basics of this markup language).
8
+ Metanorma makes some adjustments to the text format for its requirements;
9
+ these adjustments (which we refer to as _Metanorma Asciidoctor_, or AsciiISO) are documented in relevant sections of this documentation.
10
+ Metanorma uses Asciidoctor to generate _Metanorma XML_, as an intermediate, semantic representation of standards content.
11
+ Metanorma XML in turn is processed by the https://github.com/riboseinc/isodoc[isodoc] gem to generate output in Microsoft Word (`.doc`) and HTML (`.html`).
9
12
 
10
13
  == Even quicker summary
11
14
 
12
- In order to start a new ISO document, or migrate your document from Word:
15
+ In order to start a new Metanorma document, or migrate your document from Word:
13
16
 
14
- . Install <<installation>>
17
+ . Install <<installation>> (for your specific Metanorma standards class)
15
18
  . Clone the https://github.com/riboseinc/isodoc-rice/[AsciiISO Rice]
16
19
 
17
20
  To migrate:
18
21
 
19
- . Use our https://github.com/riboseinc/reverse_asciidoctor[reverse_asciidoctor] gem to help you convert a Word document into AsciiISO. That said, the conversion will not be 100% clean and you will have to manually fix some syntax (especially if your Word document contains an index, stray anchors, and equations).
22
+ . Use our https://github.com/riboseinc/reverse_asciidoctor[reverse_asciidoctor] gem to help you convert a Word document into Asciidoctor. Be warned that the conversion will not be 100% clean, and you will have to manually fix some syntax (especially if your Word document contains an index, stray anchors, and equations).
20
23
  . Move the content back to the cloned isodoc-rice.
24
+ . The isodoc-rice repository is set up for the ISO standards class; if you are not working with ISO, change its makefile to refer to the correct standards class (e.g. from `bundle exec metanorma -t iso -x doc,xml,html $^` to `bundle exec metanorma -t rsd -x doc,xml,html $^`
21
25
 
26
+ [[supported-standards]]
27
+ == Supported standards
22
28
 
23
- [[installation]]
24
- == Installation instructions
25
-
26
- The Asciidoctor-ISO tool is a https://en.wikipedia.org/wiki/RubyGems[Ruby gem], and works on the command line. The https://en.wikipedia.org/wiki/Ruby_programming_language[Ruby programming language] can be installed on Windows (e.g. https://rubyinstaller.org), but is typically run on a Unix command line—including Linux and MacOS. The following instructions are for the Unix console.
27
-
28
- Asciidoctor-ISO in turn builds on the https://asciidoctor.org[Asciidoctor gem], which interprets the Asciidoctor markup language in Ruby. Installing the Asciidoctor-ISO gem will install the Asciidoctor gem, if it is not already installed.
29
-
30
- Ruby comes with Linux and MacOS. Asciidoctor-ISO uses Ruby 2.4.0, and you may need to update your Ruby instance to use that version. Refer to https://www.ruby-lang.org/en/documentation/installation/
31
29
 
32
- You can install the Asciidoctor-ISO gem, and all its dependencies, through the Ruby gem installer:
30
+ As of this writing, Metanorma supports the following standards classes:
33
31
 
34
- [source,console]
35
- --
36
- gem install metanorma-iso
37
- --
32
+ * https://github.com/riboseinc/metanorma-iso[ISO and IEC] (`iso`)
33
+ * https://github.com/riboseinc/metanorma-gb[Chinese National standards] (`gb`)
34
+ * https://github.com/riboseinc/metanorma-csd[Calconnect] (`csd`)
35
+ * https://github.com/riboseinc/metanorma-csand[Cloud Security Alliance] (`csand`)
36
+ * https://github.com/riboseinc/metanorma-m3d[Messaging, Malware and Mobile Anti-Abuse Working Group (M^3^AAWG)] (`m3d`)
37
+ * https://github.com/riboseinc/metanorma-rsd[Ribose] (`rsd`)
38
+ * https://github.com/riboseinc/metanorma-acme[Acme (shell for user-customised standards)] (`acme`)
39
+ * https://github.com/riboseinc/metanorma-mpfd[Mandatory Provident Fund Schemes Authority, Hong Kong (MPFA)] (`mpfd`)
40
+ * https://github.com/riboseinc/metanorma-unece[United Nations Economic Commission for Europe] (`unece`)
38
41
 
39
- If you want the latest version of the gem (which is still heavily under development), you can install it from Github:
42
+ == Installing on Linux and macOS
40
43
 
41
- [source,console]
42
- --
43
- git clone https://github.com/riboseinc/metanorma-iso.git
44
- cd metanorma-iso
45
- gem build *.gemspec
46
- gem install *.gem
47
- --
44
+ Install Metanorma-ISO gem and its dependencies:
48
45
 
49
- == How to set up a new project
46
+ You can install the metanorma-cli gem, and all its dependencies, through the Ruby gem installer:
50
47
 
51
- At its simplest, all you need is a text document in Asciidoctor format, which you compile using the Asciidoctor-ISO gem. To keep document dependencies in order, you should keep your document in a distinct folder:
52
48
 
53
49
  [source,console]
54
50
  --
55
- mkdir new_standard
56
- cd new_standard
57
- vi new_standard.adoc
51
+ gem install metanorma-cli
58
52
  --
59
53
 
60
- To compile the document, execute the `asciidoctor` script, flagging it to use the ISO variant:
54
+ If you want the latest version (note: may not be stable due to active development),
55
+ you can install it from Github:
61
56
 
62
57
  [source,console]
63
58
  --
64
- asciidoctor --trace -b iso -r 'metanorma-iso' new_standard.adoc
65
- --
66
-
67
- NOTE: This command syntax will be changed soon.
68
-
69
- This will generate two files from the `new_standard.adoc` document (provided it is well-formed!): `new_standard.html` is a standalone HTML document, and `new_standard.doc` is a Word document (currently in the pre-2007 `.doc` format, but Microsoft Word will open it fine). Both these files are generated via an intermediate XML file, `new_standard.xml`, which represents the structure of the document following the rules of ISO/IEC DIR 2, as captured in the https://github.com/riboseinc/isodoc-models[ISOXML schema].
70
-
71
- Even if there are no errors in the Asciidoctor syntax, the document may still raise warnings to the console as it is being validated. The validation comes from ISO/IEC DIR 2, and consists of two parts: warnings about document content (e.g. requiring space before a percentage sign; requiring that the scope not contain text that looks like a recommendation); and warnings about document structure. The latter are generated by running the generated XML against the ISOXML schema, and report the line numbers of the XML document where issues are observed.
72
-
73
- === Template
74
-
75
- To author Asciidoctor documents, you need to be familiar with the Asciidoctor syntax, as well as the Asciidoctor-ISO extensions to the syntax and conventions. The https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual] documents Asciidoctor itself; the https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring[Guidance for Authoring in Asciidoctor-ISO] and the https://github.com/riboseinc/metanorma-iso/blob/master/README.adoc[Asciidoctor-ISO Readme] are the complete documentation for the ISO-specific extensions. But the simplest way to get started is to take a ready-made Asciidoctor-ISO document, and edit it, observing how it approaches various formatting tasks.
76
-
77
- The https://www.iso.org/publication/PUB100407.html["Rice document"] is the ISO's model document of an international standard. An Asciidoctor-ISO version of the document is available at https://github.com/riboseinc/isodoc-rice/ . We suggest downloading the site, and editing it.
78
-
79
- The `iso-rice-en.adoc` document consists of a document header, and it references the separate `body/body-en.adoc` document for the document proper (`include::body/body-en.adoc[]`). You can just continue on with the document text after the document header—so long as you remember to leave a blank line between the two.
80
-
81
- == AsciiDoc syntax supported
82
-
83
- 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.
84
-
85
- Syntax includes the following; the links are to the Asciidoctor User Manual. All examples are taken from the Asciidoctor-ISO Rice document.
86
-
87
- === https://asciidoctor.org/docs/user-manual/#doc-header[Document header]
88
-
89
- Attributes of the document, which typically appear in the coverpage (if at all), rather than in the document proper. The permitted attributes for Asciidoctor-ISO, and their expected values, are documented in the https://github.com/riboseinc/metanorma-iso#document-attributes[Asciidoctor-ISO Readme]. Note that the author line expected in Asciidoctor is not used; the title line is likewise ignored, in favour of attributes describing the three-part bilingual title.
90
-
91
- [source,asciidoctor]
92
- --
93
- = Rice model
94
- :docnumber: 17301
95
- :tc-docnumber: 17301
96
- :ref-docnumber: ISO 17301-1:2016(E)
97
- ...
98
- --
99
-
100
- === Inline formatting
101
-
102
- * https://asciidoctor.org/docs/user-manual/#text-formatting[Formatting marks]: bold, italic, monospace, subscript, superscript
103
-
104
- [source,asciidoctor]
105
- --
106
- This document specifies minimum requirements and test methods for rice (_Oryza sativa L._).
107
- --
108
-
109
- * https://asciidoctor.org/docs/user-manual/#anchordef[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.
110
- * https://asciidoctor.org/docs/user-manual/#internal-cross-references[Internal Cross-references] reference anchors within the document. By default, the text for these is also automated, to follow ISO/IEC DIR 2, 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>``>`).
111
-
112
- [source,asciidoctor]
113
- --
114
- 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>>.
115
-
116
- ...
117
- [[figureA-1]]
118
- .Split-it-right sample divider
119
- image::images/rice_image1.png[]
120
- --
121
-
122
- * https://asciidoctor.org/docs/user-manual/#url[URLs]
123
-
124
- [source,asciidoctor]
125
- --
126
- http://www.iso.org/obp[OBP]
127
- --
128
-
129
- * https://asciidoctor.org/docs/user-manual/#activating-stem-support[STEM support] (mathematical expressions), as both inline and block formatting. (ISO Formulae are expressed as stem blocks.) Asciidoctor natively uses http://asciimath.org[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.
130
-
131
- [source,asciidoctor]
132
- --
133
- [[formulaA-1,A.1]]
134
- [stem]
135
- ++++
136
- w = (m_D) / (m_s)
137
- ++++
138
-
139
- where
140
-
141
- stem:[w]:: is the mass fraction of grains with a particular defect in the test sample;
142
- --
143
-
144
- * https://asciidoctor.org/docs/user-manual/#user-footnotes[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, as required by ISO/IEC DIR 2.
145
-
146
- [source,asciidoctor]
147
- --
148
- 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.]
149
- --
150
-
151
- === Blocks
152
-
153
- Blocks are groupings of paragraphs and text into larger units, commonly https://asciidoctor.org/docs/user-manual/#delimited-blocks[delimited], and optionally including a https://asciidoctor.org/docs/user-manual/#title[title] and https://asciidoctor.org/docs/user-manual/#metadata-2[metadata].
154
-
155
- * https://asciidoctor.org/docs/user-manual/#unordered-lists[Unordered lists]
156
-
157
- [source,asciidoctor]
158
- --
159
- The main changes compared to the previous edition are:
160
-
161
- * updated normative references;
162
- * deletion of 4.3.
163
- --
164
-
165
- * https://asciidoctor.org/docs/user-manual/#ordered-lists[Ordered lists]. Note that ISO/IEC presupposes that the first level of an ordered list is indexed with a lowercase letter. The gem automatically creates labels for the nested levels of ordered lists, and ignores any https://asciidoctor.org/docs/user-manual/#numbering-styles[numbering styles] indicated by the user.
166
-
167
- [source,asciidoctor]
168
- --
169
- . the sampling method used;
170
- . the test method used;
171
- . the test result(s) obtained or, if the repeatability has been checked, the final quoted result obtained;
172
- --
173
-
174
- * https://asciidoctor.org/docs/user-manual/#labeled-list[Definition lists]. These are used for all keys of figures and formulae, and as the content of Symbols and Abbreviations clauses and subclauses:
175
-
176
- [source,asciidoctor]
177
- --
178
- stem:[w]:: is the mass fraction of grains with a particular defect in the test sample;
179
- stem:[m_D]:: is the mass, in grams, of grains with that defect;
180
- stem:[m_S]:: is the mass, in grams, of the test sample.
181
- --
182
-
183
- 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`.
184
-
185
- * https://asciidoctor.org/docs/user-manual/#tables[Tables]. Asciidoctor supports a rich range of table formatting (which the Asciidoctor-ISO gem extends further).
186
-
187
- [source,asciidoctor]
188
- --
189
- [[tableD-1]]
190
- [cols="<,^,^,^,^",headerrows=2]
191
- .Repeatability and reproducibility of husked rice yield
192
- |===
193
- .2+| Description 4+| Rice sample
194
- | Arborio | Drago footnote:[Parboiled rice.] | Balilla | Thaibonnet
195
-
196
- | Number of laboratories retained after eliminating outliers | 13 | 11 | 13 | 13
197
- | Mean value, g/100 g | 81,2 | 82,0 | 81,8 | 77,7
198
- |===
199
- --
200
-
201
- * https://asciidoctor.org/docs/user-manual/#images[Images], which are mapped to ISO figures, with accompanying titles:
202
-
203
- [source,asciidoctor]
204
- --
205
- [[figureC-1]]
206
- .Typical gelatinization curve
207
- image::images/rice_image2.png[]
208
- footnote:[The time stem:[t_90] was estimated to be 18,2 min for this example.]
209
- --
210
-
211
- * https://asciidoctor.org/docs/user-manual/#admonition[Admonitions], which express Notes, Warnings, Cautions, etc.
212
-
213
- [source,asciidoctor]
214
- --
215
- CAUTION: Only use paddy or parboiled rice for the determination of husked rice yield.
59
+ git clone https://github.com/riboseinc/metanorma-cli.git
60
+ cd metanorma-cli
61
+ gem build *.gemspec
62
+ gem install *.gem
63
+ bundle update
216
64
  --
217
65
 
218
- * https://asciidoctor.org/docs/user-manual/#prose-excerpts-quotes-and-verses[Block quotes]
66
+ The final `bundle update` step updates the dependent gems, and is necessary because those gems are even more heavily under development.
219
67
 
220
- [source,asciidoctor]
221
- --
222
- [quote, ISO, "ISO7301,clause 1"]
223
- _____
224
- 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).
225
- _____
226
- --
68
+ [TIP]
69
+ ====
70
+ The Metanorma tool is a suite of https://en.wikipedia.org/wiki/RubyGems[Ruby gems], and works on the command line. The https://en.wikipedia.org/wiki/Ruby_programming_language[Ruby programming language] can be installed on Windows (e.g. https://rubyinstaller.org), but is typically run on a Unix command line—including Linux and MacOS. The following instructions are for the Unix console.
227
71
 
72
+ The starting poing of the Metanorma tool is the `metanorma-cli` gem (command line interface); it references various other gems that the tool is based on, including the converter from Asciidoctor to Metanorma XML (`metanorma-standoc`), the converters from Metanorma XML to HTML and Word (`isodoc`, `html2doc`), the variants of Metanorma for different standards classes (`metanorma-iso`, `metanorma-csd`, etc.), and tools for processing bibliographies (`relaton`, `isobib` etc.)
228
73
 
229
- * https://asciidoctor.org/docs/user-manual/#example[Examples]
230
- * https://asciidoctor.org/docs/user-manual/#listing-blocks[Listing blocks] (source code), including https://asciidoctor.org/docs/user-manual/#callouts[source code callouts]
74
+ The Metanorma tools processing Asciidoctor, in turn, build on the https://asciidoctor.org[Asciidoctor gem], which interprets the Asciidoctor markup language in Ruby. Installing the Metanorma gem will install the Asciidoctor gem, if it is not already installed.
231
75
 
232
- [source,asciidoctor]
233
- ----
234
- .Sample Code
76
+ Ruby comes with Linux and MacOS. Asciidoctor-ISO uses at minimum Ruby 2.3.0, and you may need to update your Ruby instance to use that version. Refer to https://www.ruby-lang.org/en/documentation/installation/
235
77
  ====
236
78
 
237
- [source,ruby]
238
- --
239
- puts "Hello, world."
240
- %w{a b c}.each do |x| <1>
241
- puts x
242
- end
243
- --
244
- <1> This is an annotation
245
- ====
246
- ----
247
79
 
248
- * https://asciidoctor.org/docs/user-manual/#comments[Comments] (which are *not* rendered in the output)
249
80
 
250
- [source,ruby]
251
- --
252
- // all terms and defs references are dated
253
- --
254
81
 
255
- === Sections
82
+ == Setting up a new project
256
83
 
257
- * The Asciidoctor https://asciidoctor.org/docs/user-manual/#doc-preamble[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 https://asciidoctor.org/docs/user-manual/#title[block title], but that will be provided automatically anyway.)
84
+ At its simplest, all you need is a text document in Asciidoctor-like AsciiISO format,
85
+ which you compile using the Metanorma-ISO gem.
258
86
 
259
- [source,asciidoctor]
260
- --
261
- [[foreword]]
262
- .Foreword
263
- ISO (the International Organization for Standardization)
264
- --
87
+ To keep document dependencies in order, place your document in a distinct folder:
265
88
 
266
- * The Asciidoctor https://asciidoctor.org/docs/user-manual/#sections[Sections] correspond to ISO 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.
267
89
 
268
- [source,asciidoctor]
90
+ [source,console]
269
91
  --
270
- == Sampling
271
- Sampling shall be carried out in accordance with <<ISO24333,clause 5>>
272
-
273
- == Test methods
274
-
275
- === Moisture content
276
-
277
- Determine the mass fraction of moisture in accordance with the method specified in <<ISO712>>.
278
- ...
279
-
92
+ mkdir new_standard
93
+ cd new_standard
94
+ vi new_standard.adoc
280
95
  --
281
96
 
97
+ To compile the document, execute the `asciidoctor` script, flagging it to use a specific standards class with the `-t` flag (refer to <<stupported-standards>> for the abbreviations used); e.g.
282
98
 
283
- == Asciidoctor-ISO specific syntax
284
-
285
- Full details of Asciidoctor-ISO–specific markup and conventions is given in the https://github.com/riboseinc/metanorma-iso/blob/master/README.adoc[Asciidoctor-ISO Readme] and the https://github.com/riboseinc/metanorma-iso/wiki/Guidance-for-authoring[Guidance for authoring].
286
-
287
- https://asciidoctor.org/docs/user-manual/#section-styles[Section styles] are used to indicate specific types of section: `[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:
288
-
289
- [source,asciidoctor]
290
- --
291
- [bibliography]
292
- == Bibliography
293
-
294
- * [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
99
+ [source,console]
295
100
  --
296
-
297
- 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.
298
-
299
- === Terms and Definitions
300
-
301
- Terms and Definitions sections follow a strict grammar in their Asciidoctor-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.
302
-
303
- [source,asciidoctor]
101
+ metanorma -t iso new_standard.adoc
304
102
  --
305
- [[paddy]]
306
- === paddy
307
- alt:[paddy rice]
308
- alt:[rough rice]
309
- deprecated:[cargo rice]
310
- domain:[rice]
311
103
 
312
- rice retaining its husk after threshing
104
+ This will generate two files from the `new_standard.adoc` document (provided it is well-formed):
313
105
 
314
- [example]
315
- Foreign seeds, husks, bran, sand, dust.
106
+ * `new_standard.html`, a standalone HTML document,
107
+ * `new_standard.doc`, a Word document
108
+ (currently in the pre-2007 `.doc` format, but Microsoft Word will open it fine).
316
109
 
317
- NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.
110
+ Both these files are generated via an intermediate XML file, `new_standard.xml`, which represents the structure of the document as it is formally defined by the standards body, and captured in the https://github.com/riboseinc/metanorma-model-iso[Metanorma XML schema].
318
111
 
319
- [.source]
320
- <<ISO7301,section 3.2>>, The term "cargo rice" is shown as deprecated,
321
- and Note 1 to entry is not included here
322
- --
112
+ Even if there are no errors in the Asciidoctor syntax, the document may still raise warnings to the console as it is being validated. The validation comes from the formal definition of the standard class (e.g. ISO/IEC DIR 2 in the case of ISO and IEC), and consists of two parts: warnings about document content (e.g., for ISO, requiring space before a percentage sign; requiring that the scope not contain text that looks like a recommendation); and warnings about document structure. The latter are generated by running the generated XML against the ISOXML schema, and report the line numbers of the XML document where issues are observed.
323
113
 
324
- Term banks such as the http://www.electropedia.org[IEV] must be treated like any other document, with terms treated as clauses; e.g. `<<IEV,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.
325
114
 
326
- Exceptionally, an introductory section can be treated as a subclause instead of a term, by prefixing it with the style attribute `[.nonterm]`.
327
115
 
328
- === References (Normative, Informative)
116
+ Even if there are no errors in the syntax, the document may still raise warnings
117
+ to the console as it is being validated.
118
+ The validation comes from ISO/IEC DIR 2, and consists of two parts:
329
119
 
330
- 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.
120
+ * Warnings about document content
121
+ (e.g., requiring space before a percentage sign,
122
+ or requiring that the scope not contain text that looks like a recommendation).
123
+ * Warnings about document structure
124
+ (found from running the generated XML against the ISOXML schema,
125
+ they report the line numbers of the XML document where issues are observed).
331
126
 
332
- 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.
127
+ == Starting with an example project
333
128
 
334
- [source,asciidoctor]
335
- --
336
- Grade 3 quality as specified in <<ISO3696>>.
129
+ Perhaps the simplest way to get started is to take an existing Metanorma-ISO document
130
+ and edit it, observing how it approaches various formatting tasks.
337
131
 
338
- ...
132
+ The https://www.iso.org/publication/PUB100407.html["Rice document"]
133
+ is the ISO's model document of an international standard.
134
+ An Metanorma-ISO version of the document is available
135
+ at https://github.com/riboseinc/isodoc-rice/.
136
+ We suggest downloading the site, and editing it.
339
137
 
340
- * [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
341
- * [[[ISO7301,ISO 7301:2011]]], _Rice -- Specification_
342
- * [[[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_
343
- --
138
+ The `iso-rice-en.adoc` document consists of a document header,
139
+ and it references the separate `body/body-en.adoc` document for the document proper (`include::body/body-en.adoc[]`).
140
+ You can just continue on with the document text after the document header—so long as you remember to leave a blank line between the two.
344
141
 
345
- 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 Asciidoctor-ISO, the cross-reference is a normal anchor identifier; the bracket numbering for informative references is automatic.
142
+ == Learning the AsciiDoc-based syntax
346
143
 
347
- [source,asciidoctor]
348
- --
349
- For details concerning the use of the Dumas method, see References <<ref10>> and <<ref16>>.
144
+ To author AsciiDoc documents, you need to be familiar with the _core AsciiDoc syntax_,
145
+ as well as _the syntax extensions and conventions_ that are specific to Metanorma-ISO.
350
146
 
351
- ...
147
+ - Check out link:asciiiso-syntax[our AsciiISO syntax reference],
148
+ and link:guidance.adoc[Guidance for Authoring in Metanorma-ISO].
352
149
 
353
- * [[[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)
150
+ - See also https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual]
151
+ documenting Asciidoctor itself
152
+ and https://github.com/riboseinc/metanorma-iso/blob/master/README.adoc[Metanorma-ISO README].
354
153
 
355
- * [[[ref16,16]]] [smallcap]#Tkachuk R.# Nitrogen-to-protein conversion factors for cereals and oilseed meals. _Cereal Chem._ 1969, *46* (4) pp 419-423
356
- --
357
-
358
- 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:
154
+ == Migrating existing documents from Microsoft Word
359
155
 
360
- [source,asciidoctor]
361
- --
362
- <<ISO7301,clause=3.1>>
156
+ . Use our https://github.com/riboseinc/reverse_asciidoctor[reverse_asciidoctor]
157
+ gem to help you convert a Word document into AsciiISO.
158
+ +
159
+ You will likely have to manually clean up some syntax
160
+ (especially if your Word document contains an index, stray anchors, and equations):
161
+ don’t rely on the automatic conversion to be 100% correct.
363
162
 
364
- NOTE: This table is based on <<ISO7301,table=1>>.
163
+ - Check out link:asciiiso-syntax[our AsciiISO syntax reference],
164
+ and link:guidance.adoc[Guidance for Authoring in Asciidoctor-ISO].
365
165
 
366
- Sampling shall be carried out in accordance with <<ISO24333,clause=5>>
367
- --
166
+ - See also https://asciidoctor.org/docs/user-manual/[Asciidoctor User Manual]
167
+ documenting Asciidoctor itself
168
+ and https://github.com/riboseinc/metanorma-iso/blob/master/README.adoc[Metanorma-ISO README].
368
169
 
369
- 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_.
170
+ == Migrating existing documents from Microsoft Word:
370
171
 
172
+ . Use our https://github.com/riboseinc/reverse_asciidoctor[reverse_asciidoctor]
173
+ gem to help you convert a Word document into AsciiISO.
371
174
 
372
- === Annexes
373
-
374
- 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]`).
375
-
376
- The numbering of annexes and appendices is automatic: do not insert "Annex A" or "Appendix 1" as part of the title.
175
+ You will likely have to manually clean up some syntax
176
+ (especially if your Word document contains an index, stray anchors, and equations):
177
+ don’t rely on the automatic conversion to be 100% correct.
178
+ . Move the content back to the cloned isodoc-rice.
377
179