metanorma-iso 1.7.1 → 1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +11 -41
  3. data/.gitignore +2 -0
  4. data/.rubocop.yml +6 -2
  5. data/lib/asciidoctor/iso/base.rb +18 -16
  6. data/lib/asciidoctor/iso/biblio.rng +4 -6
  7. data/lib/asciidoctor/iso/cleanup.rb +28 -24
  8. data/lib/asciidoctor/iso/front.rb +26 -16
  9. data/lib/asciidoctor/iso/front_id.rb +30 -25
  10. data/lib/asciidoctor/iso/isodoc.rng +172 -3
  11. data/lib/asciidoctor/iso/isostandard-amd.rng +3 -0
  12. data/lib/asciidoctor/iso/isostandard.rng +17 -97
  13. data/lib/asciidoctor/iso/validate.rb +22 -109
  14. data/lib/asciidoctor/iso/validate_image.rb +97 -0
  15. data/lib/asciidoctor/iso/validate_requirements.rb +26 -20
  16. data/lib/asciidoctor/iso/validate_section.rb +39 -20
  17. data/lib/asciidoctor/iso/validate_style.rb +36 -24
  18. data/lib/asciidoctor/iso/validate_title.rb +23 -17
  19. data/lib/isodoc/iso/base_convert.rb +19 -2
  20. data/lib/isodoc/iso/html/style-human.css +7 -0
  21. data/lib/isodoc/iso/html/style-iso.css +7 -0
  22. data/lib/isodoc/iso/html_convert.rb +0 -1
  23. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  24. data/lib/isodoc/iso/i18n-fr.yaml +4 -0
  25. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  26. data/lib/isodoc/iso/index.rb +140 -0
  27. data/lib/isodoc/iso/iso.amendment.xsl +1092 -208
  28. data/lib/isodoc/iso/iso.international-standard.xsl +1092 -208
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +45 -37
  30. data/lib/isodoc/iso/word_convert.rb +0 -1
  31. data/lib/isodoc/iso/xref.rb +15 -7
  32. data/lib/metanorma/iso/processor.rb +1 -0
  33. data/lib/metanorma/iso/version.rb +1 -1
  34. data/metanorma-iso.gemspec +8 -8
  35. data/spec/asciidoctor/amd_spec.rb +696 -0
  36. data/spec/asciidoctor/base_spec.rb +733 -0
  37. data/spec/asciidoctor/blocks_spec.rb +527 -0
  38. data/spec/asciidoctor/cleanup_spec.rb +1134 -0
  39. data/spec/asciidoctor/inline_spec.rb +195 -0
  40. data/spec/asciidoctor/lists_spec.rb +197 -0
  41. data/spec/asciidoctor/refs_spec.rb +375 -0
  42. data/spec/asciidoctor/section_spec.rb +393 -0
  43. data/spec/asciidoctor/table_spec.rb +329 -0
  44. data/spec/asciidoctor/validate_spec.rb +1627 -0
  45. data/spec/isodoc/amd_spec.rb +967 -946
  46. data/spec/isodoc/blocks_spec.rb +530 -507
  47. data/spec/isodoc/i18n_spec.rb +953 -911
  48. data/spec/isodoc/inline_spec.rb +355 -293
  49. data/spec/isodoc/iso_spec.rb +338 -314
  50. data/spec/isodoc/metadata_spec.rb +392 -382
  51. data/spec/isodoc/postproc_spec.rb +836 -657
  52. data/spec/isodoc/ref_spec.rb +374 -331
  53. data/spec/isodoc/section_spec.rb +821 -519
  54. data/spec/isodoc/table_spec.rb +472 -411
  55. data/spec/isodoc/terms_spec.rb +209 -185
  56. data/spec/isodoc/xref_spec.rb +1370 -1236
  57. data/spec/metanorma/processor_spec.rb +28 -26
  58. data/spec/spec_helper.rb +178 -193
  59. metadata +65 -66
  60. data/.rubocop.ribose.yml +0 -66
  61. data/lib/isodoc/iso/html/scripts.html +0 -178
  62. data/spec/asciidoctor-iso/amd_spec.rb +0 -694
  63. data/spec/asciidoctor-iso/base_spec.rb +0 -713
  64. data/spec/asciidoctor-iso/blocks_spec.rb +0 -482
  65. data/spec/asciidoctor-iso/cleanup_spec.rb +0 -1025
  66. data/spec/asciidoctor-iso/inline_spec.rb +0 -170
  67. data/spec/asciidoctor-iso/lists_spec.rb +0 -190
  68. data/spec/asciidoctor-iso/refs_spec.rb +0 -317
  69. data/spec/asciidoctor-iso/section_spec.rb +0 -362
  70. data/spec/asciidoctor-iso/table_spec.rb +0 -313
  71. data/spec/asciidoctor-iso/validate_spec.rb +0 -1621
  72. data/spec/assets/xref_error.adoc +0 -7
