metanorma-iso 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) 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 +882 -0
  15. data/Rakefile +6 -0
  16. data/asciidoctor-iso.gemspec.old +50 -0
  17. data/bin/rspec +18 -0
  18. data/docs/customisation.adoc +186 -0
  19. data/docs/guidance.adoc +436 -0
  20. data/docs/htmloutput.adoc +115 -0
  21. data/docs/quickstart.adoc +375 -0
  22. data/lib/asciidoctor-iso.rb +11 -0
  23. data/lib/asciidoctor/iso/base.rb +48 -0
  24. data/lib/asciidoctor/iso/biblio.rng +836 -0
  25. data/lib/asciidoctor/iso/cleanup.rb +39 -0
  26. data/lib/asciidoctor/iso/converter.rb +19 -0
  27. data/lib/asciidoctor/iso/front.rb +131 -0
  28. data/lib/asciidoctor/iso/isodoc.rng +1059 -0
  29. data/lib/asciidoctor/iso/isostandard.rnc +176 -0
  30. data/lib/asciidoctor/iso/isostandard.rng +1001 -0
  31. data/lib/asciidoctor/iso/section.rb +72 -0
  32. data/lib/asciidoctor/iso/validate.rb +190 -0
  33. data/lib/asciidoctor/iso/validate_requirements.rb +105 -0
  34. data/lib/asciidoctor/iso/validate_section.rb +214 -0
  35. data/lib/asciidoctor/iso/validate_style.rb +134 -0
  36. data/lib/asciidoctor/iso/version.rb +5 -0
  37. data/lib/isodoc/iso/html/header.html +206 -0
  38. data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
  39. data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
  40. data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
  41. data/lib/isodoc/iso/html/isodoc.scss +696 -0
  42. data/lib/isodoc/iso/html/scripts.html +174 -0
  43. data/lib/isodoc/iso/html/style-human.scss +1277 -0
  44. data/lib/isodoc/iso/html/style-iso.scss +1257 -0
  45. data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
  46. data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
  47. data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
  48. data/lib/isodoc/iso/html_convert.rb +118 -0
  49. data/lib/isodoc/iso/metadata.rb +107 -0
  50. data/lib/isodoc/iso/word_convert.rb +141 -0
  51. data/lib/metanorma/iso.rb +7 -0
  52. data/lib/metanorma/iso/processor.rb +44 -0
  53. data/spec/asciidoctor-iso/base_spec.rb +350 -0
  54. data/spec/asciidoctor-iso/blocks_spec.rb +469 -0
  55. data/spec/asciidoctor-iso/cleanup_spec.rb +765 -0
  56. data/spec/asciidoctor-iso/inline_spec.rb +162 -0
  57. data/spec/asciidoctor-iso/isobib_cache_spec.rb +332 -0
  58. data/spec/asciidoctor-iso/lists_spec.rb +190 -0
  59. data/spec/asciidoctor-iso/macros_spec.rb +111 -0
  60. data/spec/asciidoctor-iso/refs_spec.rb +643 -0
  61. data/spec/asciidoctor-iso/section_spec.rb +334 -0
  62. data/spec/asciidoctor-iso/table_spec.rb +307 -0
  63. data/spec/asciidoctor-iso/validate_spec.rb +907 -0
  64. data/spec/assets/header.html +7 -0
  65. data/spec/assets/html.css +2 -0
  66. data/spec/assets/htmlcover.html +4 -0
  67. data/spec/assets/htmlintro.html +5 -0
  68. data/spec/assets/i18n.yaml +2 -0
  69. data/spec/assets/iso.doc +1093 -0
  70. data/spec/assets/iso.headless.html +33 -0
  71. data/spec/assets/iso.html +278 -0
  72. data/spec/assets/iso.xml +8 -0
  73. data/spec/assets/rice_image1.png +0 -0
  74. data/spec/assets/scripts.html +3 -0
  75. data/spec/assets/std.css +2 -0
  76. data/spec/assets/word.css +2 -0
  77. data/spec/assets/wordcover.html +3 -0
  78. data/spec/assets/wordintro.html +4 -0
  79. data/spec/examples/103_01_02.html +247 -0
  80. data/spec/examples/english.yaml +69 -0
  81. data/spec/examples/iso_123_.xml +45 -0
  82. data/spec/examples/iso_123_all_parts.xml +45 -0
  83. data/spec/examples/iso_123_no_year_note.xml +46 -0
  84. data/spec/examples/iso_124_.xml +41 -0
  85. data/spec/examples/iso_216_.xml +47 -0
  86. data/spec/examples/iso_iec_12382_.xml +48 -0
  87. data/spec/examples/rice.adoc +715 -0
  88. data/spec/examples/rice.preview.html +1877 -0
  89. data/spec/examples/rice.sh +4 -0
  90. data/spec/examples/rice_images/rice_image1.png +0 -0
  91. data/spec/examples/rice_images/rice_image2.png +0 -0
  92. data/spec/examples/rice_images/rice_image3_1.png +0 -0
  93. data/spec/examples/rice_images/rice_image3_2.png +0 -0
  94. data/spec/examples/rice_images/rice_image3_3.png +0 -0
  95. data/spec/isodoc/i18n_spec.rb +642 -0
  96. data/spec/isodoc/iso_spec.rb +168 -0
  97. data/spec/isodoc/metadata_spec.rb +152 -0
  98. data/spec/isodoc/postproc_spec.rb +405 -0
  99. data/spec/isodoc/section_spec.rb +522 -0
  100. data/spec/isodoc/xref_spec.rb +1337 -0
  101. data/spec/metanorma/processor_spec.rb +70 -0
  102. data/spec/spec_helper.rb +227 -0
  103. metadata +402 -0
