metanorma-iec 1.4.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +4 -32
- data/.gitignore +14 -0
- data/Gemfile +6 -0
- data/Rakefile +1 -1
- data/lib/isodoc/iec/base_convert.rb +25 -59
- data/lib/isodoc/iec/html/htmlstyle.css +38 -6
- data/lib/isodoc/iec/html/htmlstyle.scss +35 -6
- data/lib/isodoc/iec/html/isodoc.css +1 -2
- data/lib/isodoc/iec/html/isodoc.scss +1 -2
- data/lib/isodoc/iec/html/scripts.html +0 -1
- data/lib/isodoc/iec/html/wordstyle.css +13 -11
- data/lib/isodoc/iec/html/wordstyle.scss +13 -11
- data/lib/isodoc/iec/html_convert.rb +2 -1
- data/lib/isodoc/iec/iec.international-standard.xsl +724 -330
- data/lib/isodoc/iec/presentation_xml_convert.rb +193 -5
- data/lib/isodoc/iec/xref.rb +9 -8
- data/lib/{asciidoctor → metanorma}/iec/basicdoc.rng +0 -0
- data/lib/{asciidoctor → metanorma}/iec/biblio.rng +0 -0
- data/lib/metanorma/iec/converter.rb +143 -0
- data/lib/{asciidoctor → metanorma}/iec/front.rb +3 -4
- data/lib/{asciidoctor → metanorma}/iec/iec.rng +48 -0
- data/lib/{asciidoctor → metanorma}/iec/iec_intro_en.xml +0 -0
- data/lib/{asciidoctor → metanorma}/iec/iec_intro_fr.xml +0 -0
- data/lib/{asciidoctor → metanorma}/iec/isodoc.rng +90 -18
- data/lib/{asciidoctor → metanorma}/iec/isostandard.rng +14 -0
- data/lib/metanorma/iec/processor.rb +15 -8
- data/lib/{asciidoctor → metanorma}/iec/reqt.rng +0 -0
- data/lib/metanorma/iec/version.rb +1 -1
- data/lib/metanorma-iec.rb +1 -1
- data/metanorma-iec.gemspec +3 -3
- data/spec/isodoc/iev_spec.rb +462 -120
- data/spec/isodoc/postproc_spec.rb +2 -5
- data/spec/isodoc/ref_spec.rb +359 -353
- data/spec/isodoc/terms_spec.rb +183 -181
- data/spec/{asciidoctor → metanorma}/base_spec.rb +1 -5
- data/spec/{asciidoctor → metanorma}/blocks_spec.rb +1 -1
- data/spec/metanorma/cleanup_spec.rb +374 -0
- data/spec/metanorma/iev_spec.rb +248 -0
- data/spec/{asciidoctor → metanorma}/inline_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/lists_spec.rb +1 -1
- data/spec/metanorma/processor_spec.rb +139 -44
- data/spec/{asciidoctor → metanorma}/section_spec.rb +1 -1
- data/spec/{asciidoctor → metanorma}/validate_spec.rb +1 -1
- data/spec/spec_helper.rb +12 -14
- metadata +26 -26
- data/lib/asciidoctor/iec/converter.rb +0 -105
- data/spec/asciidoctor/cleanup_spec.rb +0 -345
- data/spec/asciidoctor/iev_spec.rb +0 -243
@@ -2,20 +2,112 @@ require "spec_helper"
|
|
2
2
|
require "metanorma"
|
3
3
|
require "fileutils"
|
4
4
|
|
5
|
-
#RSpec.describe Asciidoctor::Gb do
|
6
5
|
RSpec.describe Metanorma::Iec::Processor do
|
7
|
-
|
8
6
|
registry = Metanorma::Registry.instance
|
9
7
|
registry.register(Metanorma::Iec::Processor)
|
10
8
|
processor = registry.find_processor(:iec)
|
11
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ÉGÉ PAR COPYRIGHT</title>
|
66
|
+
<p id="boilerplate-year">© ISO 2021</p>
|
67
|
+
|
68
|
+
<p id="boilerplate-message">
|
69
|
+
Droits de reproduction réservés. Sauf indication contraire, aucune partie de cette publication ne
|
70
|
+
peut être reproduite ni utilisée sous quelque forme que ce soit et par aucun procédé, électronique
|
71
|
+
ou mécanique, y compris la photocopie, l’affichage sur l’internet ou sur un Intranet, sans
|
72
|
+
autorisation écrite préalable. Les demandes d’autorisation peuvent être adressées à l’ISO à
|
73
|
+
l’adresse ci-après ou au comité membre de l’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 • CP 401<br/>
|
79
|
+
CH-1214 Vernier, Geneva, Switzerland<br/>
|
80
|
+
Tel.  + 41 22 749 01 11<br/>
|
81
|
+
Fax  + 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é en Suisse
|
87
|
+
</p>
|
88
|
+
</clause>
|
89
|
+
</copyright-statement>
|
90
|
+
|
91
|
+
|
92
|
+
</boilerplate>
|
93
|
+
<sections>
|
94
|
+
<terms id="H" obligation="normative"><title>1  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
|
+
|
12
104
|
it "registers against metanorma" do
|
13
105
|
expect(processor).not_to be nil
|
14
106
|
end
|
15
107
|
|
16
108
|
it "registers output formats against metanorma" do
|
17
109
|
expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
|
18
|
-
|
110
|
+
[[:doc, "doc"], [:html, "html"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
|
19
111
|
OUTPUT
|
20
112
|
end
|
21
113
|
|
@@ -24,53 +116,56 @@ RSpec.describe Metanorma::Iec::Processor do
|
|
24
116
|
end
|
25
117
|
|
26
118
|
it "generates IsoDoc XML from a blank document" do
|
27
|
-
|
28
|
-
|
119
|
+
input = <<~INPUT
|
120
|
+
#{ASCIIDOC_BLANK_HDR}
|
29
121
|
INPUT
|
30
|
-
|
31
|
-
|
32
|
-
|
122
|
+
output = <<~OUTPUT
|
123
|
+
#{blank_hdr_gen}
|
124
|
+
<sections/>
|
125
|
+
</iec-standard>
|
33
126
|
OUTPUT
|
127
|
+
expect(xmlpp(strip_guid(processor.input_to_isodoc(input, nil))))
|
128
|
+
.to be_equivalent_to xmlpp(output)
|
34
129
|
end
|
35
130
|
|
36
131
|
it "generates HTML from IsoDoc XML" do
|
37
132
|
FileUtils.rm_f "test.xml"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</
|
47
|
-
</
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
</
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
<p class="zzSTDTitle1"> </p>
|
68
|
-
<div id="H"><h1 id="toc1">1  Terms, Definitions, Symbols and Abbreviated Terms</h1>
|
69
|
-
<h2 class="TermNum" id="J">1.1</h2>
|
70
|
-
<p class="Terms" style="text-align:left;">Term2</p>
|
71
|
-
</div>
|
72
|
-
</main>
|
73
|
-
OUTPUT
|
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"> </p>
|
144
|
+
<p class="zzSTDTitle1">
|
145
|
+
<b>French</b>
|
146
|
+
</p>
|
147
|
+
<p class="zzSTDTitle1"> </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"> </p>
|
156
|
+
<div id="H"><h1 id="toc1">1  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
|
74
162
|
end
|
75
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
|
76
171
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -27,7 +27,7 @@ end
|
|
27
27
|
|
28
28
|
def metadata(xml)
|
29
29
|
xml.sort.to_h.delete_if do |_k, v|
|
30
|
-
v.nil? || v.respond_to?(:empty?) && v.empty?
|
30
|
+
v.nil? || (v.respond_to?(:empty?) && v.empty?)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -105,24 +105,23 @@ VALIDATING_BLANK_HDR = <<~"HDR".freeze
|
|
105
105
|
HDR
|
106
106
|
|
107
107
|
TERMS_BOILERPLATE = <<~"BOILERPLATE".freeze
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
</ul>
|
108
|
+
<p id="_">ISO and IEC maintain terminological databases for use in
|
109
|
+
standardization at the following addresses:</p>
|
110
|
+
<ul id="_">
|
111
|
+
<li> <p id="_">IEC Electropedia: available at
|
112
|
+
<link target="http://www.electropedia.org"/>
|
113
|
+
</p> </li>
|
114
|
+
<li> <p id="_">ISO Online browsing platform: available at
|
115
|
+
<link target="http://www.iso.org/obp"/></p> </li>
|
116
|
+
</ul>
|
118
117
|
BOILERPLATE
|
119
118
|
|
120
119
|
def boilerplate(xmldoc)
|
121
120
|
file = File.read(
|
122
|
-
File.join(File.dirname(__FILE__), "..", "lib", "
|
121
|
+
File.join(File.dirname(__FILE__), "..", "lib", "metanorma", "iec",
|
123
122
|
"iec_intro_en.xml"), encoding: "utf-8"
|
124
123
|
)
|
125
|
-
conv =
|
124
|
+
conv = Metanorma::Iec::Converter.new(nil, backend: :iec,
|
126
125
|
header_footer: true)
|
127
126
|
conv.init(Asciidoctor::Document.new([]))
|
128
127
|
ret = Nokogiri::XML(
|
@@ -169,7 +168,6 @@ BLANK_HDR = <<~"HDR".freeze
|
|
169
168
|
</copyright>
|
170
169
|
<ext>
|
171
170
|
<doctype>article</doctype>
|
172
|
-
<horizontal>false</horizontal>
|
173
171
|
<editorialgroup>
|
174
172
|
<technical-committee/>
|
175
173
|
<subcommittee/>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-iec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: metanorma-iso
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-jing
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: debug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.3.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.3.0
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rake
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,16 +212,6 @@ files:
|
|
212
212
|
- README.adoc
|
213
213
|
- Rakefile
|
214
214
|
- bin/rspec
|
215
|
-
- lib/asciidoctor/iec/basicdoc.rng
|
216
|
-
- lib/asciidoctor/iec/biblio.rng
|
217
|
-
- lib/asciidoctor/iec/converter.rb
|
218
|
-
- lib/asciidoctor/iec/front.rb
|
219
|
-
- lib/asciidoctor/iec/iec.rng
|
220
|
-
- lib/asciidoctor/iec/iec_intro_en.xml
|
221
|
-
- lib/asciidoctor/iec/iec_intro_fr.xml
|
222
|
-
- lib/asciidoctor/iec/isodoc.rng
|
223
|
-
- lib/asciidoctor/iec/isostandard.rng
|
224
|
-
- lib/asciidoctor/iec/reqt.rng
|
225
215
|
- lib/isodoc/iec/base_convert.rb
|
226
216
|
- lib/isodoc/iec/html/header.html
|
227
217
|
- lib/isodoc/iec/html/html_iec_intro.html
|
@@ -249,17 +239,19 @@ files:
|
|
249
239
|
- lib/isodoc/iec/xref.rb
|
250
240
|
- lib/metanorma-iec.rb
|
251
241
|
- lib/metanorma/iec.rb
|
242
|
+
- lib/metanorma/iec/basicdoc.rng
|
243
|
+
- lib/metanorma/iec/biblio.rng
|
244
|
+
- lib/metanorma/iec/converter.rb
|
245
|
+
- lib/metanorma/iec/front.rb
|
246
|
+
- lib/metanorma/iec/iec.rng
|
247
|
+
- lib/metanorma/iec/iec_intro_en.xml
|
248
|
+
- lib/metanorma/iec/iec_intro_fr.xml
|
249
|
+
- lib/metanorma/iec/isodoc.rng
|
250
|
+
- lib/metanorma/iec/isostandard.rng
|
252
251
|
- lib/metanorma/iec/processor.rb
|
252
|
+
- lib/metanorma/iec/reqt.rng
|
253
253
|
- lib/metanorma/iec/version.rb
|
254
254
|
- metanorma-iec.gemspec
|
255
|
-
- spec/asciidoctor/base_spec.rb
|
256
|
-
- spec/asciidoctor/blocks_spec.rb
|
257
|
-
- spec/asciidoctor/cleanup_spec.rb
|
258
|
-
- spec/asciidoctor/iev_spec.rb
|
259
|
-
- spec/asciidoctor/inline_spec.rb
|
260
|
-
- spec/asciidoctor/lists_spec.rb
|
261
|
-
- spec/asciidoctor/section_spec.rb
|
262
|
-
- spec/asciidoctor/validate_spec.rb
|
263
255
|
- spec/assets/header.html
|
264
256
|
- spec/assets/html.css
|
265
257
|
- spec/assets/iso.xml
|
@@ -277,7 +269,15 @@ files:
|
|
277
269
|
- spec/isodoc/ref_spec.rb
|
278
270
|
- spec/isodoc/section_spec.rb
|
279
271
|
- spec/isodoc/terms_spec.rb
|
272
|
+
- spec/metanorma/base_spec.rb
|
273
|
+
- spec/metanorma/blocks_spec.rb
|
274
|
+
- spec/metanorma/cleanup_spec.rb
|
275
|
+
- spec/metanorma/iev_spec.rb
|
276
|
+
- spec/metanorma/inline_spec.rb
|
277
|
+
- spec/metanorma/lists_spec.rb
|
280
278
|
- spec/metanorma/processor_spec.rb
|
279
|
+
- spec/metanorma/section_spec.rb
|
280
|
+
- spec/metanorma/validate_spec.rb
|
281
281
|
- spec/spec_helper.rb
|
282
282
|
homepage: https://github.com/metanorma/metanorma-iec
|
283
283
|
licenses:
|
@@ -298,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
298
298
|
- !ruby/object:Gem::Version
|
299
299
|
version: '0'
|
300
300
|
requirements: []
|
301
|
-
rubygems_version: 3.2.
|
301
|
+
rubygems_version: 3.2.32
|
302
302
|
signing_key:
|
303
303
|
specification_version: 4
|
304
304
|
summary: metanorma-iec lets you write IEC standards in AsciiDoc.
|
@@ -1,105 +0,0 @@
|
|
1
|
-
require "asciidoctor"
|
2
|
-
require "metanorma-iso"
|
3
|
-
require_relative "./front.rb"
|
4
|
-
|
5
|
-
module Asciidoctor
|
6
|
-
module Iec
|
7
|
-
class Converter < ISO::Converter
|
8
|
-
XML_ROOT_TAG = "iec-standard".freeze
|
9
|
-
XML_NAMESPACE = "https://www.metanorma.org/ns/iec".freeze
|
10
|
-
|
11
|
-
register_for "iec"
|
12
|
-
|
13
|
-
def init(node)
|
14
|
-
super
|
15
|
-
@is_iev = node.attr("docnumber") == "60050"
|
16
|
-
end
|
17
|
-
|
18
|
-
def boilerplate_file(x_orig)
|
19
|
-
lang = case x_orig&.at("//bibdata/language")&.text
|
20
|
-
when "fr" then "fr"
|
21
|
-
else
|
22
|
-
"en"
|
23
|
-
end
|
24
|
-
File.join(@libdir, "iec_intro_#{lang}.xml")
|
25
|
-
end
|
26
|
-
|
27
|
-
def doctype_validate(xmldoc)
|
28
|
-
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
29
|
-
%w(international-standard technical-specification technical-report
|
30
|
-
publicly-available-specification international-workshop-agreement
|
31
|
-
guide interpretation-sheet).include? doctype or
|
32
|
-
@log.add("Document Attributes", nil, "#{doctype} is not a recognised document type")
|
33
|
-
if function = xmldoc&.at("//bibdata/ext/function")&.text
|
34
|
-
%w(emc quality-assurance safety environment).include? function or
|
35
|
-
@log.add("Document Attributes", nil, "#{function} is not a recognised document function")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def validate(doc)
|
40
|
-
content_validate(doc)
|
41
|
-
schema_validate(formattedstr_strip(doc.dup),
|
42
|
-
File.join(File.dirname(__FILE__), "iec.rng"))
|
43
|
-
end
|
44
|
-
|
45
|
-
def html_converter(node)
|
46
|
-
node.nil? ? IsoDoc::Iec::HtmlConvert.new({}) :
|
47
|
-
IsoDoc::Iec::HtmlConvert.new(html_extract_attributes(node))
|
48
|
-
end
|
49
|
-
|
50
|
-
def doc_converter(node)
|
51
|
-
node.nil? ? IsoDoc::Iec::WordConvert.new({}) :
|
52
|
-
IsoDoc::Iec::WordConvert.new(doc_extract_attributes(node))
|
53
|
-
end
|
54
|
-
|
55
|
-
def pdf_converter(node)
|
56
|
-
return if node.attr("no-pdf")
|
57
|
-
node.nil? ? IsoDoc::Iec::PdfConvert.new({}) :
|
58
|
-
IsoDoc::Iec::PdfConvert.new(doc_extract_attributes(node))
|
59
|
-
end
|
60
|
-
|
61
|
-
def presentation_xml_converter(node)
|
62
|
-
node.nil? ? IsoDoc::Iec::PresentationXMLConvert.new({}) :
|
63
|
-
IsoDoc::Iec::PresentationXMLConvert.new(doc_extract_attributes(node))
|
64
|
-
end
|
65
|
-
|
66
|
-
def norm_ref_preface(f)
|
67
|
-
return super unless @is_iev
|
68
|
-
f.at("./title").next =
|
69
|
-
"<p>#{@i18n.norm_empty_pref}</p>"
|
70
|
-
end
|
71
|
-
|
72
|
-
def term_defs_boilerplate(div, source, term, preface, isodoc)
|
73
|
-
return super unless @is_iev
|
74
|
-
end
|
75
|
-
|
76
|
-
def sts_converter(node)
|
77
|
-
end
|
78
|
-
|
79
|
-
def sections_names_cleanup(x)
|
80
|
-
super
|
81
|
-
@is_iev and replace_title(x, "//introduction", @i18n&.introduction_iev)
|
82
|
-
end
|
83
|
-
|
84
|
-
def note(n)
|
85
|
-
if n.title == "Note from TC/SC Officers"
|
86
|
-
noko do |xml|
|
87
|
-
xml.tc_sc_officers_note do |c|
|
88
|
-
wrap_in_para(n, c)
|
89
|
-
end
|
90
|
-
end.join("\n")
|
91
|
-
else
|
92
|
-
super
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
def note_cleanup(xmldoc)
|
97
|
-
super
|
98
|
-
n = xmldoc.at("//tc-sc-officers-note") and xmldoc.at("//bibdata/ext").add_child(n.remove)
|
99
|
-
end
|
100
|
-
|
101
|
-
def image_name_validate(xmldoc)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|