metanorma-iso 1.3.21 → 1.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +8 -7
  3. data/.github/workflows/ubuntu.yml +8 -7
  4. data/.github/workflows/windows.yml +8 -8
  5. data/Gemfile +2 -0
  6. data/lib/asciidoctor/iso/base.rb +22 -0
  7. data/lib/asciidoctor/iso/biblio.rng +142 -37
  8. data/lib/asciidoctor/iso/cleanup.rb +19 -2
  9. data/lib/asciidoctor/iso/front.rb +19 -72
  10. data/lib/asciidoctor/iso/front_id.rb +196 -0
  11. data/lib/asciidoctor/iso/isodoc.rng +48 -2
  12. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  13. data/lib/asciidoctor/iso/isostandard.rng +17 -1
  14. data/lib/asciidoctor/iso/macros.rb +21 -0
  15. data/lib/asciidoctor/iso/section.rb +18 -32
  16. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  17. data/lib/asciidoctor/iso/validate.rb +41 -21
  18. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  19. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  20. data/lib/asciidoctor/iso/validate_style.rb +7 -6
  21. data/lib/isodoc/iso/base_convert.rb +48 -64
  22. data/lib/isodoc/iso/html/header.html +10 -6
  23. data/lib/isodoc/iso/html/html_iso_titlepage.html +27 -18
  24. data/lib/isodoc/iso/html/isodoc.scss +49 -28
  25. data/lib/isodoc/iso/html/scripts.html +23 -21
  26. data/lib/isodoc/iso/html/style-human.scss +25 -2
  27. data/lib/isodoc/iso/html/style-iso.scss +20 -2
  28. data/lib/isodoc/iso/html/word_iso_titlepage.html +23 -2
  29. data/lib/isodoc/iso/html/wordstyle.scss +80 -39
  30. data/lib/isodoc/iso/html_convert.rb +7 -9
  31. data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
  32. data/lib/isodoc/iso/iso.international-standard.xsl +4597 -0
  33. data/lib/isodoc/iso/metadata.rb +74 -44
  34. data/lib/isodoc/iso/pdf_convert.rb +39 -0
  35. data/lib/isodoc/iso/sections.rb +66 -0
  36. data/lib/isodoc/iso/sts_convert.rb +29 -0
  37. data/lib/metanorma-iso.rb +2 -0
  38. data/lib/metanorma/iso/processor.rb +16 -1
  39. data/lib/metanorma/iso/version.rb +1 -1
  40. data/metanorma-iso.gemspec +4 -1
  41. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  42. data/spec/asciidoctor-iso/base_spec.rb +43 -21
  43. data/spec/asciidoctor-iso/blocks_spec.rb +21 -9
  44. data/spec/asciidoctor-iso/cleanup_spec.rb +203 -175
  45. data/spec/asciidoctor-iso/inline_spec.rb +2 -1
  46. data/spec/asciidoctor-iso/macros_spec.rb +275 -0
  47. data/spec/asciidoctor-iso/refs_spec.rb +7 -4
  48. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  49. data/spec/assets/iso.xml +64 -1
  50. data/spec/isodoc/amd_spec.rb +606 -0
  51. data/spec/isodoc/i18n_spec.rb +12 -20
  52. data/spec/isodoc/inline_spec.rb +2 -2
  53. data/spec/isodoc/iso_spec.rb +1 -1
  54. data/spec/isodoc/metadata_spec.rb +12 -4
  55. data/spec/isodoc/postproc_spec.rb +20 -119
  56. data/spec/isodoc/ref_spec.rb +5 -5
  57. data/spec/isodoc/section_spec.rb +36 -13
  58. data/spec/isodoc/table_spec.rb +22 -22
  59. data/spec/isodoc/terms_spec.rb +2 -2
  60. data/spec/isodoc/xref_spec.rb +19 -19
  61. data/spec/metanorma/processor_spec.rb +2 -2
  62. data/spec/spec_helper.rb +13 -1
  63. metadata +57 -5
  64. data/asciidoctor-iso.gemspec.old +0 -50
@@ -127,7 +127,7 @@ RSpec.describe Asciidoctor::ISO do
127
127
  #{BLANK_HDR}
128
128
  <sections>
129
129
 
