metanorma-iso 2.2.1 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header-dis.html +111 -29
  3. data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
  4. data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
  5. data/lib/isodoc/iso/html/style-human.css +2 -3
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +2 -3
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
  11. data/lib/isodoc/iso/i18n-en.yaml +13 -8
  12. data/lib/isodoc/iso/i18n-fr.yaml +9 -3
  13. data/lib/isodoc/iso/i18n-ru.yaml +9 -2
  14. data/lib/isodoc/iso/i18n-zh-Hans.yaml +1 -2
  15. data/lib/isodoc/iso/iso.amendment.xsl +226 -40
  16. data/lib/isodoc/iso/iso.international-standard.xsl +226 -40
  17. data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
  18. data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
  19. data/lib/isodoc/iso/presentation_xref.rb +10 -7
  20. data/lib/isodoc/iso/sections.rb +1 -1
  21. data/lib/isodoc/iso/word_convert.rb +6 -4
  22. data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
  23. data/lib/isodoc/iso/word_dis_convert.rb +4 -1
  24. data/lib/metanorma/iso/base.rb +2 -1
  25. data/lib/metanorma/iso/basicdoc.rng +0 -27
  26. data/lib/metanorma/iso/biblio-standoc.rng +164 -0
  27. data/lib/metanorma/iso/biblio.rng +50 -18
  28. data/lib/metanorma/iso/isodoc.rng +68 -206
  29. data/lib/metanorma/iso/isostandard-amd.rng +3 -54
  30. data/lib/metanorma/iso/isostandard-compile.rng +7 -0
  31. data/lib/metanorma/iso/isostandard.rng +1 -195
  32. data/lib/metanorma/iso/relaton-iso.rng +225 -0
  33. data/lib/metanorma/iso/validate.rb +6 -6
  34. data/lib/metanorma/iso/version.rb +1 -1
  35. data/lib/metanorma/requirements/modspec.rb +22 -38
  36. data/metanorma-iso.gemspec +5 -2
  37. metadata +7 -86
  38. data/.github/workflows/rake.yml +0 -15
  39. data/.github/workflows/release.yml +0 -24
  40. data/.github/workflows/ubuntu.yml +0 -41
  41. data/Rakefile +0 -8
  42. data/bin/rspec +0 -17
  43. data/spec/assets/header.html +0 -7
  44. data/spec/assets/html.css +0 -2
  45. data/spec/assets/htmlcover.html +0 -4
  46. data/spec/assets/htmlintro.html +0 -5
  47. data/spec/assets/i18n.yaml +0 -2
  48. data/spec/assets/iso.adoc +0 -10
  49. data/spec/assets/iso.headless.html +0 -33
  50. data/spec/assets/iso.xml +0 -71
  51. data/spec/assets/rice_image1.png +0 -0
  52. data/spec/assets/scripts.html +0 -3
  53. data/spec/assets/std.css +0 -2
  54. data/spec/assets/word.css +0 -2
  55. data/spec/assets/wordcover.html +0 -3
  56. data/spec/assets/wordintro.html +0 -4
  57. data/spec/examples/103_01_02.html +0 -247
  58. data/spec/examples/english.yaml +0 -69
  59. data/spec/examples/iso_123_.xml +0 -45
  60. data/spec/examples/iso_123_all_parts.xml +0 -45
  61. data/spec/examples/iso_123_no_year_note.xml +0 -46
  62. data/spec/examples/iso_124_.xml +0 -41
  63. data/spec/examples/iso_216_.xml +0 -47
  64. data/spec/examples/iso_iec_12382_.xml +0 -48
  65. data/spec/examples/rice.adoc +0 -714
  66. data/spec/examples/rice.preview.html +0 -1870
  67. data/spec/examples/rice.sh +0 -4
  68. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  69. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  70. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  71. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  72. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  73. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  74. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  75. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  76. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  77. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  78. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  79. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  80. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  81. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  82. data/spec/examples/rice_img/rice_image1.png +0 -0
  83. data/spec/examples/rice_img/rice_image2.png +0 -0
  84. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  85. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  86. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  87. data/spec/isodoc/amd_spec.rb +0 -986
  88. data/spec/isodoc/blocks_spec.rb +0 -1174
  89. data/spec/isodoc/i18n_spec.rb +0 -1579
  90. data/spec/isodoc/inline_spec.rb +0 -1060
  91. data/spec/isodoc/iso_spec.rb +0 -255
  92. data/spec/isodoc/metadata_spec.rb +0 -701
  93. data/spec/isodoc/postproc_spec.rb +0 -1089
  94. data/spec/isodoc/ref_spec.rb +0 -439
  95. data/spec/isodoc/section_spec.rb +0 -998
  96. data/spec/isodoc/table_spec.rb +0 -420
  97. data/spec/isodoc/terms_spec.rb +0 -314
  98. data/spec/isodoc/word_dis_spec.rb +0 -2064
  99. data/spec/isodoc/xref_spec.rb +0 -1747
  100. data/spec/metanorma/amd_spec.rb +0 -724
  101. data/spec/metanorma/base_spec.rb +0 -1384
  102. data/spec/metanorma/blank_spec.rb +0 -38
  103. data/spec/metanorma/blocks_spec.rb +0 -624
  104. data/spec/metanorma/cleanup_spec.rb +0 -1645
  105. data/spec/metanorma/inline_spec.rb +0 -203
  106. data/spec/metanorma/lists_spec.rb +0 -197
  107. data/spec/metanorma/macros_spec.rb +0 -99
  108. data/spec/metanorma/processor_spec.rb +0 -161
  109. data/spec/metanorma/refs_spec.rb +0 -672
  110. data/spec/metanorma/section_spec.rb +0 -492
  111. data/spec/metanorma/table_spec.rb +0 -329
  112. data/spec/metanorma/validate_spec.rb +0 -2153
  113. data/spec/relaton/render_spec.rb +0 -568
  114. data/spec/requirements/requirement_components_spec.rb +0 -622
  115. data/spec/requirements/requirements_spec.rb +0 -1681
  116. data/spec/requirements/xref_spec.rb +0 -1211
  117. data/spec/spec_helper.rb +0 -313
  118. data/spec/vcr_cassettes/docrels.yml +0 -385
  119. data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -1,203 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::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>
