metanorma-iso 1.9.3 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,60 +5,6 @@ RSpec.describe Asciidoctor::ISO do
5
5
  expect(Metanorma::ISO::VERSION).not_to be nil
6
6
  end
7
7
 
8
- it "processes a blank document" do
9
- input = <<~INPUT
10
- #{ASCIIDOC_BLANK_HDR}
11
- INPUT
12
- output = <<~OUTPUT
13
- #{BLANK_HDR}
14
- <sections/>
15
- </iso-standard>
16
- OUTPUT
17
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
18
- .to be_equivalent_to xmlpp(output)
19
- end
20
-
21
- it "converts a blank document" do
22
- input = <<~INPUT
23
- = Document title
24
- Author
25
- :docfile: test.adoc
26
- :novalid:
27
- :no-isobib:
28
- INPUT
29
- output = <<~OUTPUT
30
- #{BLANK_HDR}
31
- <sections/>
32
- </iso-standard>
33
- OUTPUT
34
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
35
- .to be_equivalent_to xmlpp(output)
36
- expect(File.exist?("test_alt.html")).to be true
37
- expect(File.exist?("test.html")).to be true
38
- expect(File.exist?("test.doc")).to be true
39
- expect(File.exist?("test.pdf")).to be true
40
- expect(File.exist?("htmlstyle.css")).to be false
41
- end
42
-
43
- it "converts a blank document in French" do
44
- input = <<~INPUT
45
- = Document title
46
- Author
47
- :docfile: test.adoc
48
- :novalid:
49
- :no-isobib:
50
- :no-pdf:
51
- :language: fr
52
- INPUT
53
- output = <<~OUTPUT
54
- #{BLANK_HDR_FR}
55
- <sections/>
56
- </iso-standard>
57
- OUTPUT
58
- expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
59
- .to be_equivalent_to xmlpp(output)
60
- end
61
-
62
8
  it "processes default metadata" do
63
9
  output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
64
10
  = Document title
@@ -212,133 +158,133 @@ RSpec.describe Asciidoctor::ISO do
212
158
  :pub-fax: 4444444
213
159
  :pub-email: x@example.com
214
160
  :pub-uri: http://www.example.com
215
- :docstage:
216
- :docsubstage:
161
+ :docstage:
162
+ :docsubstage:
217
163
  INPUT
218
164
  expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