130
- </sections><bibliography><references id="_" obligation="informative">
130
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
131
131
  <title>Normative References</title>
132
132
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
133
133
  <bibitem id="ISO712">
@@ -137,6 +137,7 @@ RSpec.describe Asciidoctor::ISO do
137
137
  <bibitem id="ISO713">
138
138
  <formattedref format="application/x-isodoc+xml">Reference</formattedref>
139
139
  <docidentifier>ISO713</docidentifier>
140
+ <docnumber>713</docnumber>
140
141
  </bibitem>
141
142
  </references>
142
143
  </bibliography>
@@ -18,4 +18,279 @@ RSpec.describe Asciidoctor::ISO do
18
18
  OUTPUT
19
19
  end
20
20
 
21
+ describe 'term inline macros' do
22
+ subject(:convert) do
23
+ xmlpp(
24
+ strip_guid(
25
+ Asciidoctor.convert(
26
+ input, backend: :iso, header_footer: true)))
27
+ end
28
+ let(:input) do
29
+ <<~XML
30
+ #{ASCIIDOC_BLANK_HDR}
31
+ == Terms and Definitions
32
+
33
+ === name2
34
+
35
+ == Main
36
+
37
+ term:[name,name2] is a term
38
+ XML
39
+ end
40
+ let(:output) do
41
+ <<~XML
42
+ #{BLANK_HDR}
43
+ <sections>
44
+ <terms id='_' obligation='normative'>
45
+ <title>Terms and definitions</title>
46
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
47
+ <p id='_'>
48
+ ISO and IEC maintain terminological databases for use in standardization
49
+ at the following addresses:
50
+ </p>
51
+ <ul id='_'>
52
+ <li>
53
+ <p id='_'>
54
+ ISO Online browsing platform: available at
55
+ <link target='http://www.iso.org/obp'/>
56
+ </p>
57
+ </li>
58
+ <li>
59
+ <p id='_'>
60
+ IEC Electropedia: available at
61
+ <link target='http://www.electropedia.org'/>
62
+ </p>
63
+ </li>
64
+ </ul>
65
+ <term id='term-name2'>
66
+ <preferred>name2</preferred>
67
+ </term>
68
+ </terms>
69
+ <clause id='_' inline-header='false' obligation='normative'>
70
+ <title>Main</title>
71
+ <p id='_'>
72
+ <em>name</em>
73
+ (
74
+ <xref target='term-name2'/>
75
+ ) is a term
76
+ </p>
77
+ </clause>
78
+ </sections>
79
+ </iso-standard>
80
+ XML
81
+ end
82
+
83
+ it 'converts macro into the correct xml' do
84
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
85
+ end
86
+
87
+ context 'default params' do
88
+ let(:input) do
89
+ <<~XML
90
+ #{ASCIIDOC_BLANK_HDR}
91
+
92
+ == Terms and Definitions
93
+
94
+ === name
95
+
96
+ == Main
97
+
98
+ term:[name] is a term
99
+ XML
100
+ end
101
+ let(:output) do
102
+ <<~XML
103
+ #{BLANK_HDR}
104
+ <sections>
105
+ <terms id='_' obligation='normative'>
106
+ <title>Terms and definitions</title>
107
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
108
+ <p id='_'>
109
+ ISO and IEC maintain terminological databases for use in standardization
110
+ at the following addresses:
111
+ </p>
112
+ <ul id='_'>
113
+ <li>
114
+ <p id='_'>
115
+ ISO Online browsing platform: available at
116
+ <link target='http://www.iso.org/obp' />
117
+ </p>
118
+ </li>
119
+ <li>
120
+ <p id='_'>
121
+ IEC Electropedia: available at
122
+ <link target='http://www.electropedia.org' />
123
+ </p>
124
+ </li>
125
+ </ul>
126
+ <term id='term-name'>
127
+ <preferred>name</preferred>
128
+ </term>
129
+ </terms>
130
+ <clause id='_' inline-header='false' obligation='normative'>
131
+ <title>Main</title>
132
+ <p id='_'>
133
+ <em>name</em>
134
+ (
135
+ <xref target='term-name' />
136
+ ) is a term
137
+ </p>
138
+ </clause>
139
+ </sections>
140
+ </iso-standard>
141
+ XML
142
+ end
143
+
144
+ it 'uses `name` as termref name' do
145
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
146
+ end
147
+ end
148
+
149
+ context 'multiply exising ids in document' do
150
+ let(:input) do
151
+ <<~XML
152
+ #{ASCIIDOC_BLANK_HDR}
153
+
154
+ == Terms and Definitions
155
+
156
+ === name
157
+ === name2
158
+
159
+ [[term-name]]
160
+ == Main
161
+
162
+ paragraph
163
+
164
+ [[term-name2]]
165
+ == Second
166
+
167
+ term:[name] is a term
168
+ term:[name2] is a term
169
+ XML
170
+ end
171
+ let(:output) do
172
+ <<~XML
173
+ #{BLANK_HDR}
174
+ <sections>
175
+ <terms id='_' obligation='normative'>
176
+ <title>Terms and definitions</title>
177
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
178
+ <p id='_'>
179
+ ISO and IEC maintain terminological databases for use in standardization
180
+ at the following addresses:
181
+ </p>
182
+ <ul id='_'>
183
+ <li>
184
+ <p id='_'>
185
+ ISO Online browsing platform: available at
186
+ <link target='http://www.iso.org/obp' />
187
+ </p>
188
+ </li>
189
+ <li>
190
+ <p id='_'>
191
+ IEC Electropedia: available at
192
+ <link target='http://www.electropedia.org' />
193
+ </p>
194
+ </li>
195
+ </ul>
196
+ <term id='term-name-1'>
197
+ <preferred>name</preferred>
198
+ </term>
199
+ <term id='term-name2-1'>
200
+ <preferred>name2</preferred>
201
+ </term>
202
+ </terms>
203
+ <clause id='term-name' inline-header='false' obligation='normative'>
204
+ <title>Main</title>
205
+ <p id='_'>paragraph</p>
206
+ </clause>
207
+ <clause id='term-name2' inline-header='false' obligation='normative'>
208
+ <title>Second</title>
209
+ <p id='_'>
210
+ <em>name</em>
211
+ (
212
+ <xref target='term-name-1' />
213
+ ) is a term
214
+ <em>name2</em>
215
+ (
216
+ <xref target='term-name2-1' />
217
+ ) is a term
218
+ </p>
219
+ </clause>
220
+ </sections>
221
+ </iso-standard>
222
+ XML
223
+ end
224
+
225
+ it 'generates unique ids which dont match existing ids' do
226
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
227
+ end
228
+ end
229
+
230
+ context 'when missing actual ref' do
231
+ let(:input) do
232
+ <<~XML
233
+ #{ASCIIDOC_BLANK_HDR}
234
+
235
+ == Terms and Definitions
236
+
237
+ === name
238
+
239
+ paragraph
240
+
241
+ term:[name] is a term
242
+
243
+ Moreover, term:[missing] is a term
244
+ XML
245
+ end
246
+ let(:output) do
247
+ <<~XML
248
+ #{BLANK_HDR}
249
+ <sections>
250
+ <terms id='_' obligation='normative'>
251
+ <title>Terms and definitions</title>
252
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
253
+ <p id='_'>
254
+ ISO and IEC maintain terminological databases for use in standardization
255
+ at the following addresses:
256
+ </p>
257
+ <ul id='_'>
258
+ <li>
259
+ <p id='_'>
260
+ ISO Online browsing platform: available at
261
+ <link target='http://www.iso.org/obp'/>
262
+ </p>
263
+ </li>
264
+ <li>
265
+ <p id='_'>
266
+ IEC Electropedia: available at
267
+ <link target='http://www.electropedia.org'/>
268
+ </p>
269
+ </li>
270
+ </ul>
271
+ <term id='term-name'>
272
+ <preferred>name</preferred>
273
+ <definition>
274
+ <p id='_'>paragraph</p>
275
+ <p id='_'>
276
+ <em>name</em>
277
+ (
278
+ <xref target='term-name'/>
279
+ ) is a term
280
+ </p>
281
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
282
+ </p>
283
+ </definition>
284
+ </term>
285
+ </terms>
286
+ </sections>
287
+ </iso-standard>
288
+ XML
289
+ end
290
+
291
+ it 'generates unique ids which dont match existing ids' do
292
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
293
+ end
294
+ end
295
+ end
21
296
  end
