metanorma-iso 1.5.9 → 1.5.14

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/rake.yml +66 -0
  3. data/README.adoc +5 -6
  4. data/lib/asciidoctor/iso/base.rb +5 -5
  5. data/lib/asciidoctor/iso/basicdoc.rng +32 -0
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +38 -6
  9. data/lib/asciidoctor/iso/front.rb +11 -3
  10. data/lib/asciidoctor/iso/isodoc.rng +29 -44
  11. data/lib/asciidoctor/iso/isostandard.rng +11 -0
  12. data/lib/asciidoctor/iso/validate.rb +1 -1
  13. data/lib/asciidoctor/iso/validate_section.rb +9 -0
  14. data/lib/isodoc/iso/base_convert.rb +2 -1
  15. data/lib/isodoc/iso/html/header.html +12 -24
  16. data/lib/isodoc/iso/html/htmlstyle.css +1 -1
  17. data/lib/isodoc/iso/html/htmlstyle.scss +1 -1
  18. data/lib/isodoc/iso/html/isodoc.css +42 -42
  19. data/lib/isodoc/iso/html/isodoc.scss +42 -42
  20. data/lib/isodoc/iso/html/style-human.css +14 -10
  21. data/lib/isodoc/iso/html/style-human.scss +7 -7
  22. data/lib/isodoc/iso/html/style-iso.css +12 -8
  23. data/lib/isodoc/iso/html/style-iso.scss +5 -5
  24. data/lib/isodoc/iso/html/wordstyle.css +67 -67
  25. data/lib/isodoc/iso/html/wordstyle.scss +67 -67
  26. data/lib/isodoc/iso/html_convert.rb +4 -0
  27. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  28. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  29. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  30. data/lib/isodoc/iso/i18n.rb +10 -11
  31. data/lib/isodoc/iso/iso.amendment.xsl +562 -120
  32. data/lib/isodoc/iso/iso.international-standard.xsl +562 -120
  33. data/lib/isodoc/iso/metadata.rb +20 -19
  34. data/lib/isodoc/iso/word_convert.rb +4 -0
  35. data/lib/isodoc/iso/xref.rb +10 -0
  36. data/lib/metanorma/iso/fonts_manifest.yaml +6 -0
  37. data/lib/metanorma/iso/processor.rb +0 -9
  38. data/lib/metanorma/iso/version.rb +1 -1
  39. data/metanorma-iso.gemspec +1 -1
  40. data/spec/asciidoctor-iso/base_spec.rb +140 -12
  41. data/spec/asciidoctor-iso/blocks_spec.rb +1 -1
  42. data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
  43. data/spec/asciidoctor-iso/lists_spec.rb +6 -6
  44. data/spec/asciidoctor-iso/refs_spec.rb +174 -143
  45. data/spec/asciidoctor-iso/section_spec.rb +5 -0
  46. data/spec/asciidoctor-iso/validate_spec.rb +52 -15
  47. data/spec/assets/xref_error.adoc +7 -0
  48. data/spec/isodoc/amd_spec.rb +188 -29
  49. data/spec/isodoc/blocks_spec.rb +1 -0
  50. data/spec/isodoc/i18n_spec.rb +9 -22
  51. data/spec/isodoc/inline_spec.rb +1 -1
  52. data/spec/isodoc/metadata_spec.rb +172 -19
  53. data/spec/isodoc/postproc_spec.rb +2 -5
  54. data/spec/isodoc/ref_spec.rb +4 -7
  55. data/spec/isodoc/section_spec.rb +20 -0
  56. data/spec/isodoc/xref_spec.rb +12 -0
  57. data/spec/spec_helper.rb +21 -1
  58. metadata +8 -10
  59. data/.github/workflows/macos.yml +0 -41
  60. data/.github/workflows/ubuntu.yml +0 -45
  61. data/.github/workflows/windows.yml +0 -43
  62. data/lib/asciidoctor/iso/macros.rb +0 -21
  63. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +0 -86
  64. data/spec/asciidoctor-iso/macros_spec.rb +0 -310