219
165
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
220
- <?xml version="1.0" encoding="UTF-8"?>
221
- <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
222
- <bibdata type="standard">
223
- <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
224
- <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
225
- <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
226
- <docidentifier type="iso-tc">2000</docidentifier>
227
- <docidentifier type="iso-tc">2003</docidentifier>
228
- <docnumber>1000</docnumber>
229
- <contributor>
230
- <role type="author"/>
231
- <organization>
232
- <name>International Electrotechnical Commission</name>
233
- <abbreviation>IEC</abbreviation>
234
- </organization>
235
- </contributor>
236
- <contributor>
237
- <role type="author"/>
238
- <organization>
239
- <name>IETF</name>
240
- </organization>
241
- </contributor>
242
- <contributor>
243
- <role type="author"/>
244
- <organization>
245
- <name>International Organization for Standardization</name>
246
- <abbreviation>ISO</abbreviation>
247
- </organization>
248
- </contributor>
249
- <contributor>
250
- <role type="publisher"/>
251
- <organization>
252
- <name>International Electrotechnical Commission</name>
253
- <abbreviation>IEC</abbreviation>
254
- <address>
255
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
256
- </address>
257
- <phone>3333333</phone>
258
- <phone type='fax'>4444444</phone>
259
- <email>x@example.com</email>
260
- <uri>http://www.example.com</uri>
261
- </organization>
262
- </contributor>
263
- <contributor>
264
- <role type="publisher"/>
265
- <organization>
266
- <name>IETF</name>
267
- <address>
268
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
269
- </address>
270
- <phone>3333333</phone>
271
- <phone type='fax'>4444444</phone>
272
- <email>x@example.com</email>
273
- <uri>http://www.example.com</uri>
274
- </organization>
275
- </contributor>
276
- <contributor>
277
- <role type="publisher"/>
278
- <organization>
279
- <name>International Organization for Standardization</name>
280
- <abbreviation>ISO</abbreviation>
281
- <address>
282
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
283
- </address>
284
- <phone>3333333</phone>
285
- <phone type='fax'>4444444</phone>
286
- <email>x@example.com</email>
287
- <uri>http://www.example.com</uri>
288
- </organization>
289
- </contributor>
290
- <language>el</language>
291
- <script>Grek</script>
292
- <status>
293
- <stage abbreviation="IS">60</stage>
294
- <substage>60</substage>
295
- </status>
296
- <copyright>
297
- <from>2001</from>
298
- <owner>
299
- <organization>
300
- <name>International Organization for Standardization</name>
301
- <abbreviation>ISO</abbreviation>
302
- <address>
303
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
304
- </address>
305
- <phone>3333333</phone>
306
- <phone type='fax'>4444444</phone>
307
- <email>x@example.com</email>
308
- <uri>http://www.example.com</uri>
309
- </organization>
310
- </owner>
311
- </copyright>
312
- <copyright>
313
- <from>2001</from>
314
- <owner>
315
- <organization>
316
- <name>IETF</name>
317
- <address>
318
- <formattedAddress>1 Infinity Loop + California</formattedAddress>
319
- </address>
320
- <phone>3333333</phone>
321
- <phone type='fax'>4444444</phone>
322
- <email>x@example.com</email>
323
- <uri>http://www.example.com</uri>
324
- </organization>
325
- </owner>
326
- </copyright>
327
- <ext>
328
- <doctype>technical-report</doctype>
329
- <editorialgroup>
330
- <technical-committee/>
331
- <subcommittee/>
332
- <workgroup/>
333
- </editorialgroup>
334
- <structuredidentifier>
335
- <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
336
- </structuredidentifier>
337
- <stagename>International standard</stagename>
338
- </ext>
339
- </bibdata>
340
- <sections/>
341
- </iso-standard>
166
+ <?xml version="1.0" encoding="UTF-8"?>
167
+ <iso-standard type="semantic" version="#{Metanorma::ISO::VERSION}" xmlns="https://www.metanorma.org/ns/iso">
168
+ <bibdata type="standard">
169
+ <docidentifier type="ISO">ISO/IEC/IETF/TR 1000-1-1:2001</docidentifier>
170
+ <docidentifier type="iso-with-lang">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
171
+ <docidentifier type="iso-reference">ISO/IEC/IETF/TR 1000-1-1:2001(X)</docidentifier>
172
+ <docidentifier type="iso-tc">2000</docidentifier>
173
+ <docidentifier type="iso-tc">2003</docidentifier>
174
+ <docnumber>1000</docnumber>
175
+ <contributor>
176
+ <role type="author"/>
177
+ <organization>
178
+ <name>International Electrotechnical Commission</name>
179
+ <abbreviation>IEC</abbreviation>
180
+ </organization>
181
+ </contributor>
182
+ <contributor>
183
+ <role type="author"/>
184
+ <organization>
185
+ <name>IETF</name>
186
+ </organization>
187
+ </contributor>
188
+ <contributor>
189
+ <role type="author"/>
190
+ <organization>
191
+ <name>International Organization for Standardization</name>
192
+ <abbreviation>ISO</abbreviation>
193
+ </organization>
194
+ </contributor>
195
+ <contributor>
196
+ <role type="publisher"/>
197
+ <organization>
198
+ <name>International Electrotechnical Commission</name>
199
+ <abbreviation>IEC</abbreviation>
200
+ <address>
201
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
202
+ </address>
203
+ <phone>3333333</phone>
204
+ <phone type='fax'>4444444</phone>
205
+ <email>x@example.com</email>
206
+ <uri>http://www.example.com</uri>
207
+ </organization>
208
+ </contributor>
209
+ <contributor>
210
+ <role type="publisher"/>
211
+ <organization>
212
+ <name>IETF</name>
213
+ <address>
214
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
215
+ </address>
216
+ <phone>3333333</phone>
217
+ <phone type='fax'>4444444</phone>
218
+ <email>x@example.com</email>
219
+ <uri>http://www.example.com</uri>
220
+ </organization>
221
+ </contributor>
222
+ <contributor>
223
+ <role type="publisher"/>
224
+ <organization>
225
+ <name>International Organization for Standardization</name>
226
+ <abbreviation>ISO</abbreviation>
227
+ <address>
228
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
229
+ </address>
230
+ <phone>3333333</phone>
231
+ <phone type='fax'>4444444</phone>
232
+ <email>x@example.com</email>
233
+ <uri>http://www.example.com</uri>
234
+ </organization>
235
+ </contributor>
236
+ <language>el</language>
237
+ <script>Grek</script>
238
+ <status>
239
+ <stage abbreviation="IS">60</stage>
240
+ <substage>60</substage>
241
+ </status>
242
+ <copyright>
243
+ <from>2001</from>
244
+ <owner>
245
+ <organization>
246
+ <name>International Organization for Standardization</name>
247
+ <abbreviation>ISO</abbreviation>
248
+ <address>
249
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
250
+ </address>
251
+ <phone>3333333</phone>
252
+ <phone type='fax'>4444444</phone>
253
+ <email>x@example.com</email>
254
+ <uri>http://www.example.com</uri>
255
+ </organization>
256
+ </owner>
257
+ </copyright>
258
+ <copyright>
259
+ <from>2001</from>
260
+ <owner>
261
+ <organization>
262
+ <name>IETF</name>
263
+ <address>
264
+ <formattedAddress>1 Infinity Loop + California</formattedAddress>
265
+ </address>
266
+ <phone>3333333</phone>
267
+ <phone type='fax'>4444444</phone>
268
+ <email>x@example.com</email>
269
+ <uri>http://www.example.com</uri>
270
+ </organization>
271
+ </owner>
272
+ </copyright>
273
+ <ext>
274
+ <doctype>technical-report</doctype>
275
+ <editorialgroup>
276
+ <technical-committee/>
277
+ <subcommittee/>
278
+ <workgroup/>
279
+ </editorialgroup>
280
+ <structuredidentifier>
281
+ <project-number part="1" subpart="1">ISO/IEC/IETF 1000</project-number>
282
+ </structuredidentifier>
283
+ <stagename>International standard</stagename>
284
+ </ext>
285
+ </bibdata>
286
+ <sections/>
287
+ </iso-standard>
342
288
  OUTPUT
