metanorma-iso 2.1.0 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/html2doc/lists.rb +145 -10
  3. data/lib/isodoc/iso/base_convert.rb +11 -1
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -0
  5. data/lib/isodoc/iso/html/isodoc-dis.css +216 -278
  6. data/lib/isodoc/iso/html/isodoc-dis.scss +294 -288
  7. data/lib/isodoc/iso/html/isodoc.css +38 -13
  8. data/lib/isodoc/iso/html/isodoc.scss +38 -12
  9. data/lib/isodoc/iso/html/style-human.css +14 -1
  10. data/lib/isodoc/iso/html/style-human.scss +10 -1
  11. data/lib/isodoc/iso/html/style-iso.css +35 -23
  12. data/lib/isodoc/iso/html/style-iso.scss +31 -23
  13. data/lib/isodoc/iso/html/word_iso_intro-dis.html +1 -6
  14. data/lib/isodoc/iso/html/word_iso_titlepage-dis.html +24 -13
  15. data/lib/isodoc/iso/html/word_iso_titlepage-prf.html +58 -0
  16. data/lib/isodoc/iso/html/word_iso_titlepage.html +10 -6
  17. data/lib/isodoc/iso/html/wordstyle-dis.css +12 -62
  18. data/lib/isodoc/iso/html/wordstyle-dis.scss +7 -56
  19. data/lib/isodoc/iso/html_convert.rb +7 -2
  20. data/lib/isodoc/iso/i18n-en.yaml +32 -4
  21. data/lib/isodoc/iso/i18n-fr.yaml +29 -3
  22. data/lib/isodoc/iso/i18n-ru.yaml +32 -4
  23. data/lib/isodoc/iso/i18n-zh-Hans.yaml +32 -3
  24. data/lib/isodoc/iso/i18n.rb +1 -1
  25. data/lib/isodoc/iso/iso.amendment.xsl +1570 -246
  26. data/lib/isodoc/iso/iso.international-standard.xsl +1570 -246
  27. data/lib/isodoc/iso/metadata.rb +67 -67
  28. data/lib/isodoc/iso/presentation_bibdata.rb +74 -0
  29. data/lib/isodoc/iso/presentation_xml_convert.rb +16 -5
  30. data/lib/isodoc/iso/presentation_xref.rb +10 -4
  31. data/lib/isodoc/iso/sections.rb +3 -3
  32. data/lib/isodoc/iso/word_cleanup.rb +3 -0
  33. data/lib/isodoc/iso/word_convert.rb +8 -5
  34. data/lib/isodoc/iso/word_dis_cleanup.rb +235 -0
  35. data/lib/isodoc/iso/word_dis_convert.rb +48 -100
  36. data/lib/isodoc/iso/xref.rb +34 -6
  37. data/lib/metanorma/iso/base.rb +20 -1
  38. data/lib/metanorma/iso/biblio.rng +134 -39
  39. data/lib/metanorma/iso/boilerplate-fr.xml +3 -0
  40. data/lib/metanorma/iso/boilerplate-ru.xml +3 -0
  41. data/lib/metanorma/iso/boilerplate.xml +3 -0
  42. data/lib/metanorma/iso/cleanup.rb +49 -11
  43. data/lib/metanorma/iso/front.rb +38 -6
  44. data/lib/metanorma/iso/front_id.rb +2 -0
  45. data/lib/metanorma/iso/isodoc.rng +16 -0
  46. data/lib/metanorma/iso/isostandard.rng +30 -12
  47. data/lib/metanorma/iso/macros.rb +29 -0
  48. data/lib/metanorma/iso/validate_section.rb +0 -12
  49. data/lib/metanorma/iso/version.rb +1 -1
  50. data/spec/isodoc/amd_spec.rb +20 -46
  51. data/spec/isodoc/blocks_spec.rb +499 -2
  52. data/spec/isodoc/i18n_spec.rb +145 -80
  53. data/spec/isodoc/iso_spec.rb +50 -169
  54. data/spec/isodoc/metadata_spec.rb +240 -99
  55. data/spec/isodoc/postproc_spec.rb +43 -7
  56. data/spec/isodoc/section_spec.rb +9 -9
  57. data/spec/isodoc/word_dis_spec.rb +1332 -146
  58. data/spec/isodoc/xref_spec.rb +87 -13
  59. data/spec/metanorma/amd_spec.rb +39 -23
  60. data/spec/metanorma/base_spec.rb +174 -44
  61. data/spec/metanorma/blocks_spec.rb +54 -0
  62. data/spec/metanorma/lists_spec.rb +2 -2
  63. data/spec/metanorma/section_spec.rb +2 -2
  64. data/spec/metanorma/validate_spec.rb +8 -19
  65. data/spec/spec_helper.rb +17 -7
  66. data/spec/vcr_cassettes/withdrawn_iso.yml +30 -30
  67. metadata +7 -8
  68. data/docs/asciiiso-syntax.adoc +0 -307
  69. data/docs/guidance.adoc +0 -487
  70. data/docs/navigation.adoc +0 -23
  71. data/docs/quickstart.adoc +0 -179
  72. data/lib/isodoc/iso/presentation_inline.rb +0 -90
@@ -150,7 +150,7 @@ RSpec.describe Metanorma::ISO do
150
150
  expect(File.read("test.err")).to include "Scope clause missing"
151
151
  end
152
152
 
153
- it "Scope clause not missing 1" do
153
+ it "Scope clause not missing if supplied" do
154
154
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
155
155
  = Document title
156
156
  Author
