metanorma-iso 2.2.2 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/iso/html/header-dis.html +111 -29
- data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
- data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
- data/lib/isodoc/iso/html/style-human.css +7 -2
- data/lib/isodoc/iso/html/style-human.scss +0 -1
- data/lib/isodoc/iso/html/style-iso.css +7 -2
- data/lib/isodoc/iso/html/style-iso.scss +0 -1
- data/lib/isodoc/iso/html/wordstyle-dis.css +160 -4
- data/lib/isodoc/iso/html/wordstyle-dis.scss +154 -4
- data/lib/isodoc/iso/html/wordstyle.css +150 -0
- data/lib/isodoc/iso/html/wordstyle.scss +144 -0
- data/lib/isodoc/iso/i18n-en.yaml +4 -4
- data/lib/isodoc/iso/iso.amendment.xsl +1649 -1199
- data/lib/isodoc/iso/iso.international-standard.xsl +1649 -1199
- data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
- data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
- data/lib/isodoc/iso/word_convert.rb +6 -4
- data/lib/isodoc/iso/word_dis_cleanup.rb +30 -8
- data/lib/isodoc/iso/word_dis_convert.rb +5 -2
- data/lib/metanorma/iso/base.rb +2 -1
- data/lib/metanorma/iso/biblio.rng +5 -0
- data/lib/metanorma/iso/isodoc.rng +47 -13
- data/lib/metanorma/iso/validate.rb +2 -2
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +5 -2
- metadata +4 -87
- data/.github/workflows/automerge.yml +0 -31
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/.github/workflows/ubuntu.yml +0 -41
- data/Rakefile +0 -8
- data/bin/rspec +0 -17
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.css +0 -2
- data/spec/assets/htmlcover.html +0 -4
- data/spec/assets/htmlintro.html +0 -5
- data/spec/assets/i18n.yaml +0 -2
- data/spec/assets/iso.adoc +0 -10
- data/spec/assets/iso.headless.html +0 -33
- data/spec/assets/iso.xml +0 -71
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +0 -3
- data/spec/assets/std.css +0 -2
- data/spec/assets/word.css +0 -2
- data/spec/assets/wordcover.html +0 -3
- data/spec/assets/wordintro.html +0 -4
- data/spec/examples/103_01_02.html +0 -247
- data/spec/examples/english.yaml +0 -69
- data/spec/examples/iso_123_.xml +0 -45
- data/spec/examples/iso_123_all_parts.xml +0 -45
- data/spec/examples/iso_123_no_year_note.xml +0 -46
- data/spec/examples/iso_124_.xml +0 -41
- data/spec/examples/iso_216_.xml +0 -47
- data/spec/examples/iso_iec_12382_.xml +0 -48
- data/spec/examples/rice.adoc +0 -714
- data/spec/examples/rice.preview.html +0 -1870
- data/spec/examples/rice.sh +0 -4
- data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
- data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
- data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/ISO_1213_1.png +0 -0
- data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
- data/spec/examples/rice_img/rice_image1.png +0 -0
- data/spec/examples/rice_img/rice_image2.png +0 -0
- data/spec/examples/rice_img/rice_image3_1.png +0 -0
- data/spec/examples/rice_img/rice_image3_2.png +0 -0
- data/spec/examples/rice_img/rice_image3_3.png +0 -0
- data/spec/isodoc/amd_spec.rb +0 -986
- data/spec/isodoc/blocks_spec.rb +0 -1174
- data/spec/isodoc/i18n_spec.rb +0 -1579
- data/spec/isodoc/inline_spec.rb +0 -1060
- data/spec/isodoc/iso_spec.rb +0 -255
- data/spec/isodoc/metadata_spec.rb +0 -701
- data/spec/isodoc/postproc_spec.rb +0 -1089
- data/spec/isodoc/ref_spec.rb +0 -439
- data/spec/isodoc/section_spec.rb +0 -998
- data/spec/isodoc/table_spec.rb +0 -420
- data/spec/isodoc/terms_spec.rb +0 -314
- data/spec/isodoc/word_dis_spec.rb +0 -2064
- data/spec/isodoc/xref_spec.rb +0 -1747
- data/spec/metanorma/amd_spec.rb +0 -724
- data/spec/metanorma/base_spec.rb +0 -1384
- data/spec/metanorma/blank_spec.rb +0 -38
- data/spec/metanorma/blocks_spec.rb +0 -624
- data/spec/metanorma/cleanup_spec.rb +0 -1645
- data/spec/metanorma/inline_spec.rb +0 -203
- data/spec/metanorma/lists_spec.rb +0 -197
- data/spec/metanorma/macros_spec.rb +0 -99
- data/spec/metanorma/processor_spec.rb +0 -161
- data/spec/metanorma/refs_spec.rb +0 -672
- data/spec/metanorma/section_spec.rb +0 -492
- data/spec/metanorma/table_spec.rb +0 -329
- data/spec/metanorma/validate_spec.rb +0 -2153
- data/spec/relaton/render_spec.rb +0 -568
- data/spec/requirements/requirement_components_spec.rb +0 -610
- data/spec/requirements/requirements_spec.rb +0 -1596
- data/spec/requirements/xref_spec.rb +0 -1211
- data/spec/spec_helper.rb +0 -313
- data/spec/vcr_cassettes/docrels.yml +0 -385
- data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
data/spec/spec_helper.rb
DELETED
@@ -1,313 +0,0 @@
|
|
1
|
-
require "vcr"
|
2
|
-
|
3
|
-
VCR.configure do |config|
|
4
|
-
config.cassette_library_dir = "spec/vcr_cassettes"
|
5
|
-
config.hook_into :webmock
|
6
|
-
config.default_cassette_options = {
|
7
|
-
clean_outdated_http_interactions: true,
|
8
|
-
re_record_interval: 1512000,
|
9
|
-
record: :once,
|
10
|
-
}
|
11
|
-
end
|
12
|
-
|
13
|
-
require "simplecov"
|
14
|
-
SimpleCov.start do
|
15
|
-
add_filter "/spec/"
|
16
|
-
end
|
17
|
-
|
18
|
-
require "bundler/setup"
|
19
|
-
require "asciidoctor"
|
20
|
-
require "metanorma-iso"
|
21
|
-
require "rspec/matchers"
|
22
|
-
require "equivalent-xml"
|
23
|
-
require "metanorma"
|
24
|
-
require "metanorma/iso"
|
25
|
-
require "iev"
|
26
|
-
require "rexml/document"
|
27
|
-
|
28
|
-
RSpec.configure do |config|
|
29
|
-
# Enable flags like --only-failures and --next-failure
|
30
|
-
config.example_status_persistence_file_path = ".rspec_status"
|
31
|
-
|
32
|
-
# Disable RSpec exposing methods globally on `Module` and `main`
|
33
|
-
config.disable_monkey_patching!
|
34
|
-
|
35
|
-
config.expect_with :rspec do |c|
|
36
|
-
c.syntax = :expect
|
37
|
-
end
|
38
|
-
|
39
|
-
# config.around do |example|
|
40
|
-
# Dir.mktmpdir("rspec-") do |dir|
|
41
|
-
# tmp_assets = File.join(dir, "spec/assets/")
|
42
|
-
# FileUtils.mkdir_p tmp_assets
|
43
|
-
# FileUtils.cp_r Dir.glob("spec/assets/*"), tmp_assets
|
44
|
-
# Dir.chdir(dir) { example.run }
|
45
|
-
# end
|
46
|
-
# end
|
47
|
-
end
|
48
|
-
|
49
|
-
def strip_guid(xml)
|
50
|
-
xml.gsub(%r{ id=['"]_[^"']+['"]}, ' id="_"')
|
51
|
-
.gsub(%r{ target="_[^"]+"}, ' target="_"')
|
52
|
-
.gsub(%r{ src="cid:[^.]+.gif"}, ' src="_.gif"')
|
53
|
-
.gsub(%r{ src='cid:[^.]+.gif'}, ' src="_.gif"')
|
54
|
-
end
|
55
|
-
|
56
|
-
def metadata(hash)
|
57
|
-
hash.sort.to_h.delete_if do |_, v|
|
58
|
-
v.nil? || (v.respond_to?(:empty?) && v.empty?)
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def xmlpp(xml)
|
63
|
-
c = HTMLEntities.new
|
64
|
-
xml &&= xml.split(/(&\S+?;)/).map do |n|
|
65
|
-
if /^&\S+?;$/.match?(n)
|
66
|
-
c.encode(c.decode(n), :hexadecimal)
|
67
|
-
else n
|
68
|
-
end
|
69
|
-
end.join
|
70
|
-
s = ""
|
71
|
-
f = REXML::Formatters::Pretty.new(2)
|
72
|
-
f.compact = true
|
73
|
-
f.write(REXML::Document.new(xml
|
74
|
-
.gsub(%r{<fetched>20[0-9-]+</fetched>}, "<fetched/>")), s)
|
75
|
-
HTMLEntities.new.decode(s)
|
76
|
-
end
|
77
|
-
|
78
|
-
ASCIIDOC_BLANK_HDR = <<~"HDR".freeze
|
79
|
-
= Document title
|
80
|
-
Author
|
81
|
-
:docfile: test.adoc
|
82
|
-
:nodoc:
|
83
|
-
:novalid:
|
84
|
-
:no-isobib:
|
85
|
-
|
86
|
-
HDR
|
87
|
-
|
88
|
-
AMD_BLANK_HDR = <<~"HDR".freeze
|
89
|
-
= Document title
|
90
|
-
Author
|
91
|
-
:docfile: test.adoc
|
92
|
-
:nodoc:
|
93
|
-
:novalid:
|
94
|
-
:no-isobib:
|
95
|
-
:doctype: amendment
|
96
|
-
|
97
|
-
HDR
|
98
|
-
|
99
|
-
ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
100
|
-
= Document title
|
101
|
-
Author
|
102
|
-
:docfile: test.adoc
|
103
|
-
:nodoc:
|
104
|
-
:novalid:
|
105
|
-
:no-isobib-cache:
|
106
|
-
|
107
|
-
HDR
|
108
|
-
|
109
|
-
FLUSH_CACHE_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
110
|
-
= Document title
|
111
|
-
Author
|
112
|
-
:docfile: test.adoc
|
113
|
-
:nodoc:
|
114
|
-
:novalid:
|
115
|
-
:flush-caches:
|
116
|
-
|
117
|
-
HDR
|
118
|
-
|
119
|
-
CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
120
|
-
= Document title
|
121
|
-
Author
|
122
|
-
:docfile: test.adoc
|
123
|
-
:nodoc:
|
124
|
-
:novalid:
|
125
|
-
|
126
|
-
HDR
|
127
|
-
|
128
|
-
LOCAL_CACHED_ISOBIB_BLANK_HDR = <<~"HDR".freeze
|
129
|
-
= Document title
|
130
|
-
Author
|
131
|
-
:docfile: test.adoc
|
132
|
-
:nodoc:
|
133
|
-
:novalid:
|
134
|
-
:local-cache:
|
135
|
-
|
136
|
-
HDR
|
137
|
-
|
138
|
-
VALIDATING_BLANK_HDR = <<~"HDR".freeze
|
139
|
-
= Document title
|
140
|
-
Author
|
141
|
-
:docfile: test.adoc
|
142
|
-
:nodoc:
|
143
|
-
:no-isobib:
|
144
|
-
HDR
|
145
|
-
|
146
|
-
ASCIIDOCTOR_ISO_DIR = Pathname
|
147
|
-
.new(File.dirname(__FILE__)) / "../lib/metanorma/iso"
|
148
|
-
|
149
|
-
BOILERPLATE =
|
150
|
-
HTMLEntities.new.decode(
|
151
|
-
File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate.xml", encoding: "utf-8")
|
152
|
-
.gsub(/\{\{ agency \}\}/, "ISO")
|
153
|
-
.gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
|
154
|
-
.gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
|
155
|
-
.gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
|
156
|
-
.gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
|
157
|
-
)
|
158
|
-
|
159
|
-
BOILERPLATE_FR =
|
160
|
-
HTMLEntities.new.decode(
|
161
|
-
File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate-fr.xml", encoding: "utf-8")
|
162
|
-
.gsub(/\{\{ agency \}\}/, "ISO")
|
163
|
-
.gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
|
164
|
-
.gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
|
165
|
-
.gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
|
166
|
-
.gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
|
167
|
-
)
|
168
|
-
|
169
|
-
BLANK_HDR1 = <<~"HDR".freeze
|
170
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
171
|
-
<iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
|
172
|
-
<bibdata type="standard">
|
173
|
-
<contributor>
|
174
|
-
<role type="author"/>
|
175
|
-
<organization>
|
176
|
-
<name>International Organization for Standardization</name>
|
177
|
-
<abbreviation>ISO</abbreviation>
|
178
|
-
</organization>
|
179
|
-
</contributor>
|
180
|
-
<contributor>
|
181
|
-
<role type="publisher"/>
|
182
|
-
<organization>
|
183
|
-
<name>International Organization for Standardization</name>
|
184
|
-
<abbreviation>ISO</abbreviation>
|
185
|
-
</organization>
|
186
|
-
</contributor>
|
187
|
-
<language>en</language>
|
188
|
-
<script>Latn</script>
|
189
|
-
<status>
|
190
|
-
<stage abbreviation="IS">60</stage>
|
191
|
-
<substage>60</substage>
|
192
|
-
</status>
|
193
|
-
<copyright>
|
194
|
-
<from>#{Time.new.year}</from>
|
195
|
-
<owner>
|
196
|
-
<organization>
|
197
|
-
<name>International Organization for Standardization</name>
|
198
|
-
<abbreviation>ISO</abbreviation>
|
199
|
-
</organization>
|
200
|
-
</owner>
|
201
|
-
</copyright>
|
202
|
-
<ext>
|
203
|
-
<doctype>standard</doctype>
|
204
|
-
<editorialgroup>
|
205
|
-
<agency>ISO</agency>
|
206
|
-
</editorialgroup>
|
207
|
-
<approvalgroup>
|
208
|
-
<agency>ISO</agency>
|
209
|
-
</approvalgroup>
|
210
|
-
<stagename>International standard</stagename>
|
211
|
-
</ext>
|
212
|
-
</bibdata>
|
213
|
-
HDR
|
214
|
-
|
215
|
-
BLANK_HDR = <<~"HDR".freeze
|
216
|
-
#{BLANK_HDR1}
|
217
|
-
#{BOILERPLATE}
|
218
|
-
HDR
|
219
|
-
|
220
|
-
BLANK_HDR_FR = <<~"HDR".freeze
|
221
|
-
#{BLANK_HDR1.sub(%r{<language>en</language>}, '<language>fr</language>')}
|
222
|
-
#{BOILERPLATE_FR}
|
223
|
-
HDR
|
224
|
-
|
225
|
-
TERM_BOILERPLATE = <<~TERM.freeze
|
226
|
-
<p id="_">For the purposes of this document,
|
227
|
-
the following terms and definitions apply.</p>
|
228
|
-
<p id="_">ISO and IEC maintain terminology databases for use in
|
229
|
-
standardization at the following addresses:</p>
|
230
|
-
|
231
|
-
<ul id="_">
|
232
|
-
<li>
|
233
|
-
<p id="_">ISO Online browsing platform: available at
|
234
|
-
<link target="https://www.iso.org/obp"/></p>
|
235
|
-
</li>
|
236
|
-
<li>
|
237
|
-
<p id="_">IEC Electropedia: available at
|
238
|
-
<link target="https://www.electropedia.org"/>
|
239
|
-
</p>
|
240
|
-
</li>
|
241
|
-
</ul>
|
242
|
-
TERM
|
243
|
-
|
244
|
-
HTML_HDR = <<~HDR.freeze
|
245
|
-
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
246
|
-
<head/>
|
247
|
-
<body lang="en">
|
248
|
-
<div class="title-section">
|
249
|
-
<p> </p>
|
250
|
-
</div>
|
251
|
-
<br/>
|
252
|
-
<div class="prefatory-section">
|
253
|
-
<p> </p>
|
254
|
-
</div>
|
255
|
-
<br/>
|
256
|
-
<div class="main-section">
|
257
|
-
HDR
|
258
|
-
|
259
|
-
WORD_HDR = <<~HDR.freeze
|
260
|
-
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
261
|
-
<head>
|
262
|
-
<title>test</title>
|
263
|
-
</head>
|
264
|
-
<body lang="EN-US" link="blue" vlink="#954F72">
|
265
|
-
<div class="WordSection1">
|
266
|
-
<p> </p>
|
267
|
-
</div>
|
268
|
-
<p><br clear="all" class="section"/></p>
|
269
|
-
<div class="WordSection2">
|
270
|
-
<p> </p>
|
271
|
-
</div>
|
272
|
-
<p><br clear="all" class="section"/></p>
|
273
|
-
<div class="WordSection3">
|
274
|
-
HDR
|
275
|
-
|
276
|
-
OPTIONS = [backend: :iso, header_footer: true].freeze
|
277
|
-
|
278
|
-
def mock_pdf
|
279
|
-
allow(::Mn2pdf).to receive(:convert) do |url, output,|
|
280
|
-
FileUtils.cp(url.gsub(/"/, ""), output.gsub(/"/, ""))
|
281
|
-
end
|
282
|
-
end
|
283
|
-
|
284
|
-
def mock_sts
|
285
|
-
allow(::Mn2sts).to receive(:convert) do |url, output,|
|
286
|
-
FileUtils.cp(url.gsub(/"/, ""), output.gsub(/"/, ""))
|
287
|
-
end
|
288
|
-
end
|
289
|
-
|
290
|
-
private
|
291
|
-
|
292
|
-
def get_xml(search, code, opts)
|
293
|
-
c = code.gsub(%r{[/\s:-]}, "_").sub(%r{_+$}, "").downcase
|
294
|
-
o = opts.keys.join "_"
|
295
|
-
file = "spec/examples/#{[c, o].join '_'}.xml"
|
296
|
-
if File.exist? file
|
297
|
-
File.read file
|
298
|
-
else
|
299
|
-
result = search.call(code)
|
300
|
-
hit = result&.first&.first
|
301
|
-
xml = hit.to_xml nil, opts
|
302
|
-
File.write file, xml
|
303
|
-
xml
|
304
|
-
end
|
305
|
-
end
|
306
|
-
|
307
|
-
def mock_open_uri(code)
|
308
|
-
expect(Iev).to receive(:get).with(code, "en") do |m, *args|
|
309
|
-
file = "spec/examples/#{code.tr('-', '_')}.html"
|
310
|
-
File.write file, m.call(*args).read unless File.exist? file
|
311
|
-
File.read file
|
312
|
-
end.at_least :once
|
313
|
-
end
|