@@ -15,12 +15,13 @@ RSpec.describe Asciidoctor::ISO do
15
15
  INPUT
16
16
  #{BLANK_HDR}
17
17
  <sections>
18
- </sections><bibliography><references id="_" obligation="informative">
18
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
19
19
  <title>Normative References</title>
20
20
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
21
21
  <bibitem id="iso123" type="standard">
22
22
  <title format="text/plain">Standard</title>
23
23
  <docidentifier>ISO 123:—</docidentifier>
24
+ <docnumber>123</docnumber>
24
25
  <date type="published">
25
26
  <on>–</on>
26
27
  </date>
@@ -63,12 +64,13 @@ RSpec.describe Asciidoctor::ISO do
63
64
  </p>
64
65
  </clause>
65
66
  </sections>
66
- <bibliography><references id="_" obligation="informative">
67
+ <bibliography><references id="_" obligation="informative" normative="true">
67
68
  <title>Normative References</title>
68
69
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
69
70
  <bibitem id="iso123" type="standard">
70
71
  <title format="text/plain">Standard</title>
71
72
  <docidentifier>ISO 123:1066 (all parts)</docidentifier>
73
+ <docnumber>123</docnumber>
72
74
  <date type="published">
73
75
  <on>1066</on>
74
76
  </date>