@@ -164,7 +164,7 @@ RSpec.describe Metanorma::ISO do
164
164
  expect(File.read("test.err")).not_to include "Scope clause missing"
165
165
  end
166
166
 
167
- it "Scope clause not missing 2" do
167
+ it "Scope clause not missing in amendments" do
168
168
  FileUtils.rm_f "test.err"
169
169
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
170
170
  = Document title
@@ -196,7 +196,7 @@ RSpec.describe Metanorma::ISO do
196
196
  expect(File.read("test.err")).to include "Normative references missing"
197
197
  end
198
198
 
199
- it "Normative references not missing 1" do
199
+ it "Normative references not missing if supplied" do
200
200
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
201
201
  = Document title
202
202
  Author
@@ -212,7 +212,7 @@ RSpec.describe Metanorma::ISO do
212
212
  .not_to include "Normative references missing"
213
213
  end
214
214
 
215
- it "Normative references not missing 2" do
215
+ it "Normative references not missing in amendments" do
216
216
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
217
217
  = Document title
218
218
  Author
@@ -243,7 +243,7 @@ RSpec.describe Metanorma::ISO do
243
243
  expect(File.read("test.err")).to include "Terms & definitions missing"
244
244
  end
245
245
 
246
- it "Terms & definitions not missing 1" do
246
+ it "Terms & definitions not missing if supplied" do
247
247
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
248
248
  = Document title
249
249
  Author
@@ -258,7 +258,7 @@ RSpec.describe Metanorma::ISO do
258
258
  expect(File.read("test.err")).not_to include "Terms & definitions missing"
259
259
  end
260
260
 
261
- it "Terms & definitions not missing 2" do
261
+ it "Terms & definitions not missing in amendment" do
262
262
  Asciidoctor.convert(<<~"INPUT", *OPTIONS)
263
263
  = Document title
264
264
  Author
@@ -1699,6 +1699,7 @@ RSpec.describe Metanorma::ISO do
1699
1699
  :docfile: test.adoc
1700
1700
  :nodoc:
1701
1701
  :technical-committee-type: X
1702
+ :technical-committee-number: X
1702
1703
  :no-isobib:
1703
1704
 
1704
1705
  INPUT
@@ -1712,19 +1713,7 @@ RSpec.describe Metanorma::ISO do
1712
1713
  :docfile: test.adoc
1713
1714
  :nodoc:
1714
1715
  :subcommittee-type: X
1715
- :no-isobib:
1716
-
1717
- INPUT
1718
- expect(File.read("test.err")).to include "invalid subcommittee type"
1719
- end
1720
-
1721
- it "Warning if invalid subcommittee type" do
1722
- Asciidoctor.convert(<<~"INPUT", *OPTIONS)
1723
- = Document title
1724
- Author
1725
- :docfile: test.adoc
1726
- :nodoc:
1727
- :subcommittee-type: X
1716
+ :subcommittee-number: X
1728
1717
  :no-isobib:
1729
1718
 
1730
1719
  INPUT
data/spec/spec_helper.rb CHANGED
@@ -47,7 +47,7 @@ RSpec.configure do |config|
47
47
  end
48
48
 
49
49
  def strip_guid(xml)
50
- xml.gsub(%r{ id="_[^"]+"}, ' id="_"')
50
+ xml.gsub(%r{ id=['"]_[^"']+['"]}, ' id="_"')
51
51
  .gsub(%r{ target="_[^"]+"}, ' target="_"')
52
52
  .gsub(%r{ src="cid:[^.]+.gif"}, ' src="_.gif"')
53
53
  .gsub(%r{ src='cid:[^.]+.gif'}, ' src="_.gif"')
@@ -60,6 +60,13 @@ def metadata(hash)
60
60
  end
61
61
 
62
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
63
70
  s = ""
64
71
  f = REXML::Formatters::Pretty.new(2)
65
72
  f.compact = true
@@ -144,7 +151,8 @@ BOILERPLATE =
144
151
  File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate.xml", encoding: "utf-8")
145
152
  .gsub(/\{\{ agency \}\}/, "ISO")
146
153
  .gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
147
- .gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "")
154
+ .gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
155
+ .gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
148
156
  .gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
149
157
  )
150
158
 
@@ -153,7 +161,8 @@ BOILERPLATE_FR =
153
161
  File.read(ASCIIDOCTOR_ISO_DIR / "boilerplate-fr.xml", encoding: "utf-8")
154
162
  .gsub(/\{\{ agency \}\}/, "ISO")
155
163
  .gsub(/\{\{ docyear \}\}/, Date.today.year.to_s)
156
- .gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "")
164
+ .gsub(/\{% if unpublished %\}.*?\{% endif %\}/m, "")
165
+ .gsub(/\{% if stage_int >= 40 %\}(.*?)\{% endif %\}/m, "\\1")
157
166
  .gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’"),
158
167
  )
159
168
 
@@ -191,12 +200,13 @@ BLANK_HDR1 = <<~"HDR".freeze
191
200
  </owner>
192
201
  </copyright>
193
202
  <ext>
194
- <doctype>article</doctype>
203
+ <doctype>standard</doctype>
195
204
  <editorialgroup>
196
- <technical-committee/>
197
- <subcommittee/>
198
- <workgroup/>
205
+ <agency>ISO</agency>
199
206
  </editorialgroup>
207
+ <approvalgroup>
208
+ <agency>ISO</agency>
209
+ </approvalgroup>
200
210
  <stagename>International standard</stagename>
201
211
  </ext>
202
212
  </bibdata>