343
289
  end
344
290
 
@@ -721,6 +667,233 @@ RSpec.describe Asciidoctor::ISO do
721
667
  OUTPUT
722
668
  end
723
669
 
670
+ it "processes document relations" do
671
+ VCR.use_cassette "docrels" do
672
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
673
+ = Document title
674
+ Author
675
+ :docfile: test.adoc
676
+ :nodoc:
677
+ :novalid:
678
+ :amends: ISO 123;ISO 124
679
+ :obsoletes: ISO 125;ISO 126
680
+ INPUT
681
+ expect(xmlpp(output.sub(%r{<boilerplate>.*</boilerplate>}m, "")))
682
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
683
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
684
+ <bibdata type='standard'>
685
+ <contributor>
686
+ <role type='author'/>
687
+ <organization>
688
+ <name>International Organization for Standardization</name>
689
+ <abbreviation>ISO</abbreviation>
690
+ </organization>
691
+ </contributor>
692
+ <contributor>
693
+ <role type='publisher'/>
694
+ <organization>
695
+ <name>International Organization for Standardization</name>
696
+ <abbreviation>ISO</abbreviation>
697
+ </organization>
698
+ </contributor>
699
+ <language>en</language>
700
+ <script>Latn</script>
701
+ <status>
702
+ <stage abbreviation='IS'>60</stage>
703
+ <substage>60</substage>
704
+ </status>
705
+ <copyright>
706
+ <from>2021</from>
707
+ <owner>
708
+ <organization>
709
+ <name>International Organization for Standardization</name>
710
+ <abbreviation>ISO</abbreviation>
711
+ </organization>
712
+ </owner>
713
+ </copyright>
714
+ <relation type='obsoletes'>
715
+ <bibitem type='standard'>
716
+ <fetched>#{Date.today}</fetched>
717
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Natural rubber latex concentrate</title>
718
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Determination of alkalinity</title>
719
+ <title type='main' format='text/plain' language='en' script='Latn'>
720
+ Natural rubber latex concentrate&#8201;&#8212;&#8201;Determination of
721
+ alkalinity
722
+ </title>
723
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex concentr&#233; de caoutchouc naturel</title>
724
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>D&#233;termination de l&#8217;alcalinit&#233;</title>
725
+ <title type='main' format='text/plain' language='fr' script='Latn'>
726
+ Latex concentr&#233; de caoutchouc
727
+ naturel&#8201;&#8212;&#8201;D&#233;termination de
728
+ l&#8217;alcalinit&#233;
729
+ </title>
730
+ <uri type='src'>https://www.iso.org/standard/72849.html</uri>
731
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:72849:en</uri>
732
+ <uri type='rss'>https://www.iso.org/contents/data/standard/07/28/72849.detail.rss</uri>
733
+ <docidentifier type='ISO'>ISO 125:2020</docidentifier>
734
+ <docidentifier type='URN'>urn:iso:std:iso:125:stage-60.60:ed-7:en,fr</docidentifier>
735
+ <docnumber>125</docnumber>
736
+ <date type='published'>
737
+ <on>2020-02</on>
738
+ </date>
739
+ <contributor>
740
+ <role type='publisher'/>
741
+ <organization>
742
+ <name>International Organization for Standardization</name>
743
+ <abbreviation>ISO</abbreviation>
744
+ <uri>www.iso.org</uri>
745
+ </organization>
746
+ </contributor>
747
+ <edition>7</edition>
748
+ <language>en</language>
749
+ <language>fr</language>
750
+ <script>Latn</script>
751
+ <abstract format='text/plain' language='en' script='Latn'>
752
+ This document specifies a method for the determination of the
753
+ alkalinity of natural rubber latex concentrate. The method is not
754
+ necessarily suitable for latices from natural sources other than Hevea
755
+ brasiliensis or for synthetic rubber latices, compounded latex,
756
+ vulcanized latex or artificial dispersions of rubber. NOTE A method
757
+ for the determination of the alkalinity of polychloroprene latex is
758
+ specified in ISO 13773.
759
+ </abstract>
760
+ <abstract format='text/plain' language='fr' script='Latn'>
761
+ Le pr&#233;sent document sp&#233;cifie une m&#233;thode de
762
+ d&#233;termination de l&#8217;alcalinit&#233; du latex concentr&#233;
763
+ de caoutchouc naturel. La m&#233;thode ne convient pas
764
+ n&#233;cessairement aux latex d&#8217;origine naturelle autres que
765
+ l&#8217;Hevea brasiliensis ou aux latex de caoutchouc de
766
+ synth&#232;se, aux latex formul&#233;s, aux latex vulcanis&#233;s ou
767
+ aux dispersions artificielles de caoutchouc. NOTE Une m&#233;thode de
768
+ d&#233;termination de l&#8217;alcalinit&#233; du latex de
769
+ polychloropr&#232;ne est sp&#233;cifi&#233;e dans l&#8217;ISO 13773.
770
+ </abstract>
771
+ <status>
772
+ <stage>60</stage>
773
+ <substage>60</substage>
774
+ </status>
775
+ <copyright>
776
+ <from>2020</from>
777
+ <owner>
778
+ <organization>
779
+ <name>ISO</name>
780
+ </organization>
781
+ </owner>
782
+ </copyright>
783
+ <relation type='obsoletes'>
784
+ <bibitem type='standard'>
785
+ <formattedref format='text/plain'>ISO 125:2011</formattedref>
786
+ </bibitem>
787
+ </relation>
788
+ <place>Geneva</place>
789
+ </bibitem>
790
+ </relation>
791
+ <relation type='obsoletes'>
792
+ <bibitem type='standard'>
793
+ <fetched>#{Date.today}</fetched>
794
+ <title type='title-intro' format='text/plain' language='en' script='Latn'>Natural rubber latex concentrate</title>
795
+ <title type='title-main' format='text/plain' language='en' script='Latn'>Determination of dry rubber content</title>
796
+ <title type='main' format='text/plain' language='en' script='Latn'>
797
+ Natural rubber latex concentrate&#8201;&#8212;&#8201;Determination of
798
+ dry rubber content
799
+ </title>
800
+ <title type='title-intro' format='text/plain' language='fr' script='Latn'>Latex de caoutchouc naturel concentr&#233;</title>
801
+ <title type='title-main' format='text/plain' language='fr' script='Latn'>D&#233;termination de la teneur en caoutchouc sec</title>
802
+ <title type='main' format='text/plain' language='fr' script='Latn'>
803
+ Latex de caoutchouc naturel
804
+ concentr&#233;&#8201;&#8212;&#8201;D&#233;termination de la teneur en
805
+ caoutchouc sec
806
+ </title>
807
+ <uri type='src'>https://www.iso.org/standard/35176.html</uri>
808
+ <uri type='obp'>https://www.iso.org/obp/ui/#!iso:std:35176:en</uri>
809
+ <uri type='rss'>https://www.iso.org/contents/data/standard/03/51/35176.detail.rss</uri>
810
+ <docidentifier type='ISO'>ISO 126:2005</docidentifier>
811
+ <docidentifier type='URN'>urn:iso:std:iso:126:stage-90.93:ed-5:en,fr</docidentifier>
812
+ <docnumber>126</docnumber>
813
+ <date type='published'>
814
+ <on>2005-04</on>
815
+ </date>
816
+ <contributor>
817
+ <role type='publisher'/>
818
+ <organization>
819
+ <name>International Organization for Standardization</name>
820
+ <abbreviation>ISO</abbreviation>
821
+ <uri>www.iso.org</uri>
822
+ </organization>
823
+ </contributor>
824
+ <edition>5</edition>
825
+ <language>en</language>
826
+ <language>fr</language>
827
+ <script>Latn</script>
828
+ <abstract format='text/plain' language='en' script='Latn'>
829
+ ISO 126:2005 specifies a method for the determination of the dry
830
+ rubber content of natural rubber latex concentrate. The method is not
831
+ necessarily suitable for latices preserved with potassium hydroxide,
832
+ latices from natural sources other than Hevea brasiliensis, or for
833
+ compounded latex, vulcanized latex or artificial dispersions of rubber
834
+ and it is not applicable to synthetic rubber latices.
835
+ </abstract>
836
+ <abstract format='text/plain' language='fr' script='Latn'>
837
+ L&#8217;ISO 126:2005 sp&#233;cifie une m&#233;thode de
838
+ d&#233;termination de la teneur en caoutchouc sec du latex de
839
+ caoutchouc naturel concentr&#233;. La m&#233;thode ne convient pas
840
+ n&#233;cessairement pour les latex conserv&#233;s dans de
841
+ l&#8217;hydroxyde de potassium, pour les latex d&#8217;origine
842
+ naturelle autres que celui de l&#8217;Hevea brasiliensis ou pour des
843
+ m&#233;langes de latex, pour les latex vulcanis&#233;s ou les
844
+ dispersions artificielles de caoutchouc, et elle n&#8217;est pas
845
+ applicable aux latex d&#8217;&#233;lastom&#232;res.
846
+ </abstract>
847
+ <status>
848
+ <stage>90</stage>
849
+ <substage>93</substage>
850
+ </status>
851
+ <copyright>
852
+ <from>2005</from>
853
+ <owner>
854
+ <organization>
855
+ <name>ISO</name>
856
+ </organization>
857
+ </owner>
858
+ </copyright>
859
+ <relation type='obsoletes'>
860
+ <bibitem type='standard'>
861
+ <formattedref format='text/plain'>ISO 126:1995</formattedref>
862
+ </bibitem>
863
+ </relation>
864
+ <place>Geneva</place>
865
+ </bibitem>
866
+ </relation>
867
+ <relation type='updates'>
868
+ <description>amends</description>
869
+ <bibitem>
870
+ <title>--</title>
871
+ <docidentifier>ISO 123</docidentifier>
872
+ </bibitem>
873
+ </relation>
874
+ <relation type='updates'>
875
+ <description>amends</description>
876
+ <bibitem>
877
+ <title>--</title>
878
+ <docidentifier>ISO 124</docidentifier>
879
+ </bibitem>
880
+ </relation>
881
+ <ext>
882
+ <doctype>article</doctype>
883
+ <editorialgroup>
884
+ <technical-committee/>
885
+ <subcommittee/>
886
+ <workgroup/>
887
+ </editorialgroup>
888
+ <stagename>International standard</stagename>
889
+ </ext>
890
+ </bibdata>
891
+ <sections> </sections>
892
+ </iso-standard>
893
+ OUTPUT
894
+ end
895
+ end
896
+
724
897
  it "reads scripts into blank HTML document" do
