asciidoctor-iso 0.9.3 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb1e34c74de1fc1690bc277c1a0deaa90e165dec375664f043c1427b3a053c98
4
- data.tar.gz: 164743809557dba029c72bc607fdbade46a0ca3e2c848db55ec037362251fa3a
3
+ metadata.gz: 13f80a4e5e9ab950e49dd4bc484f0e1d1bbe5f55b593f49de60242b36fdc0a0b
4
+ data.tar.gz: 4a90a72c5f48c2f4fdf6a8d2886255b1ea7e02402fbec9fb869719e56f4ace55
5
5
  SHA512:
6
- metadata.gz: e0e418454bf54ba9af399448241afbe8cb0aad8c558f668a8535cdaeeffc86a37b9dc4ac50eec8160a174cbc7cb479cef7c19576a2878cd56250db39c255f573
7
- data.tar.gz: b170a8f58c5507c2e71573371940f2f19c7c4379713984482db90afaffce6e76f4b476f193e998c135a00da23d153145e3d0ed286786fbdd489f0123e4c0eeaa
6
+ metadata.gz: a9b571864d2e7c2e38508699f6ce9138d935a6776b1e5645098cc2541430445132c0bf0424118f71a5412ee78a18a336a7d336541db7185bb2cc4f09cab3e703
7
+ data.tar.gz: 7bd69063e480299905d44ff78c3e6480098555091ca897d3522ca499762f2d7803f9e29e3c0789e414af44c7a713779c3b96924d214b947c6fcf2f57450ecbf1
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ gem "relaton", github: "riboseinc/relaton"
4
+
3
5
  # Specify your gem's dependencies in gemspec
4
6
  gemspec
@@ -1,10 +1,21 @@
1
- PATH
2
- remote: .
1
+ GIT
2
+ remote: git://github.com/riboseinc/relaton.git
3
+ revision: 19dac2282a606c97f2f25d3a6117fd3b84c344dd
3
4
  specs:
4
- asciidoctor-iso (0.9.2)
5
+ relaton (0.0.1)
5
6
  asciidoctor (~> 1.5.7)
7
+ gbbib (~> 0.1.0)
8
+ iev (~> 0.1.0)
6
9
  iso-bib-item (~> 0.1.6)
7
10
  isobib (~> 0.1.8)
11
+ rfcbib (~> 0.1.0)
12
+
13
+ PATH
14
+ remote: .
15
+ specs:
16
+ asciidoctor-iso (0.9.4)
17
+ asciidoctor (~> 1.5.7)
18
+ iev (~> 0.1.0)
8
19
  isodoc (>= 0.8)
9
20
  ruby-jing
10
21
 
@@ -15,7 +26,7 @@ GEM
15
26
  httpclient (~> 2.8, >= 2.8.3)
16
27
  json (>= 1.5.1)
17
28
  asciidoctor (1.5.7.1)
18
- asciidoctor-csand (0.3.0)
29
+ asciidoctor-csand (0.3.1)
19
30
  asciidoctor (~> 1.5.7)
20
31
  asciidoctor-iso (>= 0.9.0)
21
32
  asciimath
@@ -28,14 +39,15 @@ GEM
28
39
  ruby-xslt
29
40
  thread_safe
30
41
  uuidtools
31
- asciidoctor-csd (0.4.0)
42
+ asciidoctor-csd (0.4.1)
32
43
  asciidoctor-iso (>= 0.9.0)
33
44
  isodoc (>= 0.8.0)
34
- asciidoctor-gb (0.3.0)
45
+ asciidoctor-gb (0.3.2)
35
46
  asciidoctor-iso (>= 0.9.0)
47
+ gbbib
36
48
  isodoc (>= 0.8.0)
37
49
  twitter_cldr
38
- asciidoctor-m3d (0.3.1)
50
+ asciidoctor-m3d (0.3.2)
39
51
  asciidoctor (~> 1.5.7)
40
52
  asciidoctor-iso (>= 0.9.0)
41
53
  asciimath
@@ -72,6 +84,7 @@ GEM
72
84
  byebug (9.1.0)
73
85
  camertron-eprun (1.1.1)
74
86
  cldr-plurals-runtime-rb (1.0.1)
87
+ cnccs (0.1.1)
75
88
  coderay (1.1.2)
76
89
  diff-lcs (1.3)
77
90
  docile (1.3.1)
@@ -80,6 +93,9 @@ GEM
80
93
  nokogiri (>= 1.4.3)
81
94
  ffi (1.9.25)
82
95
  formatador (0.2.5)
96
+ gbbib (0.1.4)
97
+ cnccs
98
+ iso-bib-item
83
99
  guard (2.14.2)
84
100
  formatador (>= 0.2.4)
85
101
  listen (>= 2.7, < 4.0)
@@ -105,15 +121,17 @@ GEM
105
121
  uuidtools
106
122
  htmlentities (4.3.4)
107
123
  httpclient (2.8.3)
124
+ iev (0.1.0)
125
+ nokogiri
108
126
  image_size (2.0.0)
109
- iso-bib-item (0.1.9)
110
- duplicate
127
+ iso-bib-item (0.1.10)
128
+ duplicate (~> 1.1.1)
111
129
  isoics (~> 0.1.6)
