metanorma-standoc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +4 -0
  3. data/.gitignore +11 -0
  4. data/.hound.yml +3 -0
  5. data/.oss-guides.rubocop.yml +1077 -0
  6. data/.rubocop.ribose.yml +66 -0
  7. data/.rubocop.tb.yml +650 -0
  8. data/.rubocop.yml +15 -0
  9. data/.travis.yml +21 -0
  10. data/CODE_OF_CONDUCT.md +46 -0
  11. data/Gemfile +7 -0
  12. data/LICENSE +25 -0
  13. data/Makefile +39 -0
  14. data/README.adoc +9 -0
  15. data/Rakefile +6 -0
  16. data/bin/rspec +18 -0
  17. data/docs/customisation.adoc +178 -0
  18. data/docs/guidance.adoc +436 -0
  19. data/docs/htmloutput.adoc +115 -0
  20. data/docs/quickstart.adoc +375 -0
  21. data/lib/asciidoctor/standoc/base.rb +198 -0
  22. data/lib/asciidoctor/standoc/biblio.rng +836 -0
  23. data/lib/asciidoctor/standoc/blocks.rb +190 -0
  24. data/lib/asciidoctor/standoc/cleanup.rb +247 -0
  25. data/lib/asciidoctor/standoc/cleanup_block.rb +193 -0
  26. data/lib/asciidoctor/standoc/cleanup_footnotes.rb +78 -0
  27. data/lib/asciidoctor/standoc/cleanup_ref.rb +125 -0
  28. data/lib/asciidoctor/standoc/converter.rb +55 -0
  29. data/lib/asciidoctor/standoc/front.rb +121 -0
  30. data/lib/asciidoctor/standoc/inline.rb +134 -0
  31. data/lib/asciidoctor/standoc/isodoc.rng +1059 -0
  32. data/lib/asciidoctor/standoc/lists.rb +87 -0
  33. data/lib/asciidoctor/standoc/macros.rb +95 -0
  34. data/lib/asciidoctor/standoc/ref.rb +187 -0
  35. data/lib/asciidoctor/standoc/section.rb +159 -0
  36. data/lib/asciidoctor/standoc/table.rb +61 -0
  37. data/lib/asciidoctor/standoc/utils.rb +121 -0
  38. data/lib/asciidoctor/standoc/validate.rb +65 -0
  39. data/lib/asciidoctor/standoc/validate_section.rb +42 -0
  40. data/lib/asciidoctor/standoc/version.rb +5 -0
  41. data/lib/metanorma-standoc.rb +9 -0
  42. data/lib/metanorma/standoc.rb +7 -0
  43. data/lib/metanorma/standoc/processor.rb +40 -0
  44. data/metanorma-standoc.gemspec +47 -0
  45. data/spec/asciidoctor-standoc/base_spec.rb +271 -0
  46. data/spec/asciidoctor-standoc/blocks_spec.rb +469 -0
  47. data/spec/asciidoctor-standoc/cleanup_spec.rb +760 -0
  48. data/spec/asciidoctor-standoc/inline_spec.rb +162 -0
  49. data/spec/asciidoctor-standoc/isobib_cache_spec.rb +332 -0
  50. data/spec/asciidoctor-standoc/lists_spec.rb +190 -0
  51. data/spec/asciidoctor-standoc/macros_spec.rb +111 -0
  52. data/spec/asciidoctor-standoc/refs_spec.rb +606 -0
  53. data/spec/asciidoctor-standoc/section_spec.rb +310 -0
  54. data/spec/asciidoctor-standoc/table_spec.rb +307 -0
  55. data/spec/asciidoctor-standoc/validate_spec.rb +133 -0
  56. data/spec/assets/header.html +7 -0
  57. data/spec/assets/html.css +2 -0
  58. data/spec/assets/htmlcover.html +4 -0
  59. data/spec/assets/htmlintro.html +5 -0
  60. data/spec/assets/i18n.yaml +2 -0
  61. data/spec/assets/iso.headless.html +33 -0
  62. data/spec/assets/iso.xml +8 -0
  63. data/spec/assets/rice_image1.png +0 -0
  64. data/spec/assets/scripts.html +3 -0
  65. data/spec/assets/std.css +2 -0
  66. data/spec/assets/word.css +2 -0
  67. data/spec/assets/wordcover.html +3 -0
  68. data/spec/assets/wordintro.html +4 -0
  69. data/spec/examples/103_01_02.html +247 -0
  70. data/spec/examples/english.yaml +69 -0
  71. data/spec/examples/iso_123_.xml +45 -0
  72. data/spec/examples/iso_123_all_parts.xml +45 -0
  73. data/spec/examples/iso_123_no_year_note.xml +46 -0
  74. data/spec/examples/iso_124_.xml +41 -0
  75. data/spec/examples/iso_216_.xml +47 -0
  76. data/spec/examples/iso_iec_12382_.xml +48 -0
  77. data/spec/examples/rice.adoc +715 -0
  78. data/spec/examples/rice.preview.html +1877 -0
  79. data/spec/examples/rice.sh +4 -0
  80. data/spec/examples/rice_images/rice_image1.png +0 -0
  81. data/spec/examples/rice_images/rice_image2.png +0 -0
  82. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  83. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  84. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  85. data/spec/metanorma/processor_spec.rb +70 -0
  86. data/spec/spec_helper.rb +198 -0
  87. metadata +370 -0