725
898
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
726
899
  = Document title
@@ -0,0 +1,38 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes a blank document" do
5
+ input = <<~INPUT
6
+ #{ASCIIDOC_BLANK_HDR}
7
+ INPUT
8
+ output = <<~OUTPUT
9
+ #{BLANK_HDR}
10
+ <sections/>
11
+ </iso-standard>
12
+ OUTPUT
13
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
14
+ .to be_equivalent_to xmlpp(output)
15
+ end
16
+
17
+ it "converts a blank document" do
18
+ input = <<~INPUT
19
+ = Document title
20
+ Author
21
+ :docfile: test.adoc
22
+ :novalid:
23
+ :no-isobib:
24
+ INPUT
25
+ output = <<~OUTPUT
26
+ #{BLANK_HDR}
27
+ <sections/>
28
+ </iso-standard>
29
+ OUTPUT
30
+ expect(xmlpp(Asciidoctor.convert(input, *OPTIONS)))
31
+ .to be_equivalent_to xmlpp(output)
32
+ expect(File.exist?("test_alt.html")).to be true
33
+ expect(File.exist?("test.html")).to be true
34
+ expect(File.exist?("test.doc")).to be true
35
+ expect(File.exist?("test.pdf")).to be true
36
+ expect(File.exist?("htmlstyle.css")).to be false
37
+ end
38
+ end