@@ -98,7 +100,7 @@ RSpec.describe Asciidoctor::ISO do
98
100
  #{BLANK_HDR}
99
101
  <sections>
100
102
 
101
- </sections><bibliography><references id="_" obligation="informative">
103
+ </sections><bibliography><references id="_" obligation="informative" normative="true">
102
104
  <title>Normative References</title>
103
105
  <p id="_">The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
104
106
  <bibitem id="iso123">
@@ -106,6 +108,7 @@ RSpec.describe Asciidoctor::ISO do
106
108
  <em>Standard</em>
107
109
  </formattedref>
108
110
  <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
111
+ <docnumber>123:1066 (all parts)</docnumber>
109
112
  </bibitem>
110
113
  </references>
111
114
  </bibliography>
@@ -124,7 +127,7 @@ RSpec.describe Asciidoctor::ISO do
124
127
  #{BLANK_HDR}
125
128
  <sections>
126
129
 
127
- </sections><bibliography><references id="_" obligation="informative">
130
+ </sections><bibliography><references id="_" obligation="informative" normative="false">
128
131
  <title>Bibliography</title>
129
132
  <bibitem id="iso123">
130
133
  <formattedref format="application/x-isodoc+xml">
@@ -84,7 +84,7 @@ standardization at the following addresses:

84
84
  <link target="http://www.electropedia.org"/>
85
85
  </p> </li> </ul>
86
86
 
87
- <term id="_">
87
+ <term id="term-term1">
88
88
  <preferred>Term1</preferred>
89
89
  </term>
90
90
  </terms>
@@ -109,7 +109,7 @@ standardization at the following addresses:

109
109
  </li>
110
110
  </ul>
111
111
  <title>Normal Terms</title>
112
- <term id="_">
112
+ <term id="term-term2">
113
113
  <preferred>Term2</preferred>
114
114
  </term>
115
115
  </terms>
@@ -133,12 +133,12 @@ standardization at the following addresses:

133
133
  </clause>
134
134
  <appendix id="_" inline-header="false" obligation="normative">
135
135
  <title>Appendix 1</title>
136
- </appendix></annex><bibliography><references id="_" obligation="informative">
136
+ </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
137
137
  <title>Normative References</title>
138
138
  <p id="_">There are no normative references in this document.</p>
139
139
  </references><clause id="_" obligation="informative">
140
140
  <title>Bibliography</title>
141
- <references id="_" obligation="informative">
141
+ <references id="_" obligation="informative" normative="false">
142
142
  <title>Bibliography Subsection</title>
143
143
  </references>
144
144
  </clause>
@@ -247,7 +247,7 @@ standardization at the following addresses:

247
247
  <p id="_">Foreword</p>
248
248
  </foreword></preface><sections>
249
249
  <terms id="_" obligation="normative">
