metanorma-iso 1.3.22 → 1.3.27

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) 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 +89 -32
  8. data/lib/asciidoctor/iso/cleanup.rb +20 -3
  9. data/lib/asciidoctor/iso/front.rb +16 -107
  10. data/lib/asciidoctor/iso/front_id.rb +196 -0
  11. data/lib/asciidoctor/iso/isodoc.rng +475 -2
  12. data/lib/asciidoctor/iso/isostandard-amd.rng +98 -0
  13. data/lib/asciidoctor/iso/isostandard.rng +12 -1
  14. data/lib/asciidoctor/iso/macros.rb +21 -0
  15. data/lib/asciidoctor/iso/reqt.rng +23 -0
  16. data/lib/asciidoctor/iso/section.rb +18 -32
  17. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +87 -0
  18. data/lib/asciidoctor/iso/validate.rb +41 -25
  19. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  20. data/lib/asciidoctor/iso/validate_section.rb +2 -2
  21. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  22. data/lib/asciidoctor/iso/validate_title.rb +1 -1
  23. data/lib/isodoc/iso/base_convert.rb +77 -107
  24. data/lib/isodoc/iso/html/header.html +10 -6
  25. data/lib/isodoc/iso/html/html_iso_titlepage.html +27 -18
  26. data/lib/isodoc/iso/html/isodoc.scss +53 -28
  27. data/lib/isodoc/iso/html/scripts.html +23 -21
  28. data/lib/isodoc/iso/html/style-human.scss +23 -0
  29. data/lib/isodoc/iso/html/style-iso.scss +18 -0
  30. data/lib/isodoc/iso/html/word_iso_intro.html +4 -0
  31. data/lib/isodoc/iso/html/word_iso_titlepage.html +23 -2
  32. data/lib/isodoc/iso/html/wordstyle.scss +80 -39
  33. data/lib/isodoc/iso/html_convert.rb +7 -9
  34. data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
  35. data/lib/isodoc/iso/iso.international-standard.xsl +4597 -0
  36. data/lib/isodoc/iso/metadata.rb +71 -23
  37. data/lib/isodoc/iso/pdf_convert.rb +39 -0
  38. data/lib/isodoc/iso/sections.rb +66 -0
  39. data/lib/isodoc/iso/sts_convert.rb +29 -0
  40. data/lib/isodoc/iso/xref.rb +105 -0
  41. data/lib/metanorma-iso.rb +2 -0
  42. data/lib/metanorma/iso/processor.rb +16 -1
  43. data/lib/metanorma/iso/version.rb +1 -1
  44. data/metanorma-iso.gemspec +4 -1
  45. data/spec/asciidoctor-iso/amd_spec.rb +726 -0
  46. data/spec/asciidoctor-iso/base_spec.rb +38 -21
  47. data/spec/asciidoctor-iso/blocks_spec.rb +6 -6
  48. data/spec/asciidoctor-iso/cleanup_spec.rb +195 -174
  49. data/spec/asciidoctor-iso/inline_spec.rb +2 -1
  50. data/spec/asciidoctor-iso/macros_spec.rb +289 -0
  51. data/spec/asciidoctor-iso/refs_spec.rb +8 -5
  52. data/spec/asciidoctor-iso/section_spec.rb +8 -8
  53. data/spec/assets/iso.xml +64 -1
  54. data/spec/isodoc/amd_spec.rb +652 -0
  55. data/spec/isodoc/blocks_spec.rb +112 -27
  56. data/spec/isodoc/i18n_spec.rb +12 -20
  57. data/spec/isodoc/inline_spec.rb +4 -4
  58. data/spec/isodoc/iso_spec.rb +1 -1
  59. data/spec/isodoc/metadata_spec.rb +92 -4
  60. data/spec/isodoc/postproc_spec.rb +21 -120
  61. data/spec/isodoc/ref_spec.rb +9 -9
  62. data/spec/isodoc/section_spec.rb +36 -13
  63. data/spec/isodoc/table_spec.rb +30 -30
  64. data/spec/isodoc/terms_spec.rb +6 -6
  65. data/spec/isodoc/xref_spec.rb +43 -37
  66. data/spec/metanorma/processor_spec.rb +2 -2
  67. data/spec/spec_helper.rb +11 -0
  68. metadata +58 -5
  69. 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,293 @@ 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 identity
238
+
239
+ [[name-check]]
240
+ === name check
241
+
242
+ paragraph
243
+
244
+ term:[name check] is a term
245
+
246
+ term:[name identity] is a term
247
+
248
+ Moreover, term:[missing] is a term
249
+ XML
250
+ end
251
+ let(:output) do
252
+ <<~XML
253
+ #{BLANK_HDR}
254
+ <sections>
255
+ <terms id='_' obligation='normative'>
256
+ <title>Terms and definitions</title>
257
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
258
+ <p id='_'>
259
+ ISO and IEC maintain terminological databases for use in standardization
260
+ at the following addresses:
261
+ </p>
262
+ <ul id='_'>
263
+ <li>
264
+ <p id='_'>
265
+ ISO Online browsing platform: available at
266
+ <link target='http://www.iso.org/obp'/>
267
+ </p>
268
+ </li>
269
+ <li>
270
+ <p id='_'>
271
+ IEC Electropedia: available at
272
+ <link target='http://www.electropedia.org'/>
273
+ </p>
274
+ </li>
275
+ </ul>
276
+ <term id='term-name-identity'>
277
+ <preferred>name identity</preferred>
278
+ </term>
279
+ <term id='name-check'>
280
+ <preferred>name check</preferred>
281
+ <definition>
282
+ <p id='_'>paragraph</p>
283
+ <p id='_'>
284
+ <em>name check</em>
285
+ (
286
+ <xref target='name-check'/>
287
+ ) is a term
288
+ </p>
289
+ <p id='_'>
290
+ <em>name identity</em>
291
+ (
292
+ <xref target='term-name-identity'/>
293
+ ) is a term
294
+ </p>
295
+ <p id="_">Moreover, (<strong>term “missing” not resolved</strong>) is a term
296
+ </p>
297
+ </definition>
298
+ </term>
299
+ </terms>
300
+ </sections>
301
+ </iso-standard>
302
+ XML
303
+ end
304
+
305
+ it 'generates unique ids which dont match existing ids' do
306
+ expect(convert).to(be_equivalent_to(xmlpp(output)))
307
+ end
308
+ end
309
+ end
21
310
  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>
@@ -31,7 +32,7 @@ RSpec.describe Asciidoctor::ISO do
31
32
  <abbreviation>ISO</abbreviation>
32
33
  </organization>
33
34
  </contributor>
34
- <note format="text/plain">ISO DATE: The standard is in press</note>
35
+ <note format="text/plain" type="ISO DATE">The standard is in press</note>
35
36
  </bibitem>
36
37
  </references>
37
38
  </bibliography>
@@ -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>