@@ -4,38 +4,177 @@ require "relaton_ietf"
4
4
 
5
5
  RSpec.describe Asciidoctor::ISO do
6
6
  it "processes draft ISO reference" do
7
- #stub_fetch_ref no_year: true, note: "The standard is in press"
8
-
7
+ mock_fdis
8
+ #mock_isobib_get_123
9
9
  expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
10
- #{ASCIIDOC_BLANK_HDR}
10
+ #{ISOBIB_BLANK_HDR}
11
+ == Clause
12
+ <<iso123>>
13
+ <<iso123>>
14
+ A.footnote:[a footnote]
15
+ <<fdis>>
16
+ <<fdis>>
17
+
11
18
  [bibliography]
12
19
  == Normative References
13
20
 
14
21
  * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
22
+ * [[[fdis,ISO/FDIS 17664-1]]] Title
15
23
  INPUT
16
24
  #{BLANK_HDR}
17
- <sections>
18
- </sections><bibliography><references id="_" obligation="informative" normative="true">
19
- <title>Normative references</title>
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
- <bibitem id="iso123" type="standard">
22
- <title format="text/plain">Standard</title>
23
- <docidentifier>ISO 123:—</docidentifier>
24
- <docnumber>123</docnumber>
25
- <date type="published">
26
- <on>–</on>
27
- </date>
28
- <contributor>
29
- <role type="publisher"/>
30
- <organization>
31
- <name>International Organization for Standardization</name>
32
- <abbreviation>ISO</abbreviation>
33
- </organization>
34
- </contributor>
35
- <note format="text/plain" type="ISO DATE">The standard is in press</note>
36
- </bibitem>
37
- </references>
38
- </bibliography>
25
+ <sections>
26
+ <clause id='_' inline-header='false' obligation='normative'>
27
+ <title>Clause</title>
28
+ <p id='_'>
29
+ <eref type='inline' bibitemid='iso123' citeas='ISO 123:--'/>
30
+ <fn reference='1'>The standard is in press</fn>
31
+ <eref type='inline' bibitemid='iso123' citeas='ISO 123:--'/>
32
+ A.
33
+ <fn reference='2'>
34
+ <p id='_'>a footnote</p>
35
+ </fn>
36
+ <eref type='inline' bibitemid='fdis' citeas='ISO/FDIS 17664-1'/>
37
+ <fn reference='3'>
38
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
39
+ </fn>
40
+ <eref type='inline' bibitemid='fdis' citeas='ISO/FDIS 17664-1'/>
41
+ </p>
42
+ </clause>
43
+ </sections>
44
+ <bibliography>
45
+ <references id='_' normative='true' obligation='informative'>
46
+ <title>Normative references</title>
47
+ <p id='_'>
48
+ The following documents are referred to in the text in such a way that
49
+ some or all of their content constitutes requirements of this document.
50
+ For dated references, only the edition cited applies. For undated
51
+ references, the latest edition of the referenced document (including any
52
+ amendments) applies.
53
+ </p>
54
+ <bibitem id='iso123' type='standard'>
55
+ <title format='text/plain'>Standard</title>
56
+ <docidentifier type='ISO'>ISO 123:—</docidentifier>
57
+ <docnumber>123</docnumber>
58
+ <date type='published'>
59
+ <on>–</on>
60
+ </date>
61
+ <contributor>
62
+ <role type='publisher'/>
63
+ <organization>
64
+ <name>International Organization for Standardization</name>
65
+ <abbreviation>ISO</abbreviation>
66
+ </organization>
67
+ </contributor>
68
+ <note format='text/plain' type='Unpublished-Status'>The standard is in press</note>
69
+ </bibitem>
70
+ <bibitem id='fdis' type='standard'>
71
+ <fetched>#{Date.today}</fetched>
72
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Traitement de produits de soins de santé</title>
73
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>
74
+ Informations relatives au traitement des dispositifs médicaux à
75
+ fournir par le fabricant du dispositif
76
+ </title>
77
+ <title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 1: Titre manque</title>
78
+ <title type='main' format='text/plain' language='fr' script='Latn'>
79
+ Traitement de produits de soins de santé — Informations relatives au
80
+ traitement des dispositifs médicaux à fournir par le fabricant du
81
+ dispositif — Partie 1: Titre manque
82
+ </title>
83
+ <uri type='src'>https://www.iso.org/standard/81720.html</uri>
84
+ <uri type='rss'>https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
85
+ <docidentifier type='ISO'>ISO/FDIS 17664-1</docidentifier>
86
+ <docidentifier type='URN'>urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
87
+ <docnumber>17664</docnumber>
88
+ <contributor>
89
+ <role type='publisher'/>
90
+ <organization>
91
+ <name>International Organization for Standardization</name>
92
+ <abbreviation>ISO</abbreviation>
93
+ <uri>www.iso.org</uri>
94
+ </organization>
95
+ </contributor>
96
+ <edition>1</edition>
97
+ <note type='Unpublished-Status'>
98
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
99
+ </note>
100
+ <language>en</language>
101
+ <language>fr</language>
102
+ <script>Latn</script>
103
+ <status>
104
+ <stage>50</stage>
105
+ <substage>00</substage>
106
+ </status>
107
+ <copyright>
108
+ <from>unknown</from>
109
+ <owner>
110
+ <organization>
111
+ <name>ISO/FDIS</name>
112
+ </organization>
113
+ </owner>
114
+ </copyright>
115
+ <relation type='obsoletes'>
116
+ <bibitem type='standard'>
117
+ <formattedref format='text/plain'>ISO 17664:2017</formattedref>
118
+ </bibitem>
119
+ </relation>
120
+ <relation type='instance'>
121
+ <bibitem type='standard'>
122
+ <fetched>2020-11-03</fetched>
123
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Traitement de produits de soins de santé</title>
124
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>
125
+ Informations relatives au traitement des dispositifs médicaux à
126
+ fournir par le fabricant du dispositif
127
+ </title>
128
+ <title type='title-part' format='text/plain' language='fr' script='Latn'>Partie 1: Titre manque</title>
129
+ <title type='main' format='text/plain' language='fr' script='Latn'>
130
+ Traitement de produits de soins de santé — Informations relatives
131
+ au traitement des dispositifs médicaux à fournir par le fabricant
132
+ du dispositif — Partie 1: Titre manque
133
+ </title>
134
+ <uri type='src'>https://www.iso.org/standard/81720.html</uri>
135
+ <uri type='rss'>https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
136
+ <docidentifier type='ISO'>ISO/FDIS 17664-1</docidentifier>
137
+ <docidentifier type='URN'>urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
138
+ <docnumber>17664</docnumber>
139
+ <contributor>
140
+ <role type='publisher'/>
141
+ <organization>
142
+ <name>International Organization for Standardization</name>
143
+ <abbreviation>ISO</abbreviation>
144
+ <uri>www.iso.org</uri>
145
+ </organization>
146
+ </contributor>
147
+ <edition>1</edition>
148
+ <note type='Unpublished-Status'>
149
+ <p id='_'>Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
150
+ </note>
151
+ <language>en</language>
152
+ <language>fr</language>
153
+ <script>Latn</script>
154
+ <status>
155
+ <stage>50</stage>
156
+ <substage>00</substage>
157
+ </status>
158
+ <copyright>
159
+ <from>unknown</from>
160
+ <owner>
161
+ <organization>
162
+ <name>ISO/FDIS</name>
163
+ </organization>
164
+ </owner>
165
+ </copyright>
166
+ <relation type='obsoletes'>
167
+ <bibitem type='standard'>
168
+ <formattedref format='text/plain'>ISO 17664:2017</formattedref>
169
+ </bibitem>
170
+ </relation>
171
+ <place>Geneva</place>
172
+ </bibitem>
173
+ </relation>
174
+ <place>Geneva</place>
175
+ </bibitem>
176
+ </references>
177
+ </bibliography>
39
178
  </iso-standard>