250
- <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
250
+ <title>Terms and definitions</title><p id="_">For the purposes of this document, the terms and definitions
251
251
  given in <eref bibitemid="iso1234"/> and <eref bibitemid="iso5678"/> and the following apply.</p>
252
252
  <p id="_">ISO and IEC maintain terminological databases for use in
253
253
  standardization at the following addresses:</p>
@@ -259,7 +259,7 @@ standardization at the following addresses:

259
259
  <link target="http://www.electropedia.org"/>
260
260
  </p> </li> </ul>
261
261
 
262
- <term id="_">
262
+ <term id="term-term1">
263
263
  <preferred>Term1</preferred>
264
264
  </term>
265
265
  </terms></sections>
@@ -296,13 +296,13 @@ standardization at the following addresses:

296
296
  <ul id='_'>
297
297
  <li>
298
298
  <p id='_'>
299
- ISO Online browsing platform: available at
299
+ ISO Online browsing platform: available at
300
300
  <link target='http://www.iso.org/obp'/>
301
301
  </p>
302
302
  </li>
303
303
  <li>
304
304
  <p id='_'>
305
- IEC Electropedia: available at
305
+ IEC Electropedia: available at
306
306
  <link target='http://www.electropedia.org'/>
307
307
  </p>
308
308
  </li>
@@ -1,4 +1,67 @@
1
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso">
2
+ <bibdata type="standard">
3
+ <title type="title-intro" language="en" format="text/plain">Cereals and pulses</title>
4
+ <title type="title-main" language="en" format="text/plain">Specifications and test methods</title>
5
+ <title type="main" language="en" format="text/plain">Specifications and test methods</title>
6
+ <title type="title-part" language="en" format="text/plain">Rice</title>
7
+ <title type="title-intro" language="fr" format="text/plain">Céréales et légumineuses</title>
8
+ <title type="title-main" language="fr" format="text/plain">Spécification et méthodes d'essai</title>
9
+ <title type="title-part" language="fr" format="text/plain">Riz</title>
10
+ <docidentifier type="iso">ISO/PreCD3 17301-1</docidentifier>
11
+ <docidentifier type="iso-tc">17301</docidentifier>
12
+ <docnumber>1730</docnumber>
13
+ <date type="published"><on>2011</on></date>
14
+ <date type="accessed"><on>2012</on></date>
15
+ <date type="created"><from>2010</from><to>2011</to></date>
16
+ <date type="activated"><on>2013</on></date>
17
+ <date type="obsoleted"><on>2014</on></date>
18
+ <edition>2</edition>
19
+ <version>
20
+ <revision-date>2016-05-01</revision-date>
21
+ <draft>0.4</draft>
22
+ </version>
23
+ <contributor>
24
+ <role type="author"/>
25
+ <organization>
26
+ <name>International Organization for Standardization</name>
27
+ <abbreviation>ISO</abbreviation>
28
+ </organization>
29
+ </contributor>
30
+ <contributor>
31
+ <role type="publisher"/>
32
+ <organization>
33
+ <name>International Organization for Standardization</name>
34
+ <abbreviation>ISO</abbreviation>
35
+ </organization>
36
+ </contributor>
37
+ <language>en</language>
38
+ <script>Latn</script>
39
+ <status>
40
+ <stage abbreviation="CD">35</stage>
41
+ <substage abbreviation="3CD">20</substage>
42
+ <iteration>3</iteration>
43
+ </status>
44
+ <copyright>
45
+ <from>2016</from>
46
+ <owner>
47
+ <organization>
48
+ <abbreviation>ISO</abbreviation>
49
+ </organization>
50
+ </owner>
51
+ </copyright>
52
+ <ext>
53
+ <doctype>international-standard</doctype>
54
+ <editorialgroup>
55
+ <technical-committee number="34">Food products</technical-committee>
56
+ <subcommittee number="4">Cereals and pulses</subcommittee>
57
+ <workgroup number="3">Rice Group</workgroup>
58
+ <secretariat>GB</secretariat>
59
+ </editorialgroup>
60
+ <structuredidentifier>
61
+ <project-number part="1">ISO/PreCD3 17301</project-number>
62
+ </structuredidentifier>
63
+ </ext>
64
+ </bibdata>
2
65
  <foreword>
3
66
  <note>
4
67
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>