metanorma-iec 2.1.11 → 2.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iec/html/htmlstyle.css +6 -0
  3. data/lib/isodoc/iec/iec.international-standard.xsl +460 -152
  4. data/lib/isodoc/iec/presentation_xml_convert.rb +8 -6
  5. data/lib/isodoc/iec/word_convert.rb +9 -35
  6. data/lib/metanorma/iec/biblio.rng +5 -0
  7. data/lib/metanorma/iec/iec_intro_en.xml +11 -12
  8. data/lib/metanorma/iec/iec_intro_fr.xml +11 -11
  9. data/lib/metanorma/iec/isodoc.rng +47 -13
  10. data/lib/metanorma/iec/version.rb +1 -1
  11. data/metanorma-iec.gemspec +5 -2
  12. metadata +4 -36
  13. data/.github/workflows/automerge.yml +0 -31
  14. data/.github/workflows/rake.yml +0 -15
  15. data/.github/workflows/release.yml +0 -24
  16. data/Rakefile +0 -8
  17. data/bin/rspec +0 -18
  18. data/spec/assets/header.html +0 -7
  19. data/spec/assets/html.css +0 -2
  20. data/spec/assets/iso.xml +0 -71
  21. data/spec/assets/rice_image1.png +0 -0
  22. data/spec/assets/word.css +0 -2
  23. data/spec/assets/wordintro.html +0 -4
  24. data/spec/assets/xref_error.adoc +0 -7
  25. data/spec/isodoc/blocks_spec.rb +0 -200
  26. data/spec/isodoc/i18n_spec.rb +0 -607
  27. data/spec/isodoc/iev_spec.rb +0 -888
  28. data/spec/isodoc/inline_spec.rb +0 -256
  29. data/spec/isodoc/iso_spec.rb +0 -211
  30. data/spec/isodoc/metadata_spec.rb +0 -251
  31. data/spec/isodoc/postproc_spec.rb +0 -303
  32. data/spec/isodoc/ref_spec.rb +0 -335
  33. data/spec/isodoc/section_spec.rb +0 -566
  34. data/spec/isodoc/terms_spec.rb +0 -192
  35. data/spec/metanorma/base_spec.rb +0 -1041
  36. data/spec/metanorma/blocks_spec.rb +0 -470
  37. data/spec/metanorma/cleanup_spec.rb +0 -372
  38. data/spec/metanorma/iev_spec.rb +0 -254
  39. data/spec/metanorma/inline_spec.rb +0 -145
  40. data/spec/metanorma/lists_spec.rb +0 -194
  41. data/spec/metanorma/processor_spec.rb +0 -171
  42. data/spec/metanorma/section_spec.rb +0 -348
  43. data/spec/metanorma/validate_spec.rb +0 -56
  44. data/spec/spec_helper.rb +0 -305