@@ -0,0 +1,115 @@
1
+ = HTML and Word HTML Output
2
+
3
+ In order to create CSS stylesheets for the HTML and Word HTML output of the Metanorma tool, it is necessary to understand the structure of the HTML it generates.
4
+
5
+ == HTML
6
+
7
+ === Top-Level Structure
8
+
9
+ The `head` of the HTML document contains a single stylesheet (the `:htmlstylesheet` parameter of `HtmlConvert.new()`), and some brief script calls that are embedded in the Ruby code (initialising jQuery, including webfonts).
10
+
11
+ The `body` of the HTML document is divided into the following parts:
12
+
13
+ * A title section (`<div class="title-section">`), comprising identifying information about the document, such as appears in a title page in print.
14
+ ** The section is populated with an HTML template (the `:htmlcoverpage` parameter of `HtmlConvert.new()`). The information in this section is sourced from document metadata, rather than document content proper; the gem uses http://liquidmarkup.org[Liquid Template] to populate the HTML template. Different fields usually have distinct class names for CSS styling; these can vary by gem.
15
+ ** For example, ISO documents have `coverpage_docnumber` (for the document ID), `coverpage_techcommittee` (for the technical committee responsible for the document), `doctitle-en` (for the English-language title of the document), `doctitle-fr` (for the French title), `title, subtitle, part` (for the three components of the document title), and `coverpage_docstage` (for the stage of publication of the document).
16
+ * A prefatory section (`<div class="prefatory-section">`), comprising boilerplate information which also does not come from document content proper. This is typically restricted to a copyright statement (`<div class="copyright">`), contact details, and a table of contents `<div id="toc">`.
17
+ ** The section is also populated with a Liquid HTML template (the `:htmlintropage` parameter of `HtmlConvert.new()`).
18
+ ** The table of contents in the HTML template is a placeholder; it is populated by a table of contents script included among the scripts loaded into the HTML body.
19
+ * The main section of the document (`<main class="main-section">`), which is populated with the document content.
20
+ * Optionally, a colophon (`<div class="colophon">`), which is populated with boilerplate information and/or document metadata. (Currently colophons in Metanorma gems appear only in Word output.)
21
+ * Scripts. These are populated from a static file (the `:scripts` parameter of `HtmlConvert.new()`). These are expected to include https://www.mathjax.org[MathJax], a Table of Contents generator, and a script for handling footnotes.
22
+
23
+ === Body markup
24
+
25
+ Within the body of the document, different blocks and inline spans of the Metanorma document model (https://github.com/riboseinc/metanorma-model-standoc[Standoc XML], https://github.com/riboseinc/basicdoc-models[BasicDoc XML]) are represented by different CSS classes, as follows:
26
+
27
+ ==== Sections
28
+
29
+ Symbols and abbreviated terms:: `<div class="Symbols">` (contents are a definition list)
30
+ Appendix title:: `<h1 class="Annex">`
31
+ Appendix, Bibliography, Introduction:: `<div class="Section3">`
32
+ Introduction title:: `<h1 class="IntroTitle">`
33
+ Foreword title:: `<h1 class="ForewordTitle">`
34
+ Deprecated term:: `<p class="DeprecatedTerms">`
35
+ Alternative term:: `<p class="AltTerms">`
36
+ Primary term:: `<p class="Terms">`
37
+ Term header:: `<p class="TermNum">`
38
+ Document title (in body):: `<p class="zzSTDTitle1">`
39
+
40
+ ==== Blocks
41
+
42
+ Note:: `<div class="Note">`
43
+ Note label:: `<span class="note_label">`
44
+ Figure:: `<div class="figure">`
45
+ Figure title:: `<span class="FigureTitle">`
46
+ Example:: `<table class="example">` or `<div class="example">`
47
+ Example label:: `<span class="example_label">`
48
+ Sourcecode:: `<p class="Sourcecode">`
49
+ Admonition:: `<div class="Admonition">`
50
+ Formula:: `<div class="formula">`
51
+ Blockquote:: `<div class="Quote">`
52
+ Blockquote attribution:: `<p class="QuoteAttribution">`
53
+ Footnote:: `<aside class="footnote">`
54
+ Ordered list:: `<ol>`
55
+ Unordered list:: `<ul>`
56
+ Definition list:: `<dl>`
57
+ Normative reference:: `<p class="NormRef">`
58
+ Informative reference:: `<p class="Biblio">`
59
+ Table:: `<table>`
60
+ Table title:: `<p class="TableTitle">`
61
+ Table head:: `<thead>`
62
+ Table body:: `<tbody>`
63
+ Table foot:: `<tfoot>`
64
+
65
+ ==== Inline
66
+
67
+ Hyperlink:: `<a>`
68
+ Cross-Reference:: `<a>`
69
+ Stem expression:: `<span class="stem">`
70
+ Small caps:: `<span style="font-variant:small-caps;">`
71
+ Emphasis:: `<i>`
72
+ Strong:: `<b>`
73
+ Superscript:: `<sup>`
74
+ Subscript:: `<sub>`
75
+ Monospace:: `<tt>`
76
+ Strikethrough:: `<s>`
77
+ Line Break:: `<br>`
78
+ Horizontal Rule:: `<hr>`
79
+ Page Break:: `<br>` (realised as page break in Word HTML)
80
+
81
+
82
+ == Word HTML
83
+
84
+ === Word HTML and Word HTML CSS
85
+
86
+ The Word HTML documented here is what is used by the gems to generate DOC output. For more on why Word HTML is used, instead of OOXML or HTML 5 embedded into DOCX, see https://github.com/riboseinc/html2doc/wiki/Why-not-docx%3F
87
+
88
+ Word HTML, and the Word HTML version of CSS, are restricted compared to the HTML and CSS you are likely familiar with. Word HTML is a subset of HTML 4; Word HTML CSS has a weakened set of selectors, and a range of Microsoft-specific extensions (prefixed with `@` or `mso-`). The weakened set of selectors means you cannot assume that classes are inherited by their children; normal CSS would apply formatting on a `div` class to its child paragraphs, but Word HTML would expect you to repeat that class definition for `p`.
89
+
90
+ Some of the necessary caveats are listed in https://github.com/riboseinc/html2doc/blob/master/README.adoc. The styling of lists in particular is quite different to normal CSS, and requires a Word-specific selector to define list styles (the `:ulstyle ` and `:olstyle ` parameter of `WordConvert.new()`).
91
+
92
+ Word HTML and CSS is not well-documented (even though there is a 1500 page manual from Microsoft); fortunately saving Word documents to HTML will reveal the Word HTML and Word HTML CSS that can be used to generate the same formatting. The stylesheets need to follow the conventions of Word HTML, and should be formulated by saving Word documents as HTML, and extracting their CSS stylesheets. Note that the CSS is prefixed with a set of font definitions; these too should be obtained by saving Word documents as HTML.
93
+
94
+ === Top-Level Structure
95
+
96
+ The headers and footers of a Word document are defined in Word HTML in a separate file, `header.html` (the `:header` parameter of `WordConvert.new()`), which is included in the file manifest for the document. The header.html file is cross-referenced to the Word HTML CSS file, and contains a separate `div` for each header and footer type; refer to the instances in the gems for illustration.
97
+
98
+ The `head` of the Word HTML document contains two stylesheets (the `:wordstylesheet` and `:standardsheet` parameter of `WordConvert.new()`). The `:wordstylesheet` is intended as generic Word markup, while `:standardsheet` is intended to contain styling specific to the standard. No scripts are supported in Word HTML.
99
+
100
+ The other elements of the Word HTML head are populated by the https://github.com/riboseinc/html2doc[html2doc gem]: a reference to a manifest of included files (specifically images and the header file), and settings to open the document in Print View at 100% magnification.
101
+
102
+ The `body` of the Word HTML document is divided into the following parts:
103
+
104
+ * A title section (`<div class="WordSection1">`), comprising identifying information about the document, such as appears in a title page in print.
105
+ ** The section is populated with an HTML template (the `:wordcoverpage` parameter of `WordConvert.new()`). As with HTML, the information in this section is sourced from document metadata, rather than document content proper; and the gem uses http://liquidmarkup.org[Liquid Template] to populate the HTML template.
106
+ * A prefatory section (`<div class="WordSection2">`), comprising boilerplate information which does not come from document content proper (such as a Table of Contents shell), as well as prefatory material from the document content. The prefatory section is set in the CSS stylesheet to have Roman numerals for its pagination.
107
+ ** Because of the requirement for Roman numerals, prefatory material from the document is sent to this section, whereas all document content in the HTML document is sent to the main section.
108
+ * The main section of the document (`<div class="WordSection3">`), which is populated with the remaining document content. The main section is set in the CSS stylesheet to have Arabic numerals for its pagination.
109
+ * Optionally, a colophon (`<div class="colophon">`), which is populated with boilerplate information and/or document metadata.
110
+
111
+ === Body markup
112
+
113
+ With the exception of the top-level document sections, discussed above, the Word HTML generated by the gem use the same CSS classes as the HTML proper. As already noted, the quirks of Word HTML CSS mean that classes need to be repeated on descendant elements that are not required in normal CSS.
114
+
115
+ The handling of footnotes and comments in Word HTML uses idiosyncratic Word HTML markup, including custom CSS, and is generated separately their the HTML counterparts in the gems.
@@ -0,0 +1,375 @@
1
+ = Quickstart Guide for AsciiISO
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.
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`).
8
+
9
+
10
+ == Even quicker summary
11
+
12
+ In order to start a new ISO document, or migrate your document from Word:
13
+
14
+ . Install <<installation>>
15
+ . Clone the https://github.com/riboseinc/isodoc-rice/[AsciiISO Rice]
16
+
17
+ To migrate:
18
+
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).
20
+ . Move the content back to the cloned isodoc-rice.
21
+
22
+
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
+
32
+ You can install the Asciidoctor-ISO gem, and all its dependencies, through the Ruby gem installer:
33
+
34
+ [source,console]
35
+ --
36
+ gem install asciidoctor-iso
37
+ --
38
+
39
+ If you want the latest version of the gem (which is still heavily under development), you can install it from Github:
40
+
41
+ [source,console]
42
+ --
43
+ git clone https://github.com/riboseinc/asciidoctor-iso.git
44
+ cd asciidoctor-iso
45
+ gem build *.gemspec
46
+ gem install *.gem
47
+ --
48
+
49
+ == How to set up a new project
50
+
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
+
53
+ [source,console]
54
+ --
55
+ mkdir new_standard
56
+ cd new_standard
57
+ vi new_standard.adoc
58
+ --
59
+
60
+ To compile the document, execute the `asciidoctor` script, flagging it to use the ISO variant:
61
+
62
+ [source,console]
63
+ --
64
+ asciidoctor --trace -b iso -r 'asciidoctor-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/asciidoctor-iso/wiki/Guidance-for-authoring[Guidance for Authoring in Asciidoctor-ISO] and the https://github.com/riboseinc/asciidoctor-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/asciidoctor-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.
216
+ --
217
+
218
+ * https://asciidoctor.org/docs/user-manual/#prose-excerpts-quotes-and-verses[Block quotes]
219
+
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
+ --
227
+
228
+
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]
231
+
232
+ [source,asciidoctor]
233
+ ----
234
+ .Sample Code
235
+ ====
236
+
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
+
248
+ * https://asciidoctor.org/docs/user-manual/#comments[Comments] (which are *not* rendered in the output)
249
+
250
+ [source,ruby]
251
+ --
252
+ // all terms and defs references are dated
253
+ --
254
+
255
+ === Sections
256
+
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.)
258
+
259
+ [source,asciidoctor]
260
+ --
261
+ [[foreword]]
262
+ .Foreword
263
+ ISO (the International Organization for Standardization)
264
+ --
265
+
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
+
268
+ [source,asciidoctor]
269
+ --
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
+
280
+ --
281
+
282
+
283
+ == Asciidoctor-ISO specific syntax
284
+
285
+ Full details of Asciidoctor-ISO–specific markup and conventions is given in the https://github.com/riboseinc/asciidoctor-iso/blob/master/README.adoc[Asciidoctor-ISO Readme] and the https://github.com/riboseinc/asciidoctor-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_
295
+ --
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]
304
+ --
305
+ [[paddy]]
306
+ === paddy
307
+ alt:[paddy rice]
308
+ alt:[rough rice]
309
+ deprecated:[cargo rice]
310
+ domain:[rice]
311
+
312
+ rice retaining its husk after threshing
313
+
314
+ [example]
315
+ Foreign seeds, husks, bran, sand, dust.
316
+
317
+ NOTE: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.
318
+
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
+ --
323
+
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 by ISO convention will be left out of the output rendering of ISO standards.
325
+
326
+ === References (Normative, Informative)
327
+
328
+ 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.
329
+
330
+ 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.
331
+
332
+ [source,asciidoctor]
333
+ --
334
+ Grade 3 quality as specified in <<ISO3696>>.
335
+
336
+ ...
337
+
338
+ * [[[ISO3696,ISO 3696]]], _Water for analytical laboratory use -- Specification and test methods_
339
+ * [[[ISO7301,ISO 7301:2011]]], _Rice -- Specification_
340
+ * [[[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_
341
+ --
342
+
343
+ 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.
344
+
345
+ [source,asciidoctor]
346
+ --
347
+ For details concerning the use of the Dumas method, see References <<ref10>> and <<ref16>>.
348
+
349
+ ...
350
+
351
+ * [[[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)
352
+
353
+ * [[[ref16,16]]] [smallcap]#Tkachuk R.# Nitrogen-to-protein conversion factors for cereals and oilseed meals. _Cereal Chem._ 1969, *46* (4) pp 419-423
354
+ --
355
+
356
+ 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:
357
+
358
+ [source,asciidoctor]
359
+ --
360
+ <<ISO7301,clause=3.1>>
361
+
362
+ NOTE: This table is based on <<ISO7301,table=1>>.
363
+
364
+ Sampling shall be carried out in accordance with <<ISO24333,clause=5>>
365
+ --
366
+
367
+ 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_.
368
+
369
+
370
+ === Annexes
371
+
372
+ 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]`).
373
+
374
+ The numbering of annexes and appendices is automatic: do not insert "Annex A" or "Appendix 1" as part of the title.
375
+