112
130
  nokogiri
113
- isobib (0.1.8)
131
+ isobib (0.1.9)
114
132
  algoliasearch
115
- iso-bib-item (~> 0.1.2)
116
- isodoc (0.8)
133
+ iso-bib-item (~> 0.1.10)
134
+ isodoc (0.8.1)
117
135
  asciimath
118
136
  html2doc (>= 0.7.1)
119
137
  htmlentities (~> 4.3.4)
@@ -135,7 +153,7 @@ GEM
135
153
  rb-inotify (~> 0.9, >= 0.9.7)
136
154
  ruby_dep (~> 1.2)
137
155
  lumberjack (1.0.13)
138
- metanorma (0.2.4)
156
+ metanorma (0.2.5)
139
157
  asciidoctor-csand (>= 0.3.0)
140
158
  asciidoctor-csd (>= 0.4.0)
141
159
  asciidoctor-gb (>= 0.3.0)
@@ -150,7 +168,7 @@ GEM
150
168
  mime-types-data (3.2016.0521)
151
169
  mini_portile2 (2.3.0)
152
170
  nenv (0.3.0)
153
- nokogiri (1.8.3)
171
+ nokogiri (1.8.4)
154
172
  mini_portile2 (~> 2.3.0)
155
173
  notiffany (0.1.1)
156
174
  nenv (~> 0.1)
@@ -168,6 +186,8 @@ GEM
168
186
  rb-fsevent (0.10.3)
169
187
  rb-inotify (0.9.10)
170
188
  ffi (>= 0.5.0, < 2)
189
+ rfcbib (0.1.1)
190
+ iso-bib-item (~> 0.1.10)
171
191
  roman-numerals (0.3.0)
172
192
  rspec (3.7.0)
173
193
  rspec-core (~> 3.7.0)
@@ -228,8 +248,9 @@ DEPENDENCIES
228
248
  equivalent-xml (~> 0.6)
229
249
  guard (~> 2.14)
230
250
  guard-rspec (~> 4.7)
231
- metanorma (~> 0.2.4)
251
+ metanorma (~> 0.2.5)
232
252
  rake (~> 12.0)
253
+ relaton!
233
254
  rspec (~> 3.6)
234
255
  rubocop (~> 0.50)
235
256
  simplecov (~> 0.15)
@@ -118,6 +118,9 @@ levels of subsections.)
118
118
 
119
119
  * Title intro or title part appears in only one of French or English.
120
120
 
121
+ In addition, the gem checks all terms cited from the IEV Electropedia against
122
+ the online IEV Electropedia entry, and issues a warning if the term is different.
123
+
121
124
  == Approach
122
125
  === Document model
123
126
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  DESCRIPTION
20
20
 
21
21
  spec.homepage = "https://github.com/riboseinc/asciidoctor-iso"
22
- spec.license = "MIT"
22
+ spec.license = "BSD-2-Clause"
23
23
 
24
24
  spec.bindir = "bin"
25
25
  spec.require_paths = ["lib"]
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "asciidoctor", "~> 1.5.7"
31
31
  spec.add_dependency "ruby-jing"
32
32
  spec.add_dependency "isodoc", ">= 0.8"
33
- spec.add_dependency "isobib", "~> 0.1.8"
34
- spec.add_dependency "iso-bib-item", "~> 0.1.6"
33
+ spec.add_dependency "iev", "~> 0.1.0"
34
+ spec.add_dependency "relaton", "~> 0.0.1"
35
35
 
36
36
  spec.add_development_dependency "bundler", "~> 1.15"
37
37
  spec.add_development_dependency "byebug", "~> 9.1"
@@ -43,5 +43,5 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency "rubocop", "~> 0.50"
44
44
  spec.add_development_dependency "simplecov", "~> 0.15"
45
45
  spec.add_development_dependency "timecop", "~> 0.9"
46
- spec.add_development_dependency "metanorma", "~> 0.2.4"
46
+ spec.add_development_dependency "metanorma", "~> 0.2.5"
47
47
  end