@@ -1,145 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Iec do
4
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
7
-
8
- it "processes breaks" do
9
- input = <<~INPUT
10
- #{ASCIIDOC_BLANK_HDR}
11
- Line break +
12
- line break
13
-
14
- '''
15
-
16
- <<<
17
- INPUT
18
- output = <<~OUTPUT
19
- #{@blank_hdr}
20
- <sections><p id="_">Line break<br/>
21
- line break</p>
22
- <hr/>
23
- <pagebreak/></sections>
24
- </iec-standard>
25
- OUTPUT
26
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
27
- .to be_equivalent_to xmlpp(output)
28
- end
29
-
30
- it "processes links" do
31
- input = <<~INPUT
32
- #{ASCIIDOC_BLANK_HDR}
33
- mailto:fred@example.com
34
- http://example.com[]
35
- http://example.com[Link]
36
- INPUT
37
- output = <<~OUTPUT
38
- #{@blank_hdr}
39
- <sections>
40
- <p id="_">mailto:fred@example.com
41
- <link target="http://example.com"/>
42
- <link target="http://example.com">Link</link></p>
43
- </sections>
44
- </iec-standard>
45
- OUTPUT
46
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
47
- .to be_equivalent_to xmlpp(output)
48
- end
49
-
50
- it "processes bookmarks" do
51
- input = <<~INPUT
52
- #{ASCIIDOC_BLANK_HDR}
53
- Text [[bookmark]] Text
54
- INPUT
55
- output = <<~OUTPUT
56
- #{@blank_hdr}
57
- <sections>
58
- <p id="_">Text <bookmark id="bookmark"/> Text</p>
59
- </sections>
60
- </iec-standard>
61
- OUTPUT
62
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
63
- .to be_equivalent_to xmlpp(output)
64
- end
65
-
66
- it "processes crossreferences" do
67
- input = <<~INPUT
68
- #{ASCIIDOC_BLANK_HDR}
69
- [[reference]]
70
- == Section
71
-
72
- Inline Reference to <<reference>>
73
- Footnoted Reference to <<reference,fn>>
74
- Inline Reference with Text to <<reference,text>>
75
- Footnoted Reference with Text to <<reference,fn: text>>
76
- INPUT
77
- output = <<~OUTPUT
78
- #{@blank_hdr}
79
- <sections>
80
- <clause id="reference" inline-header="false" obligation="normative">
81
- <title>Section</title>
82
- <p id="_">Inline Reference to <xref target="reference"/>
83
- Footnoted Reference to <xref target="reference"/>
84
- Inline Reference with Text to <xref target="reference">text</xref>
85
- Footnoted Reference with Text to <xref target="reference">text</xref></p>
86
- </clause>
87
- </sections>
88
- </iec-standard>
89
- OUTPUT
90
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
91
- .to be_equivalent_to xmlpp(output)
92
- end
93
-
94
- it "processes bibliographic anchors" do
95
- input = <<~INPUT
96
- #{ASCIIDOC_BLANK_HDR}
97
- [bibliography]
98
- == Normative References
99
-
100
- * [[[ISO712,x]]] Reference
101
- * [[[ISO713]]] Reference
102
-
103
- INPUT
104
- output = <<~OUTPUT
105
- #{@blank_hdr}
106
- <sections>
107
-
108
- </sections><bibliography><references id="_" obligation="informative" normative="true">
109
- <title>Normative references</title>
110
- <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>
111
- <bibitem id="ISO712">
112
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
113
- <docidentifier>x</docidentifier>
114
- </bibitem>
115
- <bibitem id="ISO713">
116
- <formattedref format="application/x-isodoc+xml">Reference</formattedref>
117
- <docidentifier>ISO713</docidentifier>
118
- <docnumber>713</docnumber>
119
- </bibitem>
120
- </references>
121
- </bibliography>
122
- </iec-standard>
123
- OUTPUT
124
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
125
- .to be_equivalent_to xmlpp(output)
126
- end
127
-
128
- it "processes footnotes" do
129
- input = <<~INPUT
130
- #{ASCIIDOC_BLANK_HDR}
131
- Hello!footnote:[Footnote text]
132
- INPUT
133
- output = <<~OUTPUT
134
- #{@blank_hdr}
135
- <sections>
136
- <p id="_">Hello!<fn reference="1">
137
- <p id="_">Footnote text</p>
138
- </fn></p>
139
- </sections>
140
- </iec-standard>
141
- OUTPUT
142
- expect(xmlpp(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
143
- .to be_equivalent_to xmlpp(output)
144
- end
145
- end
@@ -1,194 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe Metanorma::Iec do
4
- before(:all) do
5
- @blank_hdr = blank_hdr_gen
6
- end
7
-
8
- it "processes simple lists" do
9
- output = Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
10
- #{ASCIIDOC_BLANK_HDR}
11
- * List 1
12
- * List 2
13
- * List 3
14
-
15
- . List A
16
- . List B
17
- . List C
18
-
19
- List D:: List E
20
- List F:: List G
21
-
22
- INPUT
23
- expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
24
- #{@blank_hdr}
25
- <sections>
26
- <ul id="_">
27
- <li>
28
- <p id="_">List 1</p>
29
- </li>
30
- <li>
31
- <p id="_">List 2</p>
32
- </li>
33
- <li>
34
- <p id="_">List 3</p>
35
- <ol id="_">
36
- <li>
37
- <p id="_">List A</p>
38
- </li>
39
- <li>
40
- <p id="_">List B</p>
41
- </li>
42
- <li>
43
- <p id="_">List C</p>
44
- <dl id="_">
45
- <dt>List D</dt>
46
- <dd>
47
- <p id="_">List E</p>
48
- </dd>
49
- <dt>List F</dt>
50
- <dd>
51
- <p id="_">List G</p>
52
- </dd>
53
- </dl>
54
- </li>
55
- </ol>
56
- </li>
57
- </ul>
58
- </sections>
59
- </iec-standard>
60
- OUTPUT
61
- end
62
-
63
- it "processes complex lists" do
64
- output = Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)
65
- #{ASCIIDOC_BLANK_HDR}
66
- [[id]]
67
- * First
68
- * Second
69
- +
70
- --
71
- entry1
72
-
73
- entry2
74
- --
75
-
76
- [[id1]]
77
- [loweralpha]
78
- . First
79
- . Second
80
- [upperalpha]
81
- .. Third
82
- .. Fourth
83
- . Fifth
84
- . Sixth
85
-
86
- [lowerroman]
87
- . A
88
- . B
89
- [upperroman]
90
- .. C
91
- .. D
92
- [arabic]
93
- ... E
94
- ... F
95
-
96
-
97
- Notes1::
98
- Notes:: Note 1.
99
- +
100
- Note 2.
101
- +
102
- Note 3.
103
-
104
- INPUT
105
- expect(xmlpp(strip_guid(output))).to be_equivalent_to xmlpp(<<~"OUTPUT")
106
- #{@blank_hdr}
107
- <sections><ul id="id">
108
- <li>
109
- <p id="_">First</p>
110
- </li>
111
- <li><p id="_">Second</p><p id="_">entry1</p>
112
- <p id="_">entry2</p></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><p id="_">Note 1.</p><p id="_">Note 2.</p>
159
- <p id="_">Note 3.</p></dd>
160
- </dl>
161
- </li>
162
- </ol>
163
- </li>
164
- </ol>
165
- </li>
166
- </ol></sections>
167
- </iec-standard>
168
- OUTPUT
169
- end
170
-
171
- it "anchors lists and list items" do
172
- expect(xmlpp(strip_guid(Asciidoctor.convert(<<~"INPUT", backend: :iec, header_footer: true)))).to be_equivalent_to xmlpp(<<~"OUTPUT")
173
- #{ASCIIDOC_BLANK_HDR}
174
- [[id1]]
175
- * [[id2]] List item
176
- * Hello [[id3]] List item
177
-
178
- INPUT
179
- #{@blank_hdr}
180
- <sections>
181
- <ul id="id1">
182
- <li id="id2">
183
- <p id="_">List item</p>
184
- </li>
185
- <li>
186
- <p id="_">Hello <bookmark id="id3"/> List item</p>
187
- </li>
188
- </ul>
189
- </sections>
190
- </iec-standard>
191
- OUTPUT
192
- end
193
-
194
- end
@@ -1,171 +0,0 @@
1
- require "spec_helper"
2
- require "metanorma"
3
- require "fileutils"
4
-
5
- RSpec.describe Metanorma::Iec::Processor do
6
- registry = Metanorma::Registry.instance
7
- registry.register(Metanorma::Iec::Processor)
8
- processor = registry.find_processor(:iec)
9
-
10
- inputxml = <<~INPUT
11
- <iec-standard xmlns="http://riboseinc.com/isoxml">
12
- <bibdata type="standard">
13
- <title language="en" format="text/plain" type="main">English</title>
14
- <title language="en" format="text/plain" type="title-main">English</title>
15
- <title language="fr" format="text/plain" type="main">French</title>
16
- <title language="fr" format="text/plain" type="title-main">French</title>
17
- <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>
18
- <docnumber>1</docnumber>
19
- <contributor>
20
- <role type="author"/>
21
- <organization>
22
- <name>International Organization for Standardization</name>
23
- <abbreviation>ISO</abbreviation>
24
- </organization>
25
- </contributor>
26
- <contributor>
27
- <role type="publisher"/>
28
- <organization>
29
- <name>International Organization for Standardization</name>
30
- <abbreviation>ISO</abbreviation>
31
- </organization>
32
- </contributor>
33
- <language>fr</language>
34
- <script>Latn</script>
35
- <status>
36
- <stage abbreviation="IS">60</stage>
37
- <substage>60</substage>
38
- </status>
39
- <copyright>
40
- <from>2021</from>
41
- <owner>
42
- <organization>
43
- <name>International Organization for Standardization</name>
44
- <abbreviation>ISO</abbreviation>
45
- </organization>
46
- </owner>
47
- </copyright>
48
- <ext>
49
- <doctype>directive</doctype>
50
- <subdoctype>vocabulary</subdoctype>
51
- <editorialgroup>
52
- <technical-committee/>
53
- <subcommittee/>
54
- <workgroup/>
55
- </editorialgroup>
56
- <structuredidentifier>
57
- <project-number>ISO 1</project-number>
58
- </structuredidentifier>
59
- <stagename>International standard</stagename>
60
- </ext>
61
- </bibdata>
62
- <boilerplate>
63
- <copyright-statement>
64
- <clause>
65
- <title>DOCUMENT PROT&#201;G&#201; PAR COPYRIGHT</title>
66
- <p id="boilerplate-year">&#169; ISO 2021</p>
67
-
68
- <p id="boilerplate-message">
69
- Droits de reproduction r&#233;serv&#233;s. Sauf indication contraire, aucune partie de cette publication ne
70
- peut &#234;tre reproduite ni utilis&#233;e sous quelque forme que ce soit et par aucun proc&#233;d&#233;, &#233;lectronique
71
- ou m&#233;canique, y compris la photocopie, l&#8217;affichage sur l&#8217;internet ou sur un Intranet, sans
72
- autorisation &#233;crite pr&#233;alable. Les demandes d&#8217;autorisation peuvent &#234;tre adress&#233;es &#224; l&#8217;ISO &#224;
73
- l&#8217;adresse ci-apr&#232;s ou au comit&#233; membre de l&#8217;ISO dans le pays du demandeur.
74
- </p>
75
-
76
- <p id="boilerplate-address" align="left">
77
- ISO copyright office<br/>
78
- Ch. de Blandonnet 8 &#8226; CP 401<br/>
79
- CH-1214 Vernier, Geneva, Switzerland<br/>
80
- Tel.&#160;&#160;+ 41 22 749 01 11<br/>
81
- Fax&#160;&#160;+ 41 22 749 09 47<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
- </iec-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"], [: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::Iec })
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_gen}
124
- <sections/>
125
- </iec-standard>
126
- OUTPUT
127
- expect(xmlpp(strip_guid(processor.input_to_isodoc(input, nil))))
128
- .to be_equivalent_to xmlpp(output)
129
- end
130
-
131
- it "generates HTML from IsoDoc 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"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
140
- <br />
141
- <p class="zzSTDTitle1">COMMISSION ELECTROTECHNIQUE INTERNATIONALE</p>
142
- <p class="zzSTDTitle1">____________</p>
143
- <p class="zzSTDTitle1">&#xA0;</p>
144
- <p class="zzSTDTitle1">
145
- <b>French</b>
146
- </p>
147
- <p class="zzSTDTitle1">&#xA0;</p>
148
- <div id="">
149
- <h1 class="ForewordTitle" id="toc0">AVANT-PROPOS</h1>
150
- <div class="boilerplate_legal"></div>
151
- </div>
152
- <p class="zzSTDTitle1">
153
- <b>French</b>
154
- </p>
155
- <p class="zzSTDTitle1">&#xA0;</p>
156
- <div id="H"><h1 id="toc1">1&#xA0; Terms, Definitions, Symbols and Abbreviated Terms</h1>
157
- <h2 class="TermNum" id="J">1.1</h2>
158
- <p class="Terms" style="text-align:left;">Term2</p>
159
- </div>
160
- </main>
161
- OUTPUT
162
- end
163
-
164
- it "generates STS from Metanorma XML" do
165
- FileUtils.rm_f "test.xml"
166
- FileUtils.rm_f "test.sts.xml"
167
- File.open("test.xml", "w") { |f| f.write inputxml }
168
- processor.output(inputxml, "test.xml", "test.sts.xml", :sts)
169
- expect(File.exist?("test.sts.xml")).to be true
170
- end
171
- end