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.
Files changed (110) 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 +7 -2
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +7 -2
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/wordstyle-dis.css +160 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.scss +154 -4
  11. data/lib/isodoc/iso/html/wordstyle.css +150 -0
  12. data/lib/isodoc/iso/html/wordstyle.scss +144 -0
  13. data/lib/isodoc/iso/i18n-en.yaml +4 -4
  14. data/lib/isodoc/iso/iso.amendment.xsl +1649 -1199
  15. data/lib/isodoc/iso/iso.international-standard.xsl +1649 -1199
  16. data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
  17. data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
  18. data/lib/isodoc/iso/word_convert.rb +6 -4
  19. data/lib/isodoc/iso/word_dis_cleanup.rb +30 -8
  20. data/lib/isodoc/iso/word_dis_convert.rb +5 -2
  21. data/lib/metanorma/iso/base.rb +2 -1
  22. data/lib/metanorma/iso/biblio.rng +5 -0
  23. data/lib/metanorma/iso/isodoc.rng +47 -13
  24. data/lib/metanorma/iso/validate.rb +2 -2
  25. data/lib/metanorma/iso/version.rb +1 -1
  26. data/metanorma-iso.gemspec +5 -2
  27. metadata +4 -87
  28. data/.github/workflows/automerge.yml +0 -31
  29. data/.github/workflows/rake.yml +0 -15
  30. data/.github/workflows/release.yml +0 -24
  31. data/.github/workflows/ubuntu.yml +0 -41
  32. data/Rakefile +0 -8
  33. data/bin/rspec +0 -17
  34. data/spec/assets/header.html +0 -7
  35. data/spec/assets/html.css +0 -2
  36. data/spec/assets/htmlcover.html +0 -4
  37. data/spec/assets/htmlintro.html +0 -5
  38. data/spec/assets/i18n.yaml +0 -2
  39. data/spec/assets/iso.adoc +0 -10
  40. data/spec/assets/iso.headless.html +0 -33
  41. data/spec/assets/iso.xml +0 -71
  42. data/spec/assets/rice_image1.png +0 -0
  43. data/spec/assets/scripts.html +0 -3
  44. data/spec/assets/std.css +0 -2
  45. data/spec/assets/word.css +0 -2
  46. data/spec/assets/wordcover.html +0 -3
  47. data/spec/assets/wordintro.html +0 -4
  48. data/spec/examples/103_01_02.html +0 -247
  49. data/spec/examples/english.yaml +0 -69
  50. data/spec/examples/iso_123_.xml +0 -45
  51. data/spec/examples/iso_123_all_parts.xml +0 -45
  52. data/spec/examples/iso_123_no_year_note.xml +0 -46
  53. data/spec/examples/iso_124_.xml +0 -41
  54. data/spec/examples/iso_216_.xml +0 -47
  55. data/spec/examples/iso_iec_12382_.xml +0 -48
  56. data/spec/examples/rice.adoc +0 -714
  57. data/spec/examples/rice.preview.html +0 -1870
  58. data/spec/examples/rice.sh +0 -4
  59. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  60. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  61. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  62. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  63. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  64. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  65. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  66. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  67. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  68. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  69. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  70. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  71. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  72. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  73. data/spec/examples/rice_img/rice_image1.png +0 -0
  74. data/spec/examples/rice_img/rice_image2.png +0 -0
  75. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  76. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  77. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  78. data/spec/isodoc/amd_spec.rb +0 -986
  79. data/spec/isodoc/blocks_spec.rb +0 -1174
  80. data/spec/isodoc/i18n_spec.rb +0 -1579
  81. data/spec/isodoc/inline_spec.rb +0 -1060
  82. data/spec/isodoc/iso_spec.rb +0 -255
  83. data/spec/isodoc/metadata_spec.rb +0 -701
  84. data/spec/isodoc/postproc_spec.rb +0 -1089
  85. data/spec/isodoc/ref_spec.rb +0 -439
  86. data/spec/isodoc/section_spec.rb +0 -998
  87. data/spec/isodoc/table_spec.rb +0 -420
  88. data/spec/isodoc/terms_spec.rb +0 -314
  89. data/spec/isodoc/word_dis_spec.rb +0 -2064
  90. data/spec/isodoc/xref_spec.rb +0 -1747
  91. data/spec/metanorma/amd_spec.rb +0 -724
  92. data/spec/metanorma/base_spec.rb +0 -1384
  93. data/spec/metanorma/blank_spec.rb +0 -38
  94. data/spec/metanorma/blocks_spec.rb +0 -624
  95. data/spec/metanorma/cleanup_spec.rb +0 -1645
  96. data/spec/metanorma/inline_spec.rb +0 -203
  97. data/spec/metanorma/lists_spec.rb +0 -197
  98. data/spec/metanorma/macros_spec.rb +0 -99
  99. data/spec/metanorma/processor_spec.rb +0 -161
  100. data/spec/metanorma/refs_spec.rb +0 -672
  101. data/spec/metanorma/section_spec.rb +0 -492
  102. data/spec/metanorma/table_spec.rb +0 -329
  103. data/spec/metanorma/validate_spec.rb +0 -2153
  104. data/spec/relaton/render_spec.rb +0 -568
  105. data/spec/requirements/requirement_components_spec.rb +0 -610
  106. data/spec/requirements/requirements_spec.rb +0 -1596
  107. data/spec/requirements/xref_spec.rb +0 -1211
  108. data/spec/spec_helper.rb +0 -313
  109. data/spec/vcr_cassettes/docrels.yml +0 -385
  110. 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>&#160;</p>
250
- </div>
251
- <br/>
252
- <div class="prefatory-section">
253
- <p>&#160;</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>&#160;</p>
267
- </div>
268
- <p><br clear="all" class="section"/></p>
269
- <div class="WordSection2">
270
- <p>&#160;</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