@@ -0,0 +1,190 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes simple lists" do
5
+ output = Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
6
+ #{ASCIIDOC_BLANK_HDR}
7
+ * List 1
8
+ * List 2
9
+ * List 3
10
+
11
+ . List A
12
+ . List B
13
+ . List C
14
+
15
+ List D:: List E
16
+ List F:: List G
17
+
18
+ INPUT
19
+ expect(strip_guid(output)).to be_equivalent_to <<~"OUTPUT"
20
+ #{BLANK_HDR}
21
+ <sections>
22
+ <ul id="_">
23
+ <li>
24
+ <p id="_">List 1</p>
25
+ </li>
26
+ <li>
27
+ <p id="_">List 2</p>
28
+ </li>
29
+ <li>
30
+ <p id="_">List 3</p>
31
+ <ol id="_" type="arabic">
32
+ <li>
33
+ <p id="_">List A</p>
34
+ </li>
35
+ <li>
36
+ <p id="_">List B</p>
37
+ </li>
38
+ <li>
39
+ <p id="_">List C</p>
40
+ <dl id="_">
41
+ <dt>List D</dt>
42
+ <dd>
43
+ <p id="_">List E</p>
44
+ </dd>
45
+ <dt>List F</dt>
46
+ <dd>
47
+ <p id="_">List G</p>
48
+ </dd>
49
+ </dl>
50
+ </li>
51
+ </ol>
52
+ </li>
53
+ </ul>
54
+ </sections>
55
+ </iso-standard>
56
+ OUTPUT
57
+ end
58
+
59
+ it "processes complex lists" do
60
+ output = Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)
61
+ #{ASCIIDOC_BLANK_HDR}
62
+ [[id]]
63
+ * First
64
+ * Second
65
+ +
66
+ --
67
+ entry1
68
+
69
+ entry2
70
+ --
71
+
72
+ [[id1]]
73
+ [loweralpha]
74
+ . First
75
+ . Second
76
+ [upperalpha]
77
+ .. Third
78
+ .. Fourth
79
+ . Fifth
80
+ . Sixth
81
+
82
+ [lowerroman]
83
+ . A
84
+ . B
85
+ [upperroman]
86
+ .. C
87
+ .. D
88
+ [arabic]
89
+ ... E
90
+ ... F
91
+
92
+
93
+ Notes1::
94
+ Notes:: Note 1.
95
+ +
96
+ Note 2.
97
+ +
98
+ Note 3.
99
+
100
+ INPUT
101
+ expect(strip_guid(output)).to be_equivalent_to <<~"OUTPUT"
102
+ #{BLANK_HDR}
103
+ <sections><ul id="id">
104
+ <li>
105
+ <p id="_">First</p>
106
+ </li>
107
+ <li><p id="_">Second</p><p id="_">entry1</p>
108
+ <p id="_">entry2</p></li>
109
+ </ul>
110
+ <ol id="id1" type="alphabet">
111
+ <li>
112
+ <p id="_">First</p>
113
+ </li>
114
+ <li>
115
+ <p id="_">Second</p>
116
+ <ol id="_" type="alphabet_upper">
117
+ <li>
118
+ <p id="_">Third</p>
119
+ </li>
120
+ <li>
121
+ <p id="_">Fourth</p>
122
+ </li>
123
+ </ol>
124
+ </li>
125
+ <li>
126
+ <p id="_">Fifth</p>
127
+ </li>
128
+ <li>
129
+ <p id="_">Sixth</p>
130
+ </li>
131
+ </ol>
132
+ <ol id="_" type="roman">
133
+ <li>
134
+ <p id="_">A</p>
135
+ </li>
136
+ <li>
137
+ <p id="_">B</p>
138
+ <ol id="_" type="roman_upper">
139
+ <li>
140
+ <p id="_">C</p>
141
+ </li>
142
+ <li>
143
+ <p id="_">D</p>
144
+ <ol id="_" type="arabic">
145
+ <li>
146
+ <p id="_">E</p>
147
+ </li>
148
+ <li>
149
+ <p id="_">F</p>
150
+ <dl id="_">
151
+ <dt>Notes1</dt>
152
+ <dd/>
153
+ <dt>Notes</dt>
154
+ <dd><p id="_">Note 1.</p><p id="_">Note 2.</p>
155
+ <p id="_">Note 3.</p></dd>
156
+ </dl>
157
+ </li>
158
+ </ol>
159
+ </li>
160
+ </ol>
161
+ </li>
162
+ </ol></sections>
163
+ </iso-standard>
164
+ OUTPUT
165
+ end
166
+
167
+ it "anchors lists and list items" do
168
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
169
+ #{ASCIIDOC_BLANK_HDR}
170
+ [[id1]]
171
+ * [[id2]] List item
172
+ * Hello [[id3]] List item
173
+
174
+ INPUT
175
+ #{BLANK_HDR}
176
+ <sections>
177
+ <ul id="id1">
178
+ <li id="id2">
179
+ <p id="_">List item</p>
180
+ </li>
181
+ <li>
182
+ <p id="_">Hello <bookmark id="id3"/> List item</p>
183
+ </li>
184
+ </ul>
185
+ </sections>
186
+ </iso-standard>
187
+ OUTPUT
188
+ end
189
+
190
+ end
@@ -0,0 +1,111 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes the Asciidoctor::ISO inline macros" do
5
+ expect(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true)).to be_equivalent_to <<~"OUTPUT"
6
+ #{ASCIIDOC_BLANK_HDR}
7
+ alt:[term1]
8
+ deprecated:[term1]
9
+ domain:[term1]
10
+ INPUT
11
+ #{BLANK_HDR}
12
+ <sections>
13
+ <admitted>term1</admitted>
14
+ <deprecates>term1</deprecates>
15
+ <domain>term1</domain>
16
+ </sections>
17
+ </iso-standard>
18
+ OUTPUT
19
+ end
20
+
21
+ it "processes the PlantUML macro" do
22
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
23
+ #{ASCIIDOC_BLANK_HDR}
24
+
25
+ [plantuml]
26
+ ....
27
+ @startuml
28
+ Alice -> Bob: Authentication Request
29
+ Bob --> Alice: Authentication Response
30
+
31
+ Alice -> Bob: Another authentication Request
32
+ Alice <-- Bob: another authentication Response
33
+ @enduml
34
+ ....
35
+
36
+ [plantuml]
37
+ ....
38
+ Alice -> Bob: Authentication Request
39
+ Bob --> Alice: Authentication Response
40
+
41
+ Alice -> Bob: Another authentication Request
42
+ Alice <-- Bob: another authentication Response
43
+ ....
44
+ INPUT
45
+ #{BLANK_HDR}
46
+ <sections><figure id="_">
47
+ <image src="plantuml/20.png" id="_" imagetype="PNG" height="auto" width="auto"/>
48
+ </figure>
49
+ <figure id="_">
50
+ <image src="plantuml/29.png" id="_" imagetype="PNG" height="auto" width="auto"/>
51
+ </figure></sections>
52
+
53
+ </iso-standard>
54
+ OUTPUT
55
+ end
56
+
57
+ it "processes the PlantUML macro with PlantUML disabled" do
58
+ mock_plantuml_disabled
59
+ expect { Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true) }.to output(%r{PlantUML not installed}).to_stderr
60
+ #{ASCIIDOC_BLANK_HDR}
61
+
62
+ [plantuml]
63
+ ....
64
+ @startuml
65
+ Alice -> Bob: Authentication Request
66
+ Bob --> Alice: Authentication Response
67
+
68
+ Alice -> Bob: Another authentication Request
69
+ Alice <-- Bob: another authentication Response
70
+ @enduml
71
+ ....
72
+ INPUT
73
+
74
+ mock_plantuml_disabled
75
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
76
+ #{ASCIIDOC_BLANK_HDR}
77
+
78
+ [plantuml]
79
+ ....
80
+ @startuml
81
+ Alice -> Bob: Authentication Request
82
+ Bob --> Alice: Authentication Response
83
+
84
+ Alice -> Bob: Another authentication Request
85
+ Alice <-- Bob: another authentication Response
86
+ @enduml
87
+ ....
88
+ INPUT
89
+ #{BLANK_HDR}
90
+ <sections>
91
+ <sourcecode id="_">@startuml
92
+ Alice -&gt; Bob: Authentication Request
93
+ Bob --&gt; Alice: Authentication Response
94
+
95
+ Alice -&gt; Bob: Another authentication Request
96
+ Alice &lt;-- Bob: another authentication Response
97
+ @enduml</sourcecode>
98
+ </sourcecode>
99
+ </iso-standard>
100
+ OUTPUT
101
+ end
102
+
103
+
104
+ private
105
+
106
+ def mock_plantuml_disabled
107
+ expect(Asciidoctor::Standoc::PlantUMLBlockMacroBackend).to receive(:plantuml_installed?) do
108
+ false
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,643 @@
1
+ require "spec_helper"
2
+ require "isobib"
3
+
4
+ RSpec.describe Asciidoctor::ISO do
5
+ it "processes simple ISO reference" do
6
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
7
+ #{ASCIIDOC_BLANK_HDR}
8
+ [bibliography]
9
+ == Normative References
10
+
11
+ * [[[iso123,ISO 123]]] _Standard_
12
+ INPUT
13
+ #{BLANK_HDR}
14
+ <sections>
15
+ </sections><bibliography><references id="_" obligation="informative">
16
+ <title>Normative References</title>
17
+ <bibitem id="iso123" type="standard">
18
+ <title format="text/plain">Standard</title>
19
+ <docidentifier>ISO 123</docidentifier>
20
+ <contributor>
21
+ <role type="publisher"/>
22
+ <organization>
23
+ <name>International Organization for Standardization</name>
24
+ <abbreviation>ISO</abbreviation>
25
+ </organization>
26
+ </contributor>
27
+ </bibitem>
28
+ </references>
29
+ </bibliography>
30
+ </iso-standard>
31
+ OUTPUT
32
+ end
33
+
34
+ it "processes simple ISO reference with date range" do
35
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
36
+ #{ASCIIDOC_BLANK_HDR}
37
+ [bibliography]
38
+ == Normative References
39
+
40
+ * [[[iso123,ISO 123:1066-1067]]] _Standard_
41
+ INPUT
42
+ #{BLANK_HDR}
43
+ <sections>
44
+ </sections><bibliography><references id="_" obligation="informative">
45
+ <title>Normative References</title>
46
+ <bibitem id="iso123" type="standard">
47
+ <title format="text/plain">Standard</title>
48
+ <docidentifier>ISO 123</docidentifier>
49
+ <date type="published">
50
+ <from>1066</from>
51
+ <to>1067</to>
52
+ </date>
53
+ <contributor>
54
+ <role type="publisher"/>
55
+ <organization>
56
+ <name>International Organization for Standardization</name>
57
+ <abbreviation>ISO</abbreviation>
58
+ </organization>
59
+ </contributor>
60
+ </bibitem>
61
+ </references>
62
+ </bibliography>
63
+ </iso-standard>
64
+ OUTPUT
65
+ end
66
+
67
+
68
+ it "fetches simple ISO reference" do
69
+ mock_isobib_get_123
70
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
71
+ #{ISOBIB_BLANK_HDR}
72
+ [bibliography]
73
+ == Normative References
74
+
75
+ * [[[iso123,ISO 123]]] _Standard_
76
+ INPUT
77
+ #{BLANK_HDR}
78
+ <sections>
79
+ </sections><bibliography><references id="_" obligation="informative">
80
+ <title>Normative References</title>
81
+ <bibitem type="international-standard" id="iso123">
82
+ <title format="text/plain" language="en" script="Latn">Rubber latex -- Sampling</title>
83
+ <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- ?chantillonnage</title>
84
+ <uri type="src">https://www.iso.org/standard/23281.html</uri>
85
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:23281:en</uri>
86
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/32/23281.detail.rss</uri>
87
+ <docidentifier>ISO 123</docidentifier>
88
+ <date type="published">
89
+ <on>2001</on>
90
+ </date>
91
+ <contributor>
92
+ <role type="publisher"/>
93
+ <organization>
94
+ <name>International Organization for Standardization</name>
95
+ <abbreviation>ISO</abbreviation>
96
+ <uri>www.iso.org</uri>
97
+ </organization>
98
+ </contributor>
99
+ <edition>3</edition>
100
+ <language>en</language>
101
+ <language>fr</language>
102
+ <script>Latn</script>
103
+ <status>Published</status>
104
+ <copyright>
105
+ <from>2001</from>
106
+ <owner>
107
+ <organization>
108
+ <name>ISO</name>
109
+ <abbreviation/>
110
+ </organization>
111
+ </owner>
112
+ </copyright>
113
+ <relation type="obsoletes">
114
+ <bibitem>
115
+ <formattedref>ISO 123:1985</formattedref>
116
+ </bibitem>
117
+ </relation>
118
+ <relation type="updates">
119
+ <bibitem>
120
+ <formattedref>ISO 123:2001</formattedref>
121
+ </bibitem>
122
+ </relation>
123
+ </bibitem>
124
+ </references></bibliography>
125
+ </iso-standard>
126
+ OUTPUT
127
+ end
128
+
129
+ it "processes simple IEC reference" do
130
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
131
+ #{ASCIIDOC_BLANK_HDR}
132
+ [bibliography]
133
+ == Normative References
134
+
135
+ * [[[iso123,IEC 123]]] _Standard_
136
+ INPUT
137
+ #{BLANK_HDR}
138
+ <sections>
139
+ </sections><bibliography><references id="_" obligation="informative">
140
+ <title>Normative References</title>
141
+ <bibitem id="iso123" type="standard">
142
+ <title format="text/plain">Standard</title>
143
+ <docidentifier>IEC 123</docidentifier>
144
+ <contributor>
145
+ <role type="publisher"/>
146
+ <organization>
147
+ <name>International Electrotechnical Commission</name>
148
+ <abbreviation>IEC</abbreviation>
149
+ </organization>
150
+ </contributor>
151
+ </bibitem>
152
+ </references>
153
+ </bibliography>
154
+ </iso-standard>
155
+ OUTPUT
156
+ end
157
+
158
+ it "processes dated ISO reference and joint ISO/IEC references" do
159
+ mock_isobib_get_iec12382
160
+ mock_isobib_get_124
161
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
162
+ #{ISOBIB_BLANK_HDR}
163
+ [bibliography]
164
+ == Normative References
165
+
166
+ * [[[iso123,ISO/IEC TR 12382:1992]]] _Standard_
167
+ * [[[iso124,ISO 124:2014]]] _Standard_
168
+ INPUT
169
+ #{BLANK_HDR}
170
+ <sections>
171
+
172
+ </sections><bibliography><references id="_" obligation="informative">
173
+ <title>Normative References</title>
174
+ <bibitem type="international-standard" id="iso123">
175
+ <title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
176
+ <title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
177
+ <uri type="src">https://www.iso.org/standard/21071.html</uri>
178
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
179
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
180
+ <docidentifier>ISO/IEC 12382</docidentifier>
181
+ <date type="published">
182
+ <on>1992</on>
183
+ </date>
184
+ <contributor>
185
+ <role type="publisher"/>
186
+ <organization>
187
+ <name>International Organization for Standardization</name>
188
+ <abbreviation>ISO</abbreviation>
189
+ <uri>www.iso.org</uri>
190
+ </organization>
191
+ </contributor>
192
+ <contributor>
193
+ <role type="publisher"/>
194
+ <organization>
195
+ <name>International Electrotechnical Commission</name>
196
+ <abbreviation>IEC</abbreviation>
197
+ <uri>www.iec.ch</uri>
198
+ </organization>
199
+ </contributor>
200
+ <edition>2</edition>
201
+ <language>en</language>
202
+ <language>fr</language>
203
+ <script>Latn</script>
204
+ <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>
205
+ <status>Published</status>
206
+ <copyright>
207
+ <from>1992</from>
208
+ <owner>
209
+ <organization>
210
+ <name>ISO/IEC</name>
211
+ <abbreviation/>
212
+ </organization>
213
+ </owner>
214
+ </copyright>
215
+ <relation type="updates">
216
+ <bibitem>
217
+ <formattedref>ISO/IEC TR 12382:1992</formattedref>
218
+ </bibitem>
219
+ </relation>
220
+ <ics>
221
+ <code>35.020</code>
222
+ <text>Information technology (IT) in general</text>
223
+ </ics>
224
+ <ics>
225
+ <code>01.040.35</code>
226
+ <text>Information technology (Vocabularies)</text>
227
+ </ics>
228
+ </bibitem>
229
+ <bibitem type="international-standard" id="iso124">
230
+ <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
231
+ <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
232
+ <uri type="src">https://www.iso.org/standard/61884.html</uri>
233
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
234
+ <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
235
+ <docidentifier>ISO 124</docidentifier>
236
+ <date type="published">
237
+ <on>2014</on>
238
+ </date>
239
+ <contributor>
240
+ <role type="publisher"/>
241
+ <organization>
242
+ <name>International Organization for Standardization</name>
243
+ <abbreviation>ISO</abbreviation>
244
+ <uri>www.iso.org</uri>
245
+ </organization>
246
+ </contributor>
247
+ <edition>7</edition>
248
+ <language>en</language>
249
+ <language>fr</language>
250
+ <script>Latn</script>
251
+ <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>
252
+ <status>Published</status>
253
+ <copyright>
254
+ <from>2014</from>
255
+ <owner>
256
+ <organization>
257
+ <name>ISO</name>
258
+ <abbreviation/>
259
+ </organization>
260
+ </owner>
261
+ </copyright>
262
+ <relation type="obsoletes">
263
+ <bibitem>
264
+ <formattedref>ISO 124:2011</formattedref>
265
+ </bibitem>
266
+ </relation>
267
+ <ics>
268
+ <code>83.040.10</code>
269
+ <text>Latex and raw rubber</text>
270
+ </ics>
271
+ </bibitem>
272
+ </references>
273
+ </bibliography>
274
+ </iso-standard>
275
+ OUTPUT
276
+ end
277
+
278
+ it "processes draft ISO reference" do
279
+ #stub_fetch_ref no_year: true, note: "The standard is in press"
280
+
281
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
282
+ #{ASCIIDOC_BLANK_HDR}
283
+ [bibliography]
284
+ == Normative References
285
+
286
+ * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
287
+ INPUT
288
+ #{BLANK_HDR}
289
+ <sections>
290
+ </sections><bibliography><references id="_" obligation="informative">
291
+ <title>Normative References</title>
292
+ <bibitem id="iso123" type="standard">
293
+ <title format="text/plain">Standard</title>
294
+ <docidentifier>ISO 123</docidentifier>
295
+ <date type="published">
296
+ <on>--</on>
297
+ </date>
298
+ <contributor>
299
+ <role type="publisher"/>
300
+ <organization>
301
+ <name>International Organization for Standardization</name>
302
+ <abbreviation>ISO</abbreviation>
303
+ </organization>
304
+ </contributor>
305
+ <note format="text/plain" reference="1">ISO DATE: The standard is in press</note>
306
+ </bibitem>
307
+ </references>
308
+ </bibliography>
309
+ </iso-standard>
310
+ OUTPUT
311
+ end
312
+
313
+ it "processes all-parts ISO reference" do
314
+ #stub_fetch_ref(all_parts: true)
315
+
316
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
317
+ #{ASCIIDOC_BLANK_HDR}
318
+ [bibliography]
319
+ == Normative References
320
+
321
+ * [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
322
+ INPUT
323
+ #{BLANK_HDR}
324
+ <sections>
325
+ </sections><bibliography><references id="_" obligation="informative">
326
+ <title>Normative References</title>
327
+ <bibitem id="iso123" type="standard">
328
+ <title format="text/plain">Standard</title>
329
+ <docidentifier>ISO 123</docidentifier>
330
+ <date type="published">
331
+ <on>1066</on>
332
+ </date>
333
+ <contributor>
334
+ <role type="publisher"/>
335
+ <organization>
336
+ <name>International Organization for Standardization</name>
337
+ <abbreviation>ISO</abbreviation>
338
+ </organization>
339
+ </contributor>
340
+ <allParts>true</allParts>
341
+ </bibitem>
342
+ </references>
343
+ </bibliography>
344
+ </iso-standard>
345
+ OUTPUT
346
+ end
347
+
348
+ it "processes RFC reference in Normative References" do
349
+ mock_rfcbib_get_rfc8341
350
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
351
+ #{ISOBIB_BLANK_HDR}
352
+ [bibliography]
353
+ == Normative References
354
+
355
+ * [[[iso123,IETF RFC 8341]]] _Standard_
356
+ INPUT
357
+ #{BLANK_HDR}
358
+ <sections>
359
+
360
+ </sections><bibliography><references id="_" obligation="informative">
361
+ <title>Normative References</title>
362
+ <bibitem type="" id="iso123">
363
+ <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
364
+ <docidentifier>8341</docidentifier>
365
+ <date type="published">
366
+ <on>2018</on>
367
+ </date>
368
+ <status>published</status>
369
+ </bibitem>
370
+ </references>
371
+ </bibliography>
372
+ </iso-standard>
373
+ OUTPUT
374
+ end
375
+
376
+ it "processes non-ISO reference in Normative References" do
377
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
378
+ #{ASCIIDOC_BLANK_HDR}
379
+ [bibliography]
380
+ == Normative References
381
+
382
+ * [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
383
+ INPUT
384
+ #{BLANK_HDR}
385
+ <sections>
386
+
387
+ </sections><bibliography><references id="_" obligation="informative">
388
+ <title>Normative References</title>
389
+ <bibitem id="iso123">
390
+ <formattedref format="application/x-isodoc+xml">
391
+ <em>Standard</em>
392
+ </formattedref>
393
+ <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
394
+ </bibitem>
395
+ </references>
396
+ </bibliography>
397
+ </iso-standard>
398
+ OUTPUT
399
+ end
400
+
401
+ it "processes non-ISO reference in Bibliography" do
402
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
403
+ #{ASCIIDOC_BLANK_HDR}
404
+ [bibliography]
405
+ == Bibliography
406
+
407
+ * [[[iso123,1]]] _Standard_
408
+ INPUT
409
+ #{BLANK_HDR}
410
+ <sections>
411
+
412
+ </sections><bibliography><references id="_" obligation="informative">
413
+ <title>Bibliography</title>
414
+ <bibitem id="iso123">
415
+ <formattedref format="application/x-isodoc+xml">
416
+ <em>Standard</em>
417
+ </formattedref>
418
+ <docidentifier>[1]</docidentifier>
419
+ </bibitem>
420
+ </references>
421
+ </bibliography>
422
+ </iso-standard>
423
+ OUTPUT
424
+ end
425
+
426
+ it "process ISO reference without an Internet connection" do
427
+ expect(Isobib::IsoBibliography).to receive(:search).with("ISO 123") do
428
+ raise Algolia::AlgoliaProtocolError.new "getaddrinfo", "nodename nor servname provided, or not known (JCL49WV5AR-dsn.algolia.net:443)"
429
+ end.at_least :once
430
+ expect(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iso, header_footer: true))).to be_equivalent_to <<~"OUTPUT"
431
+ #{ISOBIB_BLANK_HDR}
432
+ [bibliography]
433
+ == Normative References
434
+
435
+ * [[[iso123,ISO 123]]] _Standard_
436
+ INPUT
437
+ <?xml version="1.0" encoding="UTF-8"?>
438
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
439
+ <bibdata type="article">
440
+ <title>
441
+
442
+ </title>
443
+ <title>
444
+
445
+ </title>
446
+ <docidentifier>
447
+ <project-number>ISO </project-number>
448
+ </docidentifier>
449
+ <contributor>
450
+ <role type="author"/>
451
+ <organization>
452
+ <name>International Organization for Standardization</name>
453
+ <abbreviation>ISO</abbreviation>
454
+ </organization>
455
+ </contributor>
456
+ <contributor>
457
+ <role type="publisher"/>
458
+ <organization>
459
+ <name>International Organization for Standardization</name>
460
+ <abbreviation>ISO</abbreviation>
461
+ </organization>
462
+ </contributor>
463
+ <language>en</language>
464
+ <script>Latn</script>
465
+ <status>
466
+ <stage>60</stage>
467
+ <substage>60</substage>
468
+ </status>
469
+ <copyright>
470
+ <from>2018</from>
471
+ <owner>
472
+ <organization>
473
+ <name>International Organization for Standardization</name>
474
+ <abbreviation>ISO</abbreviation>
475
+ </organization>
476
+ </owner>
477
+ </copyright>
478
+ <editorialgroup>
479
+ <technical-committee/>
480
+ <subcommittee/>
481
+ <workgroup/>
482
+ </editorialgroup>
483
+ </bibdata>
484
+ <sections>
485
+
486
+ </sections><bibliography><references id="_" obligation="informative">
487
+ <title>Normative References</title>
488
+ <bibitem id="iso123" type="standard">
489
+ <title format="text/plain">Standard</title>
490
+ <docidentifier>ISO 123</docidentifier>
491
+ <contributor>
492
+ <role type="publisher"/>
493
+ <organization>
494
+ <name>International Organization for Standardization</name>
495
+ <abbreviation>ISO</abbreviation>
496
+ </organization>
497
+ </contributor>
498
+ </bibitem>
499
+ </references></bibliography>
500
+ </iso-standard>
501
+ OUTPUT
502
+ end
503
+
504
+ private
505
+
506
+ private
507
+
508
+ def mock_isobib_get_123
509
+ expect(Isobib::IsoBibliography).to receive(:get).with("ISO 123", nil, {}) do
510
+ IsoBibItem.from_xml(<<~"OUTPUT")
511
+ <bibitem type=\"international-standard\" id=\"ISO123\">\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>ISO 123</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>
512
+ OUTPUT
513
+ end
514
+ end
515
+
516
+ def mock_isobib_get_124
517
+ expect(Isobib::IsoBibliography).to receive(:get).with("ISO 124", "2014", {}) do
518
+ IsoBibItem.from_xml(<<~"OUTPUT")
519
+ <bibitem type="international-standard" id="iso124">
520
+ <title format="text/plain" language="en" script="Latn">Latex, rubber -- Determination of total solids content</title>
521
+ <title format="text/plain" language="fr" script="Latn">Latex de caoutchouc -- Détermination des matières solides totales</title>
522
+ <uri type="src">https://www.iso.org/standard/61884.html</uri>
523
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:61884:en</uri>
524
+ <uri type="rss">https://www.iso.org/contents/data/standard/06/18/61884.detail.rss</uri>
525
+ <docidentifier>ISO 124</docidentifier>
526
+ <date type="published">
527
+ <on>2014</on>
528
+ </date>
529
+ <contributor>
530
+ <role type="publisher"/>
531
+ <organization>
532
+ <name>International Organization for Standardization</name>
533
+ <abbreviation>ISO</abbreviation>
534
+ <uri>www.iso.org</uri>
535
+ </organization>
536
+ </contributor>
537
+ <edition>7</edition>
538
+ <language>en</language>
539
+ <language>fr</language>
540
+ <script>Latn</script>
541
+ <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>
542
+ <status>Published</status>
543
+ <copyright>
544
+ <from>2014</from>
545
+ <owner>
546
+ <organization>
547
+ <name>ISO</name>
548
+ <abbreviation/>
549
+ </organization>
550
+ </owner>
551
+ </copyright>
552
+ <relation type="obsoletes">
553
+ <bibitem>
554
+ <formattedref>ISO 124:2011</formattedref>
555
+ </bibitem>
556
+ </relation>
557
+ <ics>
558
+ <code>83.040.10</code>
559
+ <text>Latex and raw rubber</text>
560
+ </ics>
561
+ </bibitem>
562
+ OUTPUT
563
+ end
564
+ end
565
+
566
+ def mock_isobib_get_iec12382
567
+ expect(Isobib::IsoBibliography).to receive(:get).with("ISO/IEC TR 12382", "1992", {}) do
568
+ IsoBibItem.from_xml(<<~"OUTPUT")
569
+ <bibitem type="international-standard" id="iso123">
570
+ <title format="text/plain" language="en" script="Latn">Permuted index of the vocabulary of information technology</title>
571
+ <title format="text/plain" language="fr" script="Latn">Index permuté du vocabulaire des technologies de l'information</title>
572
+ <uri type="src">https://www.iso.org/standard/21071.html</uri>
573
+ <uri type="obp">https://www.iso.org/obp/ui/#!iso:std:21071:en</uri>
574
+ <uri type="rss">https://www.iso.org/contents/data/standard/02/10/21071.detail.rss</uri>
575
+ <docidentifier>ISO/IEC 12382</docidentifier>
576
+ <date type="published">
577
+ <on>1992</on>
578
+ </date>
579
+ <contributor>
580
+ <role type="publisher"/>
581
+ <organization>
582
+ <name>International Organization for Standardization</name>
583
+ <abbreviation>ISO</abbreviation>
584
+ <uri>www.iso.org</uri>
585
+ </organization>
586
+ </contributor>
587
+ <contributor>
588
+ <role type="publisher"/>
589
+ <organization>
590
+ <name>International Electrotechnical Commission</name>
591
+ <abbreviation>IEC</abbreviation>
592
+ <uri>www.iec.ch</uri>
593
+ </organization>
594
+ </contributor>
595
+ <edition>2</edition>
596
+ <language>en</language>
597
+ <language>fr</language>
598
+ <script>Latn</script>
599
+ <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>
600
+ <status>Published</status>
601
+ <copyright>
602
+ <from>1992</from>
603
+ <owner>
604
+ <organization>
605
+ <name>ISO/IEC</name>
606
+ <abbreviation/>
607
+ </organization>
608
+ </owner>
609
+ </copyright>
610
+ <relation type="updates">
611
+ <bibitem>
612
+ <formattedref>ISO/IEC TR 12382:1992</formattedref>
613
+ </bibitem>
614
+ </relation>
615
+ <ics>
616
+ <code>35.020</code>
617
+ <text>Information technology (IT) in general</text>
618
+ </ics>
619
+ <ics>
620
+ <code>01.040.35</code>
621
+ <text>Information technology (Vocabularies)</text>
622
+ </ics>
623
+ </bibitem>
624
+ OUTPUT
625
+ end
626
+ end
627
+
628
+ def mock_rfcbib_get_rfc8341
629
+ expect(RfcBib::RfcBibliography).to receive(:get).with("RFC 8341", nil, {}) do
630
+ IsoBibItem.from_xml(<<~"OUTPUT")
631
+ <bibitem id="RFC8341">
632
+ <title format="text/plain" language="en" script="Latn">Network Configuration Access Control Model</title>
633
+ <docidentifier>8341</docidentifier>
634
+ <date type="published">
635
+ <on>2018</on>
636
+ </date>
637
+ <status>published</status>
638
+ </bibitem>
639
+ OUTPUT
640
+ end
641
+ end
642
+
643
+ end