40
179
  OUTPUT
41
180
  end
@@ -141,132 +280,16 @@ RSpec.describe Asciidoctor::ISO do
141
280
  OUTPUT
142
281
  end
143
282
 
144
- private
145
-
146
283
  private
147
284
 
148
285
  def mock_isobib_get_123
149
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
150
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
286
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO 123", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do
287
+ RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT")
151
288
  <bibitem type=\"international-standard\" id=\"ISO123\">\n <fetched>#{Date.today}</fetched>\n<title format=\"text/plain\" language=\"en\" script=\"Latn\">Rubber latex -- Sampling</title>\n <title format=\"text/plain\" language=\"fr\" script=\"Latn\">Latex de caoutchouc -- ?chantillonnage</title>\n <uri type=\"src\">https://www.iso.org/standard/23281.html</uri>\n <uri type=\"obp\">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>\n <uri type=\"rss\">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>\n <docidentifier type="ISO">ISO 123:2001</docidentifier>\n <date type=\"published\">\n <on>2001</on>\n </date>\n <contributor>\n <role type=\"publisher\"/>\n <organization>\n <name>International Organization for Standardization</name>\n <abbreviation>ISO</abbreviation>\n <uri>www.iso.org</uri>\n </organization>\n </contributor>\n <edition>3</edition>\n <language>en</language>\n <language>fr</language>\n <script>Latn</script>\n <status>Published</status>\n <copyright>\n <from>2001</from>\n <owner>\n <organization>\n <name>ISO</name>\n <abbreviation></abbreviation>\n </organization>\n </owner>\n </copyright>\n <relation type=\"obsoletes\">\n <bibitem>\n <formattedref>ISO 123:1985</formattedref>\n </bibitem>\n </relation>\n <relation type=\"updates\">\n <bibitem>\n <formattedref>ISO 123:2001</formattedref>\n </bibitem>\n </relation>\n</bibitem>