60
- <expression>
61
- <name>alt</name>
62
- </expression>
63
- </admitted>
64
- <deprecates>
65
- <expression>
66
- <name>deprecated</name>
67
- </expression>
68
- </deprecates>
69
- <domain>domain</domain>
70
- <strike>strike</strike>
71
- <smallcap>smallcap</smallcap>
72
- </sections>
73
- </iso-standard>
74
- OUTPUT
75
- end
76
-
77
- it "processes breaks" do
78
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
79
- #{ASCIIDOC_BLANK_HDR}
80
- Line break +
81
- line break
82
-
83
- '''
84
-
85
- <<<
86
- INPUT
87
- #{BLANK_HDR}
88
- <sections>
89
- <p id="_">Line break
90
- <br/>
91
- line break</p>
92
- <hr/>
93
- <pagebreak/>
94
- </sections>
95
- </iso-standard>
96
- OUTPUT
97
- end
98
-
99
- it "processes links" do
100
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
101
- #{ASCIIDOC_BLANK_HDR}
102
- mailto:fred@example.com
103
- http://example.com[]
104
- http://example.com[Link]
105
- INPUT
106
- #{BLANK_HDR}
107
- <sections>
108
- <p id="_">mailto:fred@example.com
109
-
110
- <link target="http://example.com"/>
111
- <link target="http://example.com">Link</link></p>
112
- </sections>
113
- </iso-standard>
114
- OUTPUT
115
- end
116
-
117
- it "processes bookmarks" do
118
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
119
- #{ASCIIDOC_BLANK_HDR}
120
- Text [[bookmark]] Text
121
- INPUT
122
- #{BLANK_HDR}
123
- <sections>
124
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
125
- </sections>
126
- </iso-standard>
127
- OUTPUT
128
- end
129
-
130
- it "processes crossreferences" do
131
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
132
- #{ASCIIDOC_BLANK_HDR}
133
- [[reference]]
134
- == Section
135
-
136
- Inline Reference to <<reference>>
137
- Footnoted Reference to <<reference,fn>>
138
- Inline Reference with Text to <<reference,text>>
139
- Footnoted Reference with Text to <<reference,fn: text>>
140
- INPUT
141
- #{BLANK_HDR}
142
- <sections>
143
- <clause id="reference" inline-header="false" obligation="normative">
144
- <title>Section</title>
145
- <p id="_">Inline Reference to <xref target="reference"/>
146
- Footnoted Reference to <xref target="reference"/>
147
- Inline Reference with Text to <xref target="reference">text</xref>
148
- Footnoted Reference with Text to <xref target="reference">text</xref></p>
149
- </clause>
150
- </sections>
151
- </iso-standard>
152
- OUTPUT
153
- end
154
-
155
- it "processes bibliographic anchors" do
156
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
157
- #{ASCIIDOC_BLANK_HDR}
158
- [bibliography]
159
- == Normative References
160
-
161
- * [[[ISO712,x]]] Reference
162
- * [[[ISO713]]] Reference
163
-
164
- INPUT
165
- #{BLANK_HDR}
166
- <sections>
167
-
168
- </sections>
169
- <bibliography>
170
- <references id="_" normative="true" obligation="informative">
171
- <title>Normative references</title>
172
- <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>
173
- <bibitem id="ISO712">
174
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
175
- <docidentifier>x</docidentifier>
176
- </bibitem>
177
- <bibitem id="ISO713">
178
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
179
- <docidentifier>ISO713</docidentifier>
180
- <docnumber>713</docnumber>
181
- </bibitem>
182
- </references>
183
- </bibliography>
184
- </iso-standard>
185
- OUTPUT
186
- end
187
-
188
- it "processes footnotes" do
189
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", *OPTIONS)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
190
- #{ASCIIDOC_BLANK_HDR}
191
- Hello!footnote:[Footnote text]
192
- INPUT
193
- #{BLANK_HDR}
194
- <sections>
195
- <p id="_">Hello!
196
- <fn reference="1">
197
- <p id="_">Footnote text</p></fn>
198
- </p>
199
- </sections>
200
- </iso-standard>
201
- OUTPUT
202
- end
203
- end
@@ -1,197 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::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,start=4]
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='_' start='4'>
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
@@ -1,99 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Standoc do
4
- it "processes embed macro with document in a different flavour" do
5
- input = <<~INPUT
6
- #{ASCIIDOC_BLANK_HDR}
7
-
8
- [[clause1]]
9
- == Clause 1
10
-
11
- embed::spec/assets/iso.adoc[]
12
- INPUT
13
- output = <<~OUTPUT
14
- <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Standoc::VERSION}'>
15
- <bibdata type='standard'>
16
- <title language='en' format='text/plain'>Document title</title>
17
- <language>en</language>
18
- <script>Latn</script>
19
- <status>
20
- <stage>published</stage>
21
- </status>
22
- <copyright>
23
- <from>2022</from>
24
- </copyright>
25
- <ext>
26
- <doctype>standard</doctype>
27
- </ext>
28
- <relation type='derivedFrom'>
29
- <bibitem>
30
- <title language='en' format='text/plain' type='main'>
31
- Medical devices — Quality management systems — Requirements for
32
- regulatory purposes
33
- </title>
34
- <title language='en' format='text/plain' type='title-main'>
35
- Medical devices — Quality management systems — Requirements for
36
- regulatory purposes
37
- </title>
38
- <title language='fr' format='text/plain' type='main'>
39
- Dispositifs médicaux — Systèmes de management de la qualité —
40
- Exigences à des fins réglementaires
41
- </title>
42
- <title language='fr' format='text/plain' type='title-main'>
43
- Dispositifs médicaux — Systèmes de management de la qualité —
44
- Exigences à des fins réglementaires
45
- </title>
46
- <contributor>
47
- <role type='author'/>
48
- <organization>
49
- <name>International Organization for Standardization</name>
50
- <abbreviation>ISO</abbreviation>
51
- </organization>
52
- </contributor>
53
- <contributor>
54
- <role type='publisher'/>
55
- <organization>
56
- <name>International Organization for Standardization</name>
57
- <abbreviation>ISO</abbreviation>
58
- </organization>
59
- </contributor>
60
- <language>en</language>
61
- <script>Latn</script>
62
- <status>
63
- <stage abbreviation='IS'>60</stage>
64
- <substage>60</substage>
65
- </status>
66
- <copyright>
67
- <from>2022</from>
68
- <owner>
69
- <organization>
70
- <name>International Organization for Standardization</name>
71
- <abbreviation>ISO</abbreviation>
72
- </organization>
73
- </owner>
74
- </copyright>
75
- <ext>
76
- <doctype>standard</doctype>
77
- <editorialgroup>
78
- <agency>ISO</agency>
79
- </editorialgroup>
80
- <approvalgroup>
81
- <agency>ISO</agency>
82
- </approvalgroup>
83
- <stagename>International standard</stagename>
84
- </ext>
85
- </bibitem>
86
- </relation>
87
- </bibdata>
88
- <sections>
89
- <clause id='clause1' inline-header='false' obligation='normative'>
90
- <title>Clause 1</title>
91
- </clause>
92
- </sections>
93
- </standard-document>
94
- OUTPUT
95
- expect(xmlpp(strip_guid(Asciidoctor
96
- .convert(input, backend: :standoc, header_footer: true))))
97
- .to be_equivalent_to xmlpp(output)
98
- end
99
- end
@@ -1,161 +0,0 @@
1
- require "spec_helper"
2
- require "metanorma"
3
- require "fileutils"
4
-
5
- # RSpec.describe Asciidoctor::Gb do
6
- RSpec.describe Metanorma::Iso::Processor do
7
- registry = Metanorma::Registry.instance
8
- registry.register(Metanorma::Iso::Processor)
9
- processor = registry.find_processor(:iso)
10
-
11
- inputxml = <<~INPUT
12
- <iso-standard xmlns="http://riboseinc.com/isoxml">
13
- <bibdata type="standard">
14
- <title language="en" format="text/plain" type="main">English</title>
15
- <title language="en" format="text/plain" type="title-main">English</title>
16
- <title language="fr" format="text/plain" type="main">French</title>
17
- <title language="fr" format="text/plain" type="title-main">French</title>
18
- <docidentifier type="ISO">ISO DIR 1</docidentifier><docidentifier type="iso-with-lang">ISO DIR 1(F)</docidentifier><docidentifier type="iso-reference">ISO DIR 1(F)</docidentifier>
19
- <docnumber>1</docnumber>
20
- <contributor>
21
- <role type="author"/>
22
- <organization>
23
- <name>International Organization for Standardization</name>
24
- <abbreviation>ISO</abbreviation>
25
- </organization>
26
- </contributor>
27
- <contributor>
28
- <role type="publisher"/>
29
- <organization>
30
- <name>International Organization for Standardization</name>
31
- <abbreviation>ISO</abbreviation>
32
- </organization>
33
- </contributor>
34
- <language>fr</language>
35
- <script>Latn</script>
36
- <status>
37
- <stage abbreviation="IS">60</stage>
38
- <substage>60</substage>
39
- </status>
40
- <copyright>
41
- <from>#{Time.new.year}</from>
42
- <owner>
43
- <organization>
44
- <name>International Organization for Standardization</name>
45
- <abbreviation>ISO</abbreviation>
46
- </organization>
47
- </owner>
48
- </copyright>
49
- <ext>
50
- <doctype>directive</doctype>
51
- <subdoctype>vocabulary</subdoctype>
52
- <editorialgroup>
53
- <technical-committee/>
54
- <subcommittee/>
55
- <workgroup/>
56
- </editorialgroup>
57
- <structuredidentifier>
58
- <project-number>ISO 1</project-number>
59
- </structuredidentifier>
60
- <stagename>International standard</stagename>
61
- </ext>
62
- </bibdata>
63
- <boilerplate>
64
- <copyright-statement>
65
- <clause>
66
- <title>DOCUMENT PROT&#201;G&#201; PAR COPYRIGHT</title>
67
- <p id="boilerplate-year">&#169; ISO 2021</p>
68
-
69
- <p id="boilerplate-message">
70
- Droits de reproduction r&#233;serv&#233;s. Sauf indication contraire, aucune partie de cette publication ne
71
- peut &#234;tre reproduite ni utilis&#233;e sous quelque forme que ce soit et par aucun proc&#233;d&#233;, &#233;lectronique
72
- ou m&#233;canique, y compris la photocopie, l&#8217;affichage sur l&#8217;internet ou sur un Intranet, sans
73
- autorisation &#233;crite pr&#233;alable. Les demandes d&#8217;autorisation peuvent &#234;tre adress&#233;es &#224; l&#8217;ISO &#224;
74
- l&#8217;adresse ci-apr&#232;s ou au comit&#233; membre de l&#8217;ISO dans le pays du demandeur.
75
- </p>
76
-
77
- <p id="boilerplate-address" align="left">
78
- ISO copyright office<br/>
79
- Ch. de Blandonnet 8 &#8226; CP 401<br/>
80
- CH-1214 Vernier, Geneva, Switzerland<br/>
81
- Phone: +41 22 749 01 11<br/>
82
- Email: copyright@iso.org<br/>
83
- Website: www.iso.org
84
- </p>
85
- <p id="boilerplate-place">
86
- Publi&#233; en Suisse
87
- </p>
88
- </clause>
89
- </copyright-statement>
90
-
91
-
92
- </boilerplate>
93
- <sections>
94
- <terms id="H" obligation="normative"><title>1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</title>
95
- <term id="J">
96
- <name>1.1</name>
97
- <preferred>Term2</preferred>
98
- </term>
99
- </terms>
100
- </sections>
101
- </iso-standard>
102
- INPUT
103
-
104
- it "registers against metanorma" do
105
- expect(processor).not_to be nil
106
- end
107
-
108
- it "registers output formats against metanorma" do
109
- expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
110
- [[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:isosts, "iso.sts.xml"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
111
- OUTPUT
112
- end
113
-
114
- it "registers version against metanorma" do
115
- expect(processor.version.to_s).to match(%r{^Metanorma::ISO })
116
- end
117
-
118
- it "generates IsoDoc XML from a blank document" do
119
- input = <<~INPUT
120
- #{ASCIIDOC_BLANK_HDR}
121
- INPUT
122
- output = <<~OUTPUT
123
- #{BLANK_HDR}
124
- <sections/>
125
- </iso-standard>
126
- OUTPUT
127
- expect(xmlpp(processor.input_to_isodoc(input, nil)))
128
- .to be_equivalent_to xmlpp(output)
129
- end
130
-
131
- it "generates HTML from Metanorma XML" do
132
- FileUtils.rm_f "test.xml"
133
- FileUtils.rm_f "test.html"
134
- processor.output(inputxml, "test.xml", "test.html", :html)
135
- expect(xmlpp(File.read("test.html", encoding: "utf-8")
136
- .gsub(%r{^.*<main}m, "<main")
137
- .gsub(%r{</main>.*}m, "</main>")))
138
- .to be_equivalent_to xmlpp(<<~"OUTPUT")
139
- <main class="main-section">
140
- <button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
141
- <div class='authority'> </div>
142
- <p class='zzSTDTitle1'>French</p>
143
- <div id="H"><h1 id="toc0">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
144
- <h2 class="TermNum" id="J">1.1</h2>
145
- <p class="Terms" style="text-align:left;">Term2</p>
146
- </div>
147
- </main>
148
- OUTPUT
149
- end
150
-
151
- it "generates STS from Metanorma XML" do
152
- FileUtils.rm_f "test.xml"
153
- FileUtils.rm_f "test.sts.xml"
154
- FileUtils.rm_f "test.iso.sts.xml"
155
- File.write("test.xml", inputxml)
156
- processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
157
- processor.output(inputxml, "test.xml", "test.iso.sts.xml", :isosts)
158
- expect(File.exist?("test.sts.xml")).to be true
159
- expect(File.exist?("test.iso.sts.xml")).to be true
160
- end
161
- end