@@ -0,0 +1,178 @@
1
+ = Gem Customisation Guide
2
+
3
+ In this guide, we give advice on how to adopt the Metanorma approach to document generation for your documents. We provide enough guidance for you to do full customisation, but we prefix each section with a Tip for quick-and-dirty implementation.
4
+
5
+ == How can I adopt the StanDoc specification for my own publications?
6
+
7
+ TIP: Copy the RSD schema from https://github.com/riboseinc/metanorma-iso/blob/master/grammars/rsd.rng. You may need to adapt some of the enums in the model, or in the ISO Standards model that it inherits; but in the first instance, you can just ignore the differences—and ignore the validation feedback that the toolset gives.
8
+
9
+ The Standoc specification is expressed in http://www.relaxng.org[RelaxNG schema for XML], and is intended to be customisable for different types of publication. The customisation of Standoc relies on inheritance, with the following schemas embedded hierarchically:
10
+
11
+ * https://github.com/riboseinc/bib-models[Relaton]: bibliography
12
+ * https://github.com/riboseinc/basicdoc-models[BasicDoc]: block-level and inline formatting
13
+ * https://github.com/riboseinc/metanorma-standoc[StanDoc]: organisation of sections for a generic standards document
14
+ * Models specific to standards
15
+
16
+ Because of the richness of the ISO standards model, most Standoc standards to date (including the sample gem https://github.com/riboseinc/asciidoctor-metanorma_sample) inherit from the ISO Standards model, which itself inherits from Standoc.
17
+
18
+ Specialisation of a model consists of:
19
+
20
+ * Adding classes to a base model.
21
+ * Changing attributes of a base model class. This is not restricted to adding attributes, as is the case in typical entity subclassing; it can also include removing attributes from a class, changing their obligation and cardinality, and changing their type, including changing enumerations. Attributes can be overruled at any level; for example, standards-specific models routinely enhance the bibliographic model at the base of the hierarchy.
22
+ * For reasons of clarity, renaming classes and attributes is avoided in specialisation.
23
+
24
+ To adapt the schema for your publication set,
25
+
26
+ * Get familiar with the Standoc set of models, and identify any elements that you would want to represent differently for your documents (different types, different enums), or enhance for your documents (additional element attributes, additional elements)
27
+ * Create a grammar inheriting from StanDoc or from a specific standard, which expresses what is distinctive about your grammar.
28
+ ** We recommend starting your modelling in UML, as an effective communication tool; compare the UML models for Standoc standards at https://github.com/riboseinc/metanorma-iso
29
+ ** The tool suite expects to validate against a set of schemas expressed in RelaxNG. We have been authoring grammars in RelaxNG Compact, as a more human-readable format, then compiling those grammars to RelaxNG using https://github.com/relaxng/jing-trang[jing-trang]. You can choose to use a different schema language, but you will need to customise the tool chain to validate against that form of schema instead.
30
+ ** In order to make schema inheritance easier, we have avoided using namespaces for the individual schemas; a namespace is added to the standards-specific schema at the very end of the inheritance chain.
31
+
32
+ == How can I adapt the StanDoc toolchain for my own publications?
33
+
34
+ [TIP]
35
+ ====
36
+ * Clone the asciidoctor-metanorma_sample gem: https://github.com/riboseinc/asciidoctor-metanorma_sample.
37
+ * Change the namespace for RSD documents (`RSD_NAMESPACE = "https://open.ribose.com/standards/rsd"`) to a namespace specific to your organisation's document standard.
38
+ * Change any references to `sample` or `Sample` in the gem to your organisation's document standard.
39
+ * Change the styling of the document outputs (`.../lib/isodoc/XXX/html`).
40
+ ====
41
+
42
+ The tool chains currently available proceed in two steps: map an input markup language (currently Asciidoctor only) into Standoc XML, and map Standoc XML into various output formats (currently Word doc, HTML, PDF via HTML). Running the metanorma tool involves a third step, of exposing the capabilities available in the first two in a consistent format. These two steps are represented as three separate modules, which are included in the same gem; for the Sample gem, they are `Asciidoctor::Sample`, `Isodoc::Sample`, and `Metanorma::Sample`. (In the case of Asciidoctor-ISO, almost all the content of `Isodoc::ISO` is in the isodoc gem, so the base classes of the two steps are in separate gems.)
43
+
44
+ Your adaptation of the toolchain will need to instantiate these three modules. The connection between the two first steps is taken care of in the toolchain, and metanorma explicitly invokes the two steps, feeding the XML output of the first step as input into the second. The asciidoctor-metanorma_sample gem outputs both Word and HTML; you can choose to output only Word (as is done in asciidoctor-m3d), or only HTML (as is done in asciidoctor-csand), and you can choose to generate PDF from HTML as well (as is done in asciidoctor-csd).
45
+
46
+ The modules involve classes which rely on inheritance from other classes; the current gems all use `Asciidoctor::ISO::Converter`, `Isodoc::{Metadata, HtmlConvert, WordConvert}`, and `Metanorma::Processor` as their base classes. This allows the standards-specific classes to be quite succinct, as most of their behaviour is inherited from other classes; but it also means that you need to be familiar with the underlying gems, in order to do most customisation.
47
+
48
+ In the case of `Asciidoctor::X` classes, the changes you will need to make involve the intermediate XML representation of your document; e.g. adding different enums, or adding new elements. The adaptations in `Asciidoctor::Sample::Converter` are limited, and most projects can take them across as is:
49
+
50
+ * The boilerplate representation of the document's author, publisher and copyright holder names Ribose instead of ISO as the responsible organisation.
51
+ * The editorial committees are represented as a single element, as opposed to ISO's name plus number.
52
+ * The document title is monolingual, not bilingual.
53
+ * The document status is a single element, as opposed to ISO's two-part code.
54
+ * The document identifier is a single element.
55
+ * Title validation and style validation is disabled.
56
+ * The root element of the document is changed from `iso-standard` to `rsd-standard`.
57
+ * The document type attribute is restricted to a prescribed set of options.
58
+ * A `literal` element and a `keyword` element is added to the ISO instance of Standoc.
59
+ * The inline headers of ISO are ignored.
60
+
61
+ The customisations needed for Metanorma::Sample::Processor are minor:
62
+
63
+ * `initialize` names the token by which Asciidoctor registers the standard
64
+ * `output_formats` names the available output formats (including XML, which is inherited from the parent class)
65
+ * `version` gives the current version string for the gem
66
+ * `input_to_isodoc` is the call which converts Asciidoctor input into IsoDoc XML
67
+ * `output` is the call which converts IsoDoc XML into various nominated output formats
68
+
69
+ The customisations needed for Isodoc::Sample are more extensive. Three base classes are involved:
70
+
71
+ * `Isodoc::Metadata` processes the metadata about the document stored in `//bibdata`. This information typically ends up in the document title page, as opposed to the document body. For that reason, metadata is extracted into a hash, which is passed to document output (title page, Word header) via the https://shopify.github.io/liquid/[Liquid template language].
72
+ * `Isodoc::HtmlConvert` converts Standoc XML to HTML.
73
+ * `Isodoc::WordConvert` converts Standoc XML to Word HTML; the https://github.com/riboseinc/html2doc[html2doc] gem then converts this to a .doc document.
74
+
75
+ The `Isodoc::HtmlConvert` and `Isodoc::WordConvert` overlap substantially, as both use variants of HTML; in fact the files `samplehtmlrender.rb` and `samplewordrender.rb` are deliberately identical, apart from the class their code belongs to. However there is no reason not to make substantially different rendering choices in the HTML and Word branches of the code.
76
+
77
+ = How can I style the resulting HTML output?
78
+
79
+ [TIP]
80
+ ====
81
+ * Clone the asciidoctor-metanorma_sample gem: https://github.com/riboseinc/asciidoctor-metanorma_sample.
82
+ * Edit the `html_sample_titlepage.html` and `html_sample_intro.html` pages to match your organisation's branding.
83
+ ** Leave the Liquid Template instructions alone (`{{`, `{%`) unless you know what you're doing with them: they are how the pages are populated with metadata.
84
+ * Edit the `default_fonts()` method in your `IsoDoc::...::HtmlConvert` class, to match your desired fonts.
85
+ * Edit the `htmlstyle.scss` stylesheet to match your organisation's branding. The classes already in place there are used to style existing blocks of text; refer to the sample documents included in the gem (`spec/examples`) for their use.
86
+ ====
87
+
88
+ Styling of output is intended to be configurable. HTML stylesheets are in https://sass-lang.com/guide[SCSS], with their fonts populated through the `default_fonts()` method in the `IsoDoc::...::HtmlConvert` class. Frontispiece content is templated, populated from metadata parsed in the `IsoDoc::...::Metadata` class, via https://shopify.github.io/liquid/[Liquid templates]. That means you can change the styling of output documents readily, so long as you are aware of the functionality of the stylesheet.
89
+
90
+ * Styling information is stored in the `.../lib/isodoc/html` folder of the gem, and applies to both Word and HTML content. For HTML content, the relevant files are `html_..._titlepage.html` (title page HTML template), `html_..._intro.html` (introductory HTML template, typically restricted to Table of Contents), `scripts.html` (Javascript scripts), and `htmlstyle.scss` (the HTML stylesheet).
91
+ * The styling files to be loaded in are set in the `initialize()` method of `IsoDoc::...::HtmlConvert`. Additional files (e.g. logos) can be loaded there; for them to be access during document generation, they need to be copied to the working directory. (They can be removed subsequently by adding them to the `@files_to_delete` array. All image files are copied into an `_html` subdirectory.)
92
+ * The HTML templates are populated through Liquid Templates: variables in `{{` correspond to the hash keys for metadata extracted in `IsoDoc::...::Metadata`, and its superclass `IsoDoc::Metadata` in the isodoc gem.
93
+ * The SCSS stylesheets treat fonts as variables. Those variables are set in `default_fonts()`, which generates variable assignments for SCSS. Stylesheets normally recognise three fonts: `$bodyfont` for body text, `$headerfont` for headers and captions (which may be the same font as `$bodyfont`), and `$monospacefont` for monospace text. Note that `default_fonts()` takes the document script as a parameter, and permits different font choices for different document scripts. (The existing gems refer to `Latn`, Latin script, and `Hans`, Simplified Chinese script.)
94
+ * Javascript scripts are populated in `scripts.html`; the scripts already in place in any gem you modify are in live use, and you should work out what they do before removing them. The AnchorJS script, for example, is used to generate navigable anchors in the document.
95
+ * Additional scripts and fonts may be loaded in the document head through the `html_head()` method of `IsoDoc::...::HtmlConvert`. The existing gems use the document head to load Jquery, the Table of Contents generation script, Google Fonts, and Font Awesome.
96
+ * An HTML document is populated as follows:
97
+ ** HTML Head wrapper (in `IsoDoc::HtmlConvert`)
98
+ *** `html_head()` content
99
+ *** `@htmlstylesheet` CSS stylesheet (generated from SCSS through the `generate_css()` method of `Isodoc::HtmlConvert`).
100
+ ** HTML Body
101
+ *** `@htmlcoverpage` HTML template (optional, corresponds to `html_..._titlepage.html`)
102
+ *** `@htmlintropage` HTML template (optional, corresponds to `html_..._intro.html`)
103
+ *** Document proper (converted from Standoc XML)
104
+ *** `@scripts` Javascript Scripts (optional, corresponds to `scripts.html`)
105
+ * The classes in the SCSS stylesheet correspond to static HTML content in the HTML templates, and dynamic HTML content in the `IsoDoc::...::HtmlConvert` class, and its superclasses `IsoDoc::HtmlConvert` and `IsoDoc::Common` in the isodoc gem.
106
+
107
+ = How can I style the resulting Word output?
108
+
109
+ [TIP]
110
+ ====
111
+ * There is no quick way of doing this.
112
+ * Everything you can do in Word, you can do in Word HTML. Save Word documents as Word HTML to see how.
113
+ * Clone the asciidoctor-metanorma_sample gem: https://github.com/riboseinc/asciidoctor-metanorma_sample.
114
+ * Edit the `word_sample_titlepage.html` and `word_sample_intro.html` pages to match your organisation's branding. With lots of iterations of saving Word documents as HTML, for trial and error.
115
+ ** Leave the Liquid Template instructions alone (`{{`, `{%`) unless you know what you're doing with them: they are how the pages are populated with metadata.
116
+ * Edit the `default_fonts()` method in your `IsoDoc::...::WordConvert` class, to match your desired fonts.
117
+ * Edit the `wordstyle.scss` and `sample.scss` stylesheets to match your organisation's branding. With lots of iterations of saving Word documents as HTML, for trial and error.
118
+ ====
119
+
120
+ Word output in the document toolset is generated through Word HTML, the variant of HTML that you get when you save a Word document as HTML. (That is why documents are saved in `.doc`, not `.docx`.) This has the advantage over https://en.wikipedia.org/wiki/Office_Open_XML[OOXML], the native markup of DOCX, of using a well-known markup language, with a low barrier to entry: if you want to work out how to do something in Word HTML, do it in Word, save the document as HTML, and open up the HTML in a text editor. (For more on the choice of using Word HTML, see https://github.com/riboseinc/html2doc/wiki/Why-not-docx%3F.)
121
+
122
+ However Word HTML is not quite the HTML you are used to: it is a restricted, syntactically idiosyncratic variant of HTML 4, with a non-standard and weakened form of CSS. Doing any styling in Word HTML involves lots of trial and error, and paying close attention to how Word HTML does things in its CSS. We have documented a few of the clearer gotchas in https://github.com/riboseinc/html2doc/blob/master/README.adoc.
123
+
124
+ It's still better than learning OOXML.
125
+
126
+ The process for generating Word output is fairly similar to that for generating HTML, since both processes are generating a form of HTML; as we already noted, the two processes share a substantial amount of code. The main differences are in the handling of page-media features that CSS has lagged in (footnotes, pagination, headers and footers), and in the styling of lists, for which Word HTML uses custom (and undocumented) CSS classes prefixed with `@`, specifying inter alia the numbering for nine levels of nesting of the same list.
127
+
128
+ * Styling information is stored in the `.../lib/isodoc/html` folder of the gem, and applies to both Word and HTML content. For Word content, the relevant files are `word_..._titlepage.html` (title page HTML template), `word_..._intro.html` (introductory HTML template, typically restricted to Table of Contents), `wordstyle.scss` and `{name_of_standard}.scss` (the Word stylesheets), and `header.html` (document headers, footers, and endnote/footnote separators, referenced from the stylesheets).
129
+ * The styling files to be loaded in are set in the `initialize()` method of `IsoDoc::...::WordConvert`. As with HTML generation, additional files (e.g. logos) can be loaded there. The `initialize()` method also sets the `@` styles in the stylesheet to be used for unordered and ordered lists; a single such style is intended to capture the behaviour of all levels of indentation.
130
+ * As with HTML output, the HTML templates are populated through Liquid Templates: variables in `{{` correspond to the hash keys for metadata extracted in `IsoDoc::...::Metadata`, and its superclass `IsoDoc::Metadata` in the isodoc gem.
131
+ * As with HTML, the SCSS stylesheets treat fonts as variables, and are set in the `default_fonts()` method of `IsoDoc::...::WordConvert`.
132
+ * Document headers and footers are set in the `header.html` file. This is also an HTML template, which is populated with metadata attributes through Liquid Template. The structure of `header.html` is determined by Word, and elements of `header.html` need to be crossreferenced from the Word stylesheet. To inspect Word `header.html` files, save a Word document as HTML, and look inside the `{document_name}.fld` folder generated alongside the HTML output.
133
+ * A Word HTML document is populated as follows:
134
+ ** HTML Head wrapper (in `IsoDoc::WordConvert`)
135
+ *** `@wordstylesheet` CSS stylesheet (generated from SCSS through the `generate_css()` method of `Isodoc::WordConvert`); corresponds to `wordstyle.scss`.
136
+ *** `@standstylesheet` CSS stylesheet (generated from SCSS through the `generate_css()` method of `Isodoc::WordConvert`); intended to override any generic CSS in `@wordstylesheet`. Optional, corresponds to `{name_of_standard}.scss`.
137
+ ** HTML Body
138
+ *** `@wordcoverpage` HTML template (optional, corresponds to `word_..._titlepage.html`). Included in `<div class=WordSection1>`.
139
+ *** `@htmlintropage` HTML template (optional, corresponds to `word_..._intro.html`). Included in `<div class=WordSection2>`. In the existing gems, WordSection2 is paginated with roman numerals.
140
+ *** Document proper (converted from Standoc XML). Included in `<div class=WordSection2>` (prefatory material) and `<div class=WordSection3>` (main document). In the existing gems, WordSection3 is paginated with roman numerals.
141
+ * The classes in the SCSS stylesheet correspond to static HTML content in the HTML templates, and dynamic HTML content in the `IsoDoc::...::WordConvert` class, and its superclasses `IsoDoc::WordConvert` and `IsoDoc::Common` in the isodoc gem.
142
+
143
+ = How can I localize the resulting output?
144
+
145
+ [TIP]
146
+ ====
147
+ * Copy the `lib/isodoc/i18n-en.yaml` file from the isodoc gem to your gem.
148
+ * Edit the right-hand text in the file.
149
+ * Give the file location as the `i18nyaml` document attribute in any files you wish to use your localisation.
150
+ ====
151
+
152
+ 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, asciidoctor-gb is localised in this way for English and Chinese, and asciidoctor-iso is localised for English, French and Chinese.
153
+
154
+ 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.
155
+
156
+ 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 asciidoctor-csd gem, this label is overruled in code to be "Appendix" instead.
157
+
158
+ 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.
159
+
160
+ All current gems inherit their localisation files from the base isodoc gem. The local `i18n_init()` instance can overwrite individual labels in code (asciidoctor-csd), or they can read in a local additional YAML file for the same language (asciidoctor-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.
161
+
162
+ 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.
163
+
164
+ = I can translate my specifications into IsoDoc XML myself (i.e. I don't like AsciiDoc, or I already have my own toolchain). Can I only use IsoDoc XML to produce pretty output?
165
+
166
+ [TIP]
167
+ ====
168
+ * Generate correct IsoDoc XML (make sure it validates!)
169
+ * Create just the `IsoDoc::...::HtmlConvert` and/or `IsoDoc::...::WordConvert` classes to convert the IsoDoc XML into target formats.
170
+ * Initialise the IsoDoc class passing the necessary information about fonts and scripts; the existing gems all illustrate this kind of initialisation.
171
+ * Create the target format using the method `.convert(filename, xml)`.
172
+ ====
173
+
174
+ The Asciidoctor-to-XML and XML-to-Output classes are separate, so you can invoke just the latter without the former. Of course, you will need to make sure that the IsoDoc XML you are passing to the generators is valid.
175
+
176
+ The `IsoDoc::...::HtmlConvert` and/or `IsoDoc::...::WordConvert` are initialised in the existing gems with a hash giving the fonts to be used in the document (to be injected in the document SCSS stylesheets), the script of the document (to be used to pick the right font, in case of default font settings), and the `i18nyaml` YAML file for localisation. All existing gems have defaults set for these values on the Asciidoctor side invoking the class, so all parameters are optional.
177
+
178
+ Once you have the classes set up, all you need to do is invoke the conversion of XML to the target format, with the method `.convert(filename, xml)`, where XML is the IsoDoc XML.
@@ -0,0 +1,436 @@
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
+
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/asciidoctor-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/asciidoctor-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.
5
+
6
+ == Usage
7
+
8
+ See the README on https://github.com/riboseinc/asciidoctor-iso#usage[how to deploy and use the gem].
9
+
10
+ == Output in different languages
11
+
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).
13
+
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.
15
+
16
+ The Chinese (Simplified) template also localises punctuation and spacing, mapping them away from the default Latin punctuation used elsewhere in the gem.
17
+
18
+ == Validation
19
+
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.
21
+
22
+ 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
+
24
+ [source,console]
25
+ --
26
+ ISO style: WARNING (Section: ): Footnote may contain requirement: The maximum permissible mass fraction of defects shall be determined with respect to the mass fraction obtained after milling.
27
+ ISO style: WARNING (Section: Wire sieve,): possible decimal point: 0.02
28
+ ISO style: invalid technical committee type XYZ
29
+ ISO style: AnnexA-4-1:Preparation of test sample: subsection is only child
30
+ --
31
+
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.
33
+
34
+ For example:
35
+
36
+ [source,console]
37
+ --
38
+ value of attribute "date" is invalid; must be an ISO date @ 454:183
39
+ element "review" missing required attribute "from" @ 454:183
40
+ element "subsection" not allowed here; expected the element end-tag or element "admonition", "dl", "example", "figure", "formula", "note", "ol", "p", "quote", "review", "sourcecode", "table" or "ul" @ 467:52
41
+ value of attribute "date" is invalid; must be an ISO date @ 476:233
42
+ IDREF "Annex-A-2" without matching ID @ 315:50
43
+ IDREF "last_conformance_class" without matching ID @ 649:236
44
+ IDREF "Annex-A" without matching ID @ 308:141
45
+ --
46
+
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.
50
+
51
+ == Document header
52
+
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/asciidoctor-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.
54
+
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.
56
+
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\&eacute;cification et m\&eacute;thodes d'essai`; `:title-part-en:Information Technology—Security`, not `:title-part-en:Information Technology\&mdash;Security`.
58
+
59
+ == Document sections
60
+
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.
62
+
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.
64
+
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.
66
+
67
+
68
+ === Bibliographies
69
+
70
+ The Normative References and the Bibliography must be preceded by the style attribute `[bibliography]`, so that the references they contain may be recognised as such.
71
+
72
+ All bibliographic entries must be given as unordered lists.
73
+
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.
75
+
76
+ ==== ISO References
77
+
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:
79
+
80
+ [source,asciidoc]
81
+ --
82
+ * [[[ricepotentialmilling,ISO 6646]]], _Rice -- Determination of the potential milling yield from paddy and from husked rice_
83
+ * [[[ISOGuide73, ISO Guide 73:2009]]], _Risk management -- Vocabulary_
84
+ --
85
+
86
+ [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`.)
88
+
89
+ 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
+
91
+ [source,asciidoc]
92
+ --
93
+ * [[[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_
94
+ --
95
+
96
+ If an ISO reference includes all parts of the standard, that is indicated by appending `(all parts)` after the reference anchor:
97
+
98
+ [source,asciidoc]
99
+ --
100
+ * [[[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
+ --
102
+
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
105
+
106
+ [source,asciidoc]
107
+ --
108
+ [bibliography]
109
+ == Bibliography
110
+
111
+ * [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
112
+ --
113
+
114
+ is displayed as:
115
+
116
+ [quote]
117
+ ____
118
+ *Bibliography*
119
+
120
+ [1] ISO 3696, _Water for analytical laboratory use -- Specification and test methods_
121
+ ____
122
+
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.
126
+
127
+ ==== Non-ISO References
128
+
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
+
146
+ ==== Cross-References
147
+
148
+ 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
+ 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
+
152
+ [source,asciidoctor]
153
+ --
154
+ <<ISO7301,clause=3.1-3.4>>
155
+
156
+ NOTE: This table is based on <<ISO7301,table=1>>.
157
+
158
+ Sampling shall be carried out in accordance with <<xxx,section="5-3-1,bis">>
159
+ --
160
+
161
+ 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
+ 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
+ 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
+
168
+ === Terms and Definitions
169
+
170
+ 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
+
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.
173
+
174
+ Terms and Definitions sections follow a strict grammar, which is reflected in their Asciidoc markup:
175
+
176
+ * 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
+ * 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.
178
+ * The definition of the term is given in a separate paragraph.
179
+ * The definition is optionally followed by examples (paragraphs with an `[example]` style attribute).
180
+ * The definition is then optionally followed by notes (denoted with a `NOTE:` prefix).
181
+ * The definition is then followed by a citation for the term, marked with a `[.source]` role attribute).
182
+ * The citation is a cross-reference to a normative reference, optionally followed by a comma and a modification if applicable.
183
+
184
+ For example,
185
+
186
+ [source,asciidoc]
187
+ --
188
+ [[paddy]]
189
+ === paddy
190
+ alt:[paddy rice]
191
+ alt:[rough rice]
192
+ deprecated:[cargo rice]
193
+ domain:[rice]
194
+
195
+ rice retaining its husk after threshing
196
+
197
+ [example]
198
+ Foreign seeds, husks, bran, sand, dust.
199
+
200
+ NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.
201
+
202
+ [.source]
203
+ <<ISO7301,section 3.2>>, The term "cargo rice" is shown as deprecated,
204
+ and Note 1 to entry is not included here
205
+ --
206
+
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]. By ISO convention, IEV references are not included in the bibliography, but for consistency and validation purposes, the IEV should be cited as a normal reference, with the term given as a clause, and the source should be named as IEV in the bibliography. The XML encoding of the document will include the IEV reference, substituting a canonical form of the reference in the bibliography; the output rendering of the document will drop the reference from the bibliography. For example:
208
+
209
+ [source,asciidoc]
210
+ --
211
+ [.source]
212
+ <<ievtermbank,clause="103-01-02">>
213
+ ....
214
+
215
+ [bibliography]
216
+ * [[[ievtermbank,IEV]]], _IEV: Electropedia_
217
+ // will be excluded from HTML and Word output. Will be replaced by a canonical reference in XML output.
218
+ --
219
+
220
+ 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.
221
+
222
+ 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.)
223
+
224
+ [source,asciidoc]
225
+ --
226
+ === stem:[t_90]
227
+ alt:[stem:[t_A]]
228
+
229
+ Time to launch.
230
+ --
231
+
232
+ However, the gem will treat any standalone paragraph in a term section, consisting of just a stem macro, as an admitted term:
233
+
234
+ [source,asciidoc]
235
+ --
236
+ === stem:[t_90]
237
+
238
+ stem:[t_A]
239
+
240
+ Time to launch.
241
+ --
242
+
243
+
244
+ === Symbols and Abbreviations
245
+
246
+ 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.
247
+
248
+ === Clauses
249
+
250
+ Blank subclause headings can be given as `=== {blank}`. These are used when you want to give a subclause number for a new subclause, but without an associated header text. So e.g. in the Rice Model document,
251
+
252
+ [source,asciidoc]
253
+ --
254
+ === Physical and chemical characteristics
255
+
256
+ ==== {blank}
257
+
258
+ The mass fraction of moisture, determined in accordance with...
259
+ --
260
+
261
+ renders as
262
+
263
+ ____
264
+ *4.2. Physical and chemical characteristics*
265
+
266
+ *4.2.1.* The mass fraction of moisture, determined in accordance with...
267
+ ____
268
+
269
+
270
+ 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,
271
+
272
+ [source,asciidoc]
273
+ --
274
+ [%inline-header]
275
+ ==== Sieve,
276
+
277
+ with round perforations of diameter 1,4 mm.
278
+ --
279
+
280
+ renders as
281
+
282
+ ____
283
+ *A.2.1.1. Sieve,* with round perforations of diameter 1,4 mm.
284
+ ____
285
+
286
+
287
+ Normative clauses are indicated with the attribute `[obligation=informative]`; they are normative by default.
288
+
289
+ === Annexes
290
+
291
+ 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]`).
292
+
293
+ 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":
294
+
295
+ [source,asciidoc]
296
+ --
297
+ [appendix]
298
+ == Annex A
299
+ Text
300
+
301
+ [%appendix]
302
+ === Appendix 1
303
+ Text
304
+ --
305
+
306
+ 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.
307
+
308
+ == Text markup
309
+
310
+ === Mathematical formatting
311
+
312
+ 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.)
313
+
314
+ === Formulae
315
+
316
+ Formulae are marked up as `[stem]` blocks. Any explanation of symbols in the formula is given as a "where" paragraph, followed by a definition list. For example:
317
+
318
+ [source,asciidoc]
319
+ --
320
+ [[formulaA-1]]
321
+ [stem]
322
+ ++++
323
+ w = (m_D) / (m_s)
324
+ ++++
325
+
326
+ where
327
+
328
+ stem:[w]:: is the mass fraction of grains with a particular defect in the test sample;
329
+ stem:[m_D]:: is the mass, in grams, of grains with that defect;
330
+ stem:[m_S]:: is the mass, in grams, of the test sample.
331
+ --
332
+
333
+ === Figures
334
+
335
+ Like formulae, figures can be followed by a definition list for the variables used in the figure; the definition list is preceded by `+*Key*+`. For example:
336
+
337
+ [source,asciidoc]
338
+ --
339
+ [[figureC-1]]
340
+ .Typical gelatinization curve
341
+ image::rice_images/rice_image2.png[]
342
+ footnote:[The time stem:[t_90] was estimated to be 18,2 min for this example.]
343
+
344
+ *Key*
345
+
346
+ stem:[w]:: mass fraction of gelatinized kernels, expressed in per cent
347
+ stem:[t]:: cooking time, expressed in minutes
348
+ stem:[t_90]:: time required to gelatinize 90 % of the kernels
349
+ P:: point of the curve corresponding to a cooking time of stem:[t_90]
350
+
351
+ NOTE: These results are based on a study carried out on three different types of kernel.
352
+ --
353
+
354
+ Subfigures are entered by including images in an Asciidoc example:
355
+
356
+ [source,asciidoc]
357
+ --
358
+ [[figureC-2]]
359
+ .Stages of gelatinization
360
+ ====
361
+ .Initial stages: No grains are fully gelatinized (ungelatinized starch granules are visible inside the kernels)
362
+ image::rice_images/rice_image3_1.png[]
363
+
364
+ .Intermediate stages: Some fully gelatinized kernels are visible
365
+ image::rice_images/rice_image3_2.png[]
366
+
367
+ .Final stages: All kernels are fully gelatinized
368
+ image::rice_images/rice_image3_3.png[]
369
+
370
+ ====
371
+ --
372
+
373
+ === Tables
374
+
375
+ 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.
376
+
377
+ 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.
378
+
379
+ === Lists
380
+
381
+ 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.
382
+
383
+ === Footnotes
384
+
385
+ 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).
386
+
387
+ === Notes
388
+
389
+ Notes that are not at the end of a clause are folded into the preceding block, if that block is not delimited (so that the user could not choose to include or exclude a note): that is, notes are folded into a preceding paragraph, list, formula, or figure.
390
+
391
+ === Reviewer Notes
392
+
393
+ 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/asciidoctor-iso#reviewer-notes[discussion in the README].
394
+
395
+ == Cross-references
396
+
397
+ 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.
398
+
399
+ 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)".
400
+
401
+ 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.)
402
+
403
+ List items can be cross-referenced by inserting a bookmark at the very start of the list item:
404
+
405
+ [source,asciidoc]
406
+ --
407
+ . Ordered list
408
+ .. [[id]] This is the first list item
409
+ ... [[id]] This is a list sub-item
410
+ --
411
+
412
+ == Asciidoctor Tips
413
+
414
+ 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.
415
+
416
+ * 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]:
417
+
418
+ [source,asciidoc]
419
+ --
420
+ [NOTE]
421
+ ====
422
+ This is a multi-paragraph note.
423
+
424
+ It includes:
425
+
426
+ * A list
427
+
428
+ |===
429
+ | And
430
+
431
+ | a table
432
+ |===
433
+ ====
434
+ --
435
+
436
+ * https://asciidoctor.org/docs/user-manual/#using-attributes-set-assign-and-reference[Attribute references] can be used as template variables in a document: if your document contains the text `{foo}`, you can assign the value to be populated in `{foo}` by setting it as a document attribute in the Asciidoctor header: `:foo: this is the text to replace "foo"`. In the Rice Model document example, document attributes are used to provide the Subcommittee and Technical Committee names, which are populated as template entries in the document foreword.