152
289
  OUTPUT
153
290
  end
154
291
  end
155
292
 
156
- def mock_isobib_get_124
157
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
158
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
159
- <bibitem type="international-standard" id="iso124">
160
- <fetched>#{Date.today}</fetched>
161
- <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
162
- <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
163
- <uri type="src">https://www.iso.org/standard/61884.html</uri>
164
- <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
165
- <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
166
- <docidentifier type="ISO">ISO 124:2014</docidentifier>
167
- <date type="published">
168
- <on>2014</on>
169
- </date>
170
- <contributor>
171
- <role type="publisher"/>
172
- <organization>
173
- <name>International Organization for Standardization</name>
174
- <abbreviation>ISO</abbreviation>
175
- <uri>www.iso.org</uri>
176
- </organization>
177
- </contributor>
178
- <edition>7</edition>
179
- <language>en</language>
180
- <language>fr</language>
181
- <script>Latn</script>
182
- <abstract format="plain" language="en" script="Latn">ISO 124:2014 specifies methods for the determination of the total solids content of natural rubber field and concentrated latices and synthetic rubber latex. These methods are not necessarily suitable for latex from natural sources other than the Hevea brasiliensis, for vulcanized latex, for compounded latex, or for artificial dispersions of rubber.</abstract>
183
- <status>Published</status>
184
- <copyright>
185
- <from>2014</from>
186
- <owner>
187
- <organization>
188
- <name>ISO</name>
189
- <abbreviation/>
190
- </organization>
191
- </owner>
192
- </copyright>
193
- <relation type="obsoletes">
194
- <bibitem>
195
- <formattedref>ISO 124:2011</formattedref>
196
- </bibitem>
197
- </relation>
198
- <ics>
199
- <code>83.040.10</code>
200
- <text>Latex and raw rubber</text>
201
- </ics>
202
- </bibitem>
203
- OUTPUT
204
- end
205
- end
206
-
207
- def mock_isobib_get_iec12382
208
- expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
209
- IsoBibItem::XMLParser.from_xml(<<~"OUTPUT")
210
- <bibitem type="international-standard" id="iso123">
211
- <fetched>#{Date.today}</fetched>
212
- <title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
213
- <title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
214
- <uri type="src">https://www.iso.org/standard/21071.html</uri>
215
- <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
216
- <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
217
- <docidentifier type="ISO">ISO/IEC 12382:1992</docidentifier>
218
- <date type="published">
219
- <on>1992</on>
220
- </date>
221
- <contributor>
222
- <role type="publisher"/>
223
- <organization>
224
- <name>International Organization for Standardization</name>
225
- <abbreviation>ISO</abbreviation>
226
- <uri>www.iso.org</uri>
227
- </organization>
228
- </contributor>
229
- <contributor>
230
- <role type="publisher"/>
231
- <organization>
232
- <name>International Electrotechnical Commission</name>
233
- <abbreviation>IEC</abbreviation>
234
- <uri>www.iec.ch</uri>
235
- </organization>
236
- </contributor>
237
- <edition>2</edition>
238
- <language>en</language>
239
- <language>fr</language>
240
- <script>Latn</script>
241
- <abstract format="plain" language="en" script="Latn">Contains a permuted index of all terms included in the parts 1 - 28 of ISO 2382. If any of these parts has been revised, the present TR refers to the revision.</abstract>
242
- <status>Published</status>
243
- <copyright>
244
- <from>1992</from>
245
- <owner>
246
- <organization>
247
- <name>ISO/IEC</name>
248
- <abbreviation/>
249
- </organization>
250
- </owner>
251
- </copyright>
252
- <relation type="updates">
253
- <bibitem>
254
- <formattedref>ISO/IEC TR 12382:1992</formattedref>
255
- </bibitem>
256
- </relation>
257
- <ics>
258
- <code>35.020</code>
259
- <text>Information technology (IT) in general</text>
260
- </ics>
261
- <ics>
262
- <code>01.040.35</code>
263
- <text>Information technology (Vocabularies)</text>
264
- </ics>
265
- </bibitem>
266
- OUTPUT
267
- end
268
- end
269
-
270
293
  def mock_rfcbib_get_rfc8341