@@ -0,0 +1,195 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes inline_quoted formatting" do
5
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
+ #{ASCIIDOC_BLANK_HDR}
7
+ _emphasis_
8
+ *strong*
9
+ `monospace`
10
+ "double quote"
11
+ 'single quote'
12
+ super^script^
13
+ sub~script~
14
+ stem:[a_90]
15
+ stem:[<mml:math><mml:msub xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">F</mml:mi> </mml:mrow> </mml:mrow> <mml:mrow> <mml:mrow> <mml:mi mathvariant="bold-italic">&#x391;</mml:mi> </mml:mrow> </mml:mrow> </mml:msub> </mml:math>]
16
+ [alt]#alt#
17
+ [deprecated]#deprecated#
18
+ [domain]#domain#
19
+ [strike]#strike#
20
+ [smallcap]#smallcap#
21
+ INPUT
22
+ #{BLANK_HDR}
23
+ <sections>
24
+ <em>emphasis</em>
25
+ <strong>strong</strong>
26
+ <tt>monospace</tt>“double quote”
27
+ ‘single quote’
28
+ super
29
+ <sup>script</sup>
30
+ sub
31
+ <sub>script</sub>
32
+ <stem type="MathML">
33
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
34
+ <msub>
35
+ <mrow>
36
+ <mi>a</mi></mrow>
37
+ <mrow>
38
+ <mn>90</mn>
39
+ </mrow>
40
+ </msub>
41
+ </math>
42
+ </stem>
43
+ <stem type="MathML">
44
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
45
+ <msub>
46
+ <mrow>
47
+ <mrow>
48
+ <mi mathvariant="bold-italic">F</mi>
49
+ </mrow>
50
+ </mrow>
51
+ <mrow>
52
+ <mrow>
53
+ <mi mathvariant="bold-italic">Α</mi>
54
+ </mrow>
55
+ </mrow>
56
+ </msub>
57
+ </math>
58
+ </stem>
59
+ <admitted>alt</admitted>
60
+ <deprecates>deprecated</deprecates>
61
+ <domain>domain</domain>
62
+ <strike>strike</strike>
63
+ <smallcap>smallcap</smallcap>
64
+ </sections>
65
+ </iso-standard>
66
+ OUTPUT
67
+ end
68
+
69
+ it "processes breaks" do
70
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
71
+ #{ASCIIDOC_BLANK_HDR}
72
+ Line break +
73
+ line break
74
+
75
+ '''
76
+
77
+ <<<
78
+ INPUT
79
+ #{BLANK_HDR}
80
+ <sections>
81
+ <p id="_">Line break
82
+ <br/>
83
+ line break</p>
84
+ <hr/>
85
+ <pagebreak/>
86
+ </sections>
87
+ </iso-standard>
88
+ OUTPUT
89
+ end
90
+
91
+ it "processes links" do
92
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
93
+ #{ASCIIDOC_BLANK_HDR}
94
+ mailto:fred@example.com
95
+ http://example.com[]
96
+ http://example.com[Link]
97
+ INPUT
98
+ #{BLANK_HDR}
99
+ <sections>
100
+ <p id="_">mailto:fred@example.com
101
+
102
+ <link target="http://example.com"/>
103
+ <link target="http://example.com">Link</link></p>
104
+ </sections>
105
+ </iso-standard>
106
+ OUTPUT
107
+ end
108
+
109
+ it "processes bookmarks" do
110
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
111
+ #{ASCIIDOC_BLANK_HDR}
112
+ Text [[bookmark]] Text
113
+ INPUT
114
+ #{BLANK_HDR}
115
+ <sections>
116
+ <p id="_">Text <bookmark id="bookmark"/> Text</p>
117
+ </sections>
118
+ </iso-standard>
119
+ OUTPUT
120
+ end
121
+
122
+ it "processes crossreferences" do
123
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
124
+ #{ASCIIDOC_BLANK_HDR}
125
+ [[reference]]
126
+ == Section
127
+
128
+ Inline Reference to <<reference>>
129
+ Footnoted Reference to <<reference,fn>>
130
+ Inline Reference with Text to <<reference,text>>
131
+ Footnoted Reference with Text to <<reference,fn: text>>
132
+ INPUT
133
+ #{BLANK_HDR}
134
+ <sections>
135
+ <clause id="reference" inline-header="false" obligation="normative">
136
+ <title>Section</title>
137
+ <p id="_">Inline Reference to <xref target="reference"/>
138
+ Footnoted Reference to <xref target="reference"/>
139
+ Inline Reference with Text to <xref target="reference">text</xref>
140
+ Footnoted Reference with Text to <xref target="reference">text</xref></p>
141
+ </clause>
142
+ </sections>
143
+ </iso-standard>
144
+ OUTPUT
145
+ end
146
+
147
+ it "processes bibliographic anchors" do
148
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
149
+ #{ASCIIDOC_BLANK_HDR}
150
+ [bibliography]
151
+ == Normative References
152
+
153
+ * [[[ISO712,x]]] Reference
154
+ * [[[ISO713]]] Reference
155
+
156
+ INPUT
157
+ #{BLANK_HDR}
158
+ <sections>
159
+
160
+ </sections>
161
+ <bibliography>
162
+ <references id="_" normative="true" obligation="informative">
163
+ <title>Normative references</title>
164
+ <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>
165
+ <bibitem id="ISO712">
166
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
167
+ <docidentifier>x</docidentifier>
168
+ </bibitem>
169
+ <bibitem id="ISO713">
170
+ <formattedref format="application/x-isodoc+xml">Reference</formattedref>
171
+ <docidentifier>ISO713</docidentifier>
172
+ <docnumber>713</docnumber>
173
+ </bibitem>
174
+ </references>
175
+ </bibliography>
176
+ </iso-standard>
177
+ OUTPUT
178
+ end
179
+
180
+ it "processes footnotes" do
181
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
182
+ #{ASCIIDOC_BLANK_HDR}
183
+ Hello!footnote:[Footnote text]
184
+ INPUT
185
+ #{BLANK_HDR}
186
+ <sections>
187
+ <p id="_">Hello!
188
+ <fn reference="1">
189
+ <p id="_">Footnote text</p></fn>
190
+ </p>
191
+ </sections>
192
+ </iso-standard>
193
+ OUTPUT
194
+ end
195
+ end
@@ -0,0 +1,197 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Asciidoctor::ISO do
4
+ it "processes simple lists" do
5
+ output = Asciidoctor.convert(<<~"INPUT", *OPTIONS)
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(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"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="_">
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", *OPTIONS)
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(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
102
+ #{BLANK_HDR}
103
+ <sections>
104
+ <ul id="id">
105
+ <li>
106
+ <p id="_">First</p>
107
+ </li>
108
+ <li>
109
+ <p id="_">Second</p>
110
+ <p id="_">entry1</p>
111
+ <p id="_">entry2</p>
112
+ </li>
113
+ </ul>
114
+ <ol id="id1">
115
+ <li>
116
+ <p id="_">First</p>
117
+ </li>
118
+ <li>
119
+ <p id="_">Second</p>
120
+ <ol id="_">
121
+ <li>
122
+ <p id="_">Third</p>
123
+ </li>
124
+ <li>
125
+ <p id="_">Fourth</p>
126
+ </li>
127
+ </ol>
128
+ </li>
129
+ <li>
130
+ <p id="_">Fifth</p>
131
+ </li>
132
+ <li>
133
+ <p id="_">Sixth</p>
134
+ </li>
135
+ </ol>
136
+ <ol id="_">
137
+ <li>
138
+ <p id="_">A</p>
139
+ </li>
140
+ <li>
141
+ <p id="_">B</p>
142
+ <ol id="_">
143
+ <li>
144
+ <p id="_">C</p>
145
+ </li>
146
+ <li>
147
+ <p id="_">D</p>
148
+ <ol id="_">
149
+ <li>
150
+ <p id="_">E</p>
151
+ </li>
152
+ <li>
153
+ <p id="_">F</p>
154
+ <dl id="_">
155
+ <dt>Notes1</dt>
156
+ <dd/>
157
+ <dt>Notes</dt>
158
+ <dd>
159
+ <p id="_">Note 1.</p>
160
+ <p id="_">Note 2.</p>
161
+ <p id="_">Note 3.</p>
162
+ </dd>
163
+ </dl>
164
+ </li>
165
+ </ol>
166
+ </li>
167
+ </ol>
168
+ </li>
169
+ </ol>
170
+ </sections>
171
+ </iso-standard>
172
+ OUTPUT
173
+ end
174
+
175
+ it "anchors lists and list items" do
176
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
177
+ #{ASCIIDOC_BLANK_HDR}
178
+ [[id1]]
179
+ * [[id2]] List item
180
+ * Hello [[id3]] List item
181
+
182
+ INPUT
183
+ #{BLANK_HDR}
184
+ <sections>
185
+ <ul id="id1">
186
+ <li id="id2">
187
+ <p id="_">List item</p>
188
+ </li>
189
+ <li>
190
+ <p id="_">Hello <bookmark id="id3"/> List item</p>
191
+ </li>
192
+ </ul>
193
+ </sections>
194
+ </iso-standard>
195
+ OUTPUT
196
+ end
197
+ end
@@ -0,0 +1,375 @@
1
+ require "spec_helper"
2
+ require "relaton_iso"
3
+ require "relaton_ietf"
4
+
5
+ RSpec.describe Asciidoctor::ISO do
6
+ it "processes draft ISO reference" do
7
+ mock_fdis
8
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
9
+ #{ISOBIB_BLANK_HDR}
10
+ == Clause
11
+ <<iso123>>
12
+ <<iso123>>
13
+ A.footnote:[a footnote]
14
+ <<fdis>>
15
+ <<fdis>>
16
+
17
+ [bibliography]
18
+ == Normative References
19
+
20
+ * [[[iso123,ISO 123:--]]] footnote:[The standard is in press] _Standard_
21
+ * [[[fdis,ISO/FDIS 17664-1]]] Title
22
+ INPUT
23
+ #{BLANK_HDR}
24
+ <sections>
25
+ <clause id="_" inline-header="false" obligation="normative">
26
+ <title>Clause</title>
27
+ <p id="_">
28
+ <eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>
29
+ <fn reference="1">The standard is in press</fn>
30
+ <eref bibitemid="iso123" citeas="ISO 123:--" type="inline"/>A.
31
+ <fn reference="2">
32
+ <p id="_">a footnote</p></fn>
33
+ <eref bibitemid="fdis" citeas="ISO/FDIS 17664-1" type="inline"/>
34
+ <fn reference="3">
35
+ <p id="_">Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
36
+ </fn>
37
+ <eref bibitemid="fdis" citeas="ISO/FDIS 17664-1" type="inline"/>
38
+ </p>
39
+ </clause>
40
+ </sections>
41
+ <bibliography>
42
+ <references id="_" normative="true" obligation="informative">
43
+ <title>Normative references</title>
44
+ <p id="_">The following documents are referred to in the text in such a way that
45
+ some or all of their content constitutes requirements of this document.
46
+ For dated references, only the edition cited applies. For undated
47
+ references, the latest edition of the referenced document (including any
48
+ amendments) applies.
49
+ </p>
50
+ <bibitem id="iso123" type="standard">
51
+ <title format="text/plain">Standard</title>
52
+ <docidentifier type="ISO">ISO 123:—</docidentifier>
53
+ <docnumber>123</docnumber>
54
+ <date type="published">
55
+ <on>–</on>
56
+ </date>
57
+ <contributor>
58
+ <role type="publisher"/>
59
+ <organization>
60
+ <name>International Organization for Standardization</name>
61
+ <abbreviation>ISO</abbreviation>
62
+ </organization>
63
+ </contributor>
64
+ <note format="text/plain" type="Unpublished-Status">The standard is in press</note>
65
+ </bibitem>
66
+ <bibitem id="fdis" type="standard">
67
+ <fetched>#{Date.today}</fetched>
68
+ <title format="text/plain" language="fr" script="Latn" type="title-intro">Traitement de produits de soins de santé</title>
69
+ <title format="text/plain" language="fr" script="Latn" type="title-main">Informations relatives au traitement des dispositifs médicaux à
70
+ fournir par le fabricant du dispositif
71
+ </title>
72
+ <title format="text/plain" language="fr" script="Latn" type="title-part">Partie 1: Titre manque</title>
73
+ <title format="text/plain" language="fr" script="Latn" type="main">Traitement de produits de soins de santé — Informations relatives au
74
+ traitement des dispositifs médicaux à fournir par le fabricant du
75
+ dispositif — Partie 1: Titre manque
76
+ </title>
77
+ <uri type="src">https://www.iso.org/standard/81720.html</uri>
78
+ <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
79
+ <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
80
+ <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
81
+ <docnumber>17664</docnumber>
82
+ <contributor>
83
+ <role type="publisher"/>
84
+ <organization>
85
+ <name>International Organization for Standardization</name>
86
+ <abbreviation>ISO</abbreviation>
87
+ <uri>www.iso.org</uri>
88
+ </organization>
89
+ </contributor>
90
+ <edition>1</edition>
91
+ <note type="Unpublished-Status">
92
+ <p id="_">Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
93
+ </note>
94
+ <language>en</language>
95
+ <language>fr</language>
96
+ <script>Latn</script>
97
+ <status>
98
+ <stage>50</stage>
99
+ <substage>00</substage>
100
+ </status>
101
+ <copyright>
102
+ <from>unknown</from>
103
+ <owner>
104
+ <organization>
105
+ <name>ISO/FDIS</name>
106
+ </organization>
107
+ </owner>
108
+ </copyright>
109
+ <relation type="obsoletes">
110
+ <bibitem type="standard">
111
+ <formattedref format="text/plain">ISO 17664:2017</formattedref>
112
+ </bibitem>
113
+ </relation>
114
+ <relation type="instance">
115
+ <bibitem type="standard">
116
+ <fetched>2020-11-03</fetched>
117
+ <title format="text/plain" language="fr" script="Latn" type="title-intro">Traitement de produits de soins de santé</title>
118
+ <title format="text/plain" language="fr" script="Latn" type="title-main">Informations relatives au traitement des dispositifs médicaux à
119
+ fournir par le fabricant du dispositif
120
+ </title>
121
+ <title format="text/plain" language="fr" script="Latn" type="title-part">Partie 1: Titre manque</title>
122
+ <title format="text/plain" language="fr" script="Latn" type="main">Traitement de produits de soins de santé — Informations relatives
123
+ au traitement des dispositifs médicaux à fournir par le fabricant
124
+ du dispositif — Partie 1: Titre manque
125
+ </title>
126
+ <uri type="src">https://www.iso.org/standard/81720.html</uri>
127
+ <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
128
+ <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
129
+ <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
130
+ <docnumber>17664</docnumber>
131
+ <contributor>
132
+ <role type="publisher"/>
133
+ <organization>
134
+ <name>International Organization for Standardization</name>
135
+ <abbreviation>ISO</abbreviation>
136
+ <uri>www.iso.org</uri>
137
+ </organization>
138
+ </contributor>
139
+ <edition>1</edition>
140
+ <note type="Unpublished-Status">
141
+ <p id="_">Under preparation. (Stage at the time of publication ISO/FDIS 17664-1).</p>
142
+ </note>
143
+ <language>en</language>
144
+ <language>fr</language>
145
+ <script>Latn</script>
146
+ <status>
147
+ <stage>50</stage>
148
+ <substage>00</substage>
149
+ </status>
150
+ <copyright>
151
+ <from>unknown</from>
152
+ <owner>
153
+ <organization>
154
+ <name>ISO/FDIS</name>
155
+ </organization>
156
+ </owner>
157
+ </copyright>
158
+ <relation type="obsoletes">
159
+ <bibitem type="standard">
160
+ <formattedref format="text/plain">ISO 17664:2017</formattedref>
161
+ </bibitem>
162
+ </relation>
163
+ <place>Geneva</place>
164
+ </bibitem>
165
+ </relation>
166
+ <place>Geneva</place>
167
+ </bibitem>
168
+ </references>
169
+ </bibliography>
170
+ </iso-standard>
171
+ OUTPUT
172
+ end
173
+
174
+ it "processes all-parts ISO reference" do
175
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
176
+ #{ASCIIDOC_BLANK_HDR}
177
+
178
+ == Clause
179
+
180
+ <<iso123>>
181
+
182
+ [bibliography]
183
+ == Normative References
184
+
185
+ * [[[iso123,ISO 123:1066 (all parts)]]] _Standard_
186
+ INPUT
187
+ #{BLANK_HDR}
188
+ <sections>
189
+ <clause id="_" inline-header="false" obligation="normative">
190
+ <title>Clause</title>
191
+ <p id="_">
192
+ <eref bibitemid="iso123" citeas="ISO 123:1066" type="inline"/>
193
+ </p>
194
+ </clause>
195
+ </sections>
196
+ <bibliography>
197
+ <references id="_" normative="true" obligation="informative">
198
+ <title>Normative references</title>
199
+ <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>
200
+ <bibitem id="iso123" type="standard">
201
+ <title format="text/plain">Standard</title>
202
+ <docidentifier>ISO 123:1066 (all parts)</docidentifier>
203
+ <docnumber>123</docnumber>
204
+ <date type="published">
205
+ <on>1066</on>
206
+ </date>
207
+ <contributor>
208
+ <role type="publisher"/>
209
+ <organization>
210
+ <name>International Organization for Standardization</name>
211
+ <abbreviation>ISO</abbreviation>
212
+ </organization>
213
+ </contributor>
214
+ <extent type="part">
215
+ <referenceFrom>all</referenceFrom>
216
+ </extent>
217
+ </bibitem>
218
+ </references>
219
+ </bibliography>
220
+ </iso-standard>
221
+ OUTPUT
222
+ end
223
+
224
+ it "processes non-ISO reference in Normative References" do
225
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
226
+ #{ASCIIDOC_BLANK_HDR}
227
+ [bibliography]
228
+ == Normative References
229
+
230
+ * [[[iso123,XYZ 123:1066 (all parts)]]] _Standard_
231
+ INPUT
232
+ #{BLANK_HDR}
233
+ <sections>
234
+
235
+ </sections>
236
+ <bibliography>
237
+ <references id="_" normative="true" obligation="informative">
238
+ <title>Normative references</title>
239
+ <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>
240
+ <bibitem id="iso123">
241
+ <formattedref format="application/x-isodoc+xml">
242
+ <em>Standard</em>
243
+ </formattedref>
244
+ <docidentifier>XYZ 123:1066 (all parts)</docidentifier>
245
+ <docnumber>123:1066 (all parts)</docnumber>
246
+ </bibitem>
247
+ </references>
248
+ </bibliography>
249
+ </iso-standard>
250
+ OUTPUT
251
+ end
252
+
253
+ it "processes non-ISO reference in Bibliography" do
254
+ expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
255
+ #{ASCIIDOC_BLANK_HDR}
256
+ [bibliography]
257
+ == Bibliography
258
+
259
+ * [[[iso123,1]]] _Standard_
260
+ INPUT
261
+ #{BLANK_HDR}
262
+ <sections>
263
+
264
+ </sections>
265
+ <bibliography>
266
+ <references id="_" normative="false" obligation="informative">
267
+ <title>Bibliography</title>
268
+ <bibitem id="iso123">
269
+ <formattedref format="application/x-isodoc+xml">
270
+ <em>Standard</em>
271
+ </formattedref>
272
+ <docidentifier type="metanorma">[1]</docidentifier>
273
+ </bibitem>
274
+ </references>
275
+ </bibliography>
276
+ </iso-standard>
277
+ OUTPUT
278
+ end
279
+
280
+ private
281
+
282
+ def mock_fdis
283
+ expect(RelatonIso::IsoBibliography).to receive(:get)
284
+ .with("ISO/FDIS 17664-1", nil, lang: "en", title: "Title", usrlbl: nil) do
285
+ RelatonIsoBib::XMLParser.from_xml(<<~"OUTPUT")
286
+ <bibitem id="x" type="standard">
287
+ <fetched>#{Date.today}</fetched>
288
+ <title format="text/plain" language="fr" script="Latn" type="title-intro">Traitement de produits de soins de santé</title>
289
+ <title format="text/plain" language="fr" script="Latn" type="title-main">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title>
290
+ <title format="text/plain" language="fr" script="Latn" type="title-part">Partie 1: Titre manque</title>
291
+ <title format="text/plain" language="fr" script="Latn" type="main">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>
292
+ <uri type="src">https://www.iso.org/standard/81720.html</uri>
293
+ <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
294
+ <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
295
+ <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
296
+ <docnumber>17664</docnumber>
297
+ <contributor>
298
+ <role type="publisher"/>
299
+ <organization>
300
+ <name>International Organization for Standardization</name>
301
+ <abbreviation>ISO</abbreviation>
302
+ <uri>www.iso.org</uri>
303
+ </organization>
304
+ </contributor>
305
+ <edition>1</edition>
306
+ <language>en</language>
307
+ <language>fr</language>
308
+ <script>Latn</script>
309
+ <status>
310
+ <stage>50</stage>
311
+ <substage>00</substage>
312
+ </status>
313
+ <copyright>
314
+ <from>unknown</from>
315
+ <owner>
316
+ <organization>
317
+ <name>ISO/FDIS</name>
318
+ </organization>
319
+ </owner>
320
+ </copyright>
321
+ <relation type="obsoletes">
322
+ <bibitem type="standard">
323
+ <formattedref format="text/plain">ISO 17664:2017</formattedref>
324
+ </bibitem>
325
+ </relation>
326
+ <relation type="instance">
327
+ <bibitem type="standard">
328
+ <fetched>2020-11-03</fetched>
329
+ <title format="text/plain" language="fr" script="Latn" type="title-intro">Traitement de produits de soins de santé</title>
330
+ <title format="text/plain" language="fr" script="Latn" type="title-main">Informations relatives au traitement des dispositifs médicaux à fournir par le fabricant du dispositif</title>
331
+ <title format="text/plain" language="fr" script="Latn" type="title-part">Partie 1: Titre manque</title>
332
+ <title format="text/plain" language="fr" script="Latn" type="main">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>
333
+ <uri type="src">https://www.iso.org/standard/81720.html</uri>
334
+ <uri type="rss">https://www.iso.org/contents/data/standard/08/17/81720.detail.rss</uri>
335
+ <docidentifier type="ISO">ISO/FDIS 17664-1</docidentifier>
336
+ <docidentifier type="URN">urn:iso:std:iso-fdis:17664:-1:stage-50.00:ed-1:fr</docidentifier>
337
+ <docnumber>17664</docnumber>
338
+ <contributor>
339
+ <role type="publisher"/>
340
+ <organization>
341
+ <name>International Organization for Standardization</name>
342
+ <abbreviation>ISO</abbreviation>
343
+ <uri>www.iso.org</uri>
344
+ </organization>
345
+ </contributor>
346
+ <edition>1</edition>
347
+ <language>en</language>
348
+ <language>fr</language>
349
+ <script>Latn</script>
350
+ <status>
351
+ <stage>50</stage>
352
+ <substage>00</substage>
353
+ </status>
354
+ <copyright>
355
+ <from>unknown</from>
356
+ <owner>
357
+ <organization>
358
+ <name>ISO/FDIS</name>
359
+ </organization>
360
+ </owner>
361
+ </copyright>
362
+ <relation type="obsoletes">
363
+ <bibitem type="standard">
364
+ <formattedref format="text/plain">ISO 17664:2017</formattedref>
365
+ </bibitem>
366
+ </relation>
367
+ <place>Geneva</place>
368
+ </bibitem>
369
+ </relation>
370
+ <place>Geneva</place>
371
+ </bibitem>
372
+ OUTPUT
373
+ end
374
+ end
375
+ end