271
294
  expect(IETFBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
272
295
  IETFBib::XMLParser.from_xml(<<~"OUTPUT")
@@ -283,4 +306,12 @@ OUTPUT
283
306
  end
284
307
  end
285
308
 
309
+ def mock_fdis
310
+ expect(RelatonIso::IsoBibliography).to receive(:get).with("ISO/FDIS 17664-1", nil, {:lang=>"en", :title=>"Title", :usrlbl=>nil}) do
311
+ RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT")
312
+ <bibitem id="x" type="standard"> <fetched>#{Date.today}</fetched> <title type="title-intro" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé</title> <title type="title-main" format="text/plain" language="fr" script="Latn">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title> <title type="title-part" format="text/plain" language="fr" script="Latn">Partie 1: Titre manque</title> <title type="main" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque</title> <uri type="src">https://www.iso.org/standard/81720.html</uri> <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri> <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier> <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier> <docnumber>17664</docnumber> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>1</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status> <stage>50</stage> <substage>00</substage> </status> <copyright> <from>unknown</from> <owner> <organization> <name>ISO/FDIS</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem type="standard"> <formattedref format="text/plain">ISO 17664:2017</formattedref> </bibitem> </relation> <relation type="instance"> <bibitem type="standard"> <fetched>2020-11-03</fetched> <title type="title-intro" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé</title> <title type="title-main" format="text/plain" language="fr" script="Latn">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title> <title type="title-part" format="text/plain" language="fr" script="Latn">Partie 1: Titre manque</title> <title type="main" format="text/plain" language="fr" script="Latn">Traitement de produits de soins de santé — Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif — Partie 1: Titre manque</title> <uri type="src">https://www.iso.org/standard/81720.html</uri> <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri> <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier> <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier> <docnumber>17664</docnumber> <contributor> <role type="publisher"/> <organization> <name>International Organization for Standardization</name> <abbreviation>ISO</abbreviation> <uri>www.iso.org</uri> </organization> </contributor> <edition>1</edition> <language>en</language> <language>fr</language> <script>Latn</script> <status> <stage>50</stage> <substage>00</substage> </status> <copyright> <from>unknown</from> <owner> <organization> <name>ISO/FDIS</name> </organization> </owner> </copyright> <relation type="obsoletes"> <bibitem type="standard"> <formattedref format="text/plain">ISO 17664:2017</formattedref> </bibitem> </relation> <place>Geneva</place> </bibitem> </relation> <place>Geneva</place></bibitem>
313
+ OUTPUT
314
+ end
315
+ end
316
+
286
317
  end
@@ -50,6 +50,8 @@ RSpec.describe Asciidoctor::ISO do
50
50
  [%appendix]
51
51
  === Appendix 1
52
52
 
53
+ ==== Appendix subclause
54
+
53
55
  == Bibliography
54
56
 
55
57
  === Bibliography Subsection
@@ -136,6 +138,9 @@ standardization at the following addresses:</p>
136
138
  </clause>
137
139
  <appendix id="_" inline-header="false" obligation="normative">
138
140
  <title>Appendix 1</title>
141
+ <clause id='_' inline-header='false' obligation='normative'>
142
+ <title>Appendix subclause</title>
143
+ </clause>
139
144
  </appendix></annex><bibliography><references id="_" obligation="informative" normative="true">
140
145
  <title>Normative references</title>
141
146
  <p id="_">There are no normative references in this document.</p>
@@ -2,6 +2,26 @@ require "spec_helper"
2
2
  require "fileutils"
3
3
 
4
4
  RSpec.describe Asciidoctor::ISO do
5
+ context "when xref_error.adoc compilation" do
6
+ around do |example|
7
+ FileUtils.rm_f "spec/assets/xref_error.err"
8
+ example.run
9
+ Dir["spec/assets/xref_error*"].each do |file|
10
+ next if file.match?(/adoc$/)
11
+
12
+ FileUtils.rm_f(file)
13
+ end
14
+ end
15
+
16
+ it "generates error file" do
17
+ expect do
18
+ Metanorma::Compile
19
+ .new
20
+ .compile("spec/assets/xref_error.adoc", type: "iso")
21
+ end.to(change { File.exist?("spec/assets/xref_error.err") }
22
+ .from(false).to(true))
23
+ end
24
+ end
5
25
 
6
26
  it "Warns of missing scope" do
7
27
  FileUtils.rm_f "test.err"
@@ -182,6 +202,23 @@ it "Warns of illegal script" do
182
202
  expect(File.read("test.err")).to include "pizza is not a recognised script"
183
203
  end
184
204
 
205
+ it "warns that technical report may contain requirement" do
206
+ FileUtils.rm_f "test.err"
207
+ Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
208
+ = Document title
209
+ Author
210
+ :docfile: test.adoc
211
+ :nodoc:
212
+ :no-isobib:
213
+ :doctype: technical-report
214
+
215
+ == Random clause
216
+
217
+ The widget is required not to be larger than 15 cm.
218
+ INPUT
219
+ expect(File.read("test.err")).to include "Technical Report clause may contain requirement"
220
+ end
221
+
185
222
 
186
223
  it "warns that introduction may contain requirement" do
187
224
  FileUtils.rm_f "test.err"
@@ -332,7 +369,7 @@ it "warns that undated reference has locality" do
332
369
  FileUtils.rm_f "test.err"
333
370
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
334
371
  #{VALIDATING_BLANK_HDR}
335
-
372
+
336
373
  == Scope
337
374
  <<iso123,clause=1>>
338
375
 
@@ -417,7 +454,7 @@ it "warns that Scope contains subclauses" do
417
454
  #{VALIDATING_BLANK_HDR}
418
455
 
419
456
  == Scope
420
-
457
+
421
458
  === Scope subclause
422
459
  INPUT
423
460
  expect(File.read("test.err")).to include "Scope contains subclauses: should be succinct"
@@ -427,7 +464,7 @@ end
427
464
  it "warns that Table should have title" do
428
465
  FileUtils.rm_f "test.err"
429
466
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
430
- #{VALIDATING_BLANK_HDR}
467
+ #{VALIDATING_BLANK_HDR}
431
468
 
432
469
  |===
433
470
  |a |b |c
@@ -439,7 +476,7 @@ end
439
476
  it "gives Style warning if number not broken up in threes" do
440
477
  FileUtils.rm_f "test.err"
441
478
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
442
- #{VALIDATING_BLANK_HDR}
479
+ #{VALIDATING_BLANK_HDR}
443
480
 
444
481
  == Clause
445
482
  12121
@@ -450,7 +487,7 @@ end
450
487
  it "gives No style warning if number not broken up in threes is ISO reference" do
451
488
  FileUtils.rm_f "test.err"
452
489
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
453
- #{VALIDATING_BLANK_HDR}
490
+ #{VALIDATING_BLANK_HDR}
454
491
 
455
492
  == Clause
456
493
  ISO 12121
@@ -461,7 +498,7 @@ end
461
498
  it "Style warning if decimal point" do
462
499
  FileUtils.rm_f "test.err"
463
500
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
464
- #{VALIDATING_BLANK_HDR}
501
+ #{VALIDATING_BLANK_HDR}
465
502
 
466
503
  == Clause
467
504
  8.1
@@ -472,7 +509,7 @@ end
472
509
  it "Style warning if billion used" do
473
510
  FileUtils.rm_f "test.err"
474
511
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
475
- #{VALIDATING_BLANK_HDR}
512
+ #{VALIDATING_BLANK_HDR}
476
513
 
477
514
  == Clause
478
515
  "Billions" are a term of art.
@@ -483,7 +520,7 @@ end
483
520
  it "Style warning if no space before percent sign" do
484
521
  FileUtils.rm_f "test.err"
485
522
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
486
- #{VALIDATING_BLANK_HDR}
523
+ #{VALIDATING_BLANK_HDR}
487
524
 
488
525
  == Clause
489
526
  95%
@@ -572,7 +609,7 @@ end
572
609
  # it "Style warning if foreword contains subclauses" do
573
610
  # expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{non-standard unit}).to_stderr
574
611
  # #{VALIDATING_BLANK_HDR}
575
- #
612
+ #
576
613
  # INPUT
577
614
  # end
578
615
 
@@ -644,7 +681,7 @@ it "Warning if introduction not followed by scope" do
644
681
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
645
682
  #{VALIDATING_BLANK_HDR}
646
683
 
647
- .Foreword
684
+ .Foreword
648
685
  Foreword
649
686
 
650
687
  == Introduction
@@ -661,7 +698,7 @@ it "Warning if normative references not followed by terms and definitions" do
661
698
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
662
699
  #{VALIDATING_BLANK_HDR}
663
700
 
664
- .Foreword
701
+ .Foreword
665
702
  Foreword
666
703
 
667
704
  == Scope
@@ -681,7 +718,7 @@ it "Warning if there are no clauses in the document" do
681
718
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
682
719
  #{VALIDATING_BLANK_HDR}
683
720
 
684
- .Foreword
721
+ .Foreword
685
722
  Foreword
686
723
 
687
724
  == Scope
@@ -1089,7 +1126,7 @@ it "Warning if term definition starts with article" do
1089
1126
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1090
1127
  #{VALIDATING_BLANK_HDR}
1091
1128
  == Terms and Definitions
1092
-
1129
+
1093
1130
  === Term
1094
1131
 
1095
1132
  The definition of a term is a part of the specialized vocabulary of a particular field
@@ -1102,7 +1139,7 @@ it "Warning if term definition ends with period" do
1102
1139
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1103
1140
  #{VALIDATING_BLANK_HDR}
1104
1141
  == Terms and Definitions
1105
-
1142
+
1106
1143
  === Term
1107
1144
 
1108
1145
  Part of the specialized vocabulary of a particular field.
@@ -1202,7 +1239,7 @@ it "Warn if an undated reference has no associated footnote" do
1202
1239
  FileUtils.rm_f "test.err"
1203
1240
  Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
1204
1241
  #{VALIDATING_BLANK_HDR}
1205
-
1242
+
1206
1243
  [bibliography]
1207
1244
  == Bibliography
1208
1245
  * [[[ISO8,ISO 8:--]]], _Title_