metanorma-iso 1.5.7 → 1.5.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/rake.yml +66 -0
  4. data/.github/workflows/ubuntu.yml +8 -0
  5. data/.github/workflows/windows.yml +7 -0
  6. data/README.adoc +5 -6
  7. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  8. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  9. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  10. data/lib/asciidoctor/iso/cleanup.rb +38 -0
  11. data/lib/asciidoctor/iso/front.rb +9 -15
  12. data/lib/asciidoctor/iso/isodoc.rng +27 -50
  13. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  14. data/lib/asciidoctor/iso/validate.rb +1 -1
  15. data/lib/asciidoctor/iso/validate_section.rb +9 -0
  16. data/lib/isodoc/iso/html/header.html +12 -24
  17. data/lib/isodoc/iso/html/style-human.css +5 -1
  18. data/lib/isodoc/iso/html/style-iso.css +5 -1
  19. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  20. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  21. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  22. data/lib/isodoc/iso/i18n.rb +10 -11
  23. data/lib/isodoc/iso/iso.amendment.xsl +732 -138
  24. data/lib/isodoc/iso/iso.international-standard.xsl +732 -138
  25. data/lib/isodoc/iso/metadata.rb +19 -19
  26. data/lib/metanorma-iso.rb +1 -0
  27. data/lib/metanorma/iso/processor.rb +1 -1
  28. data/lib/metanorma/iso/version.rb +1 -1
  29. data/metanorma-iso.gemspec +1 -1
  30. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  31. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  32. data/spec/asciidoctor-iso/cleanup_spec.rb +4 -4
  33. data/spec/asciidoctor-iso/refs_spec.rb +174 -143
  34. data/spec/asciidoctor-iso/validate_spec.rb +52 -15
  35. data/spec/assets/xref_error.adoc +7 -0
  36. data/spec/isodoc/amd_spec.rb +191 -17
  37. data/spec/isodoc/blocks_spec.rb +2 -1
  38. data/spec/isodoc/i18n_spec.rb +13 -13
  39. data/spec/isodoc/inline_spec.rb +2 -2
  40. data/spec/isodoc/iso_spec.rb +2 -2
  41. data/spec/isodoc/metadata_spec.rb +170 -19
  42. data/spec/isodoc/postproc_spec.rb +3 -3
  43. data/spec/isodoc/ref_spec.rb +5 -5
  44. data/spec/isodoc/section_spec.rb +2 -2
  45. data/spec/isodoc/table_spec.rb +1 -1
  46. data/spec/isodoc/terms_spec.rb +1 -1
  47. data/spec/isodoc/xref_spec.rb +11 -11
  48. data/spec/metanorma/processor_spec.rb +1 -1
  49. data/spec/spec_helper.rb +22 -2
  50. metadata +7 -4
@@ -70,7 +70,7 @@ RSpec.describe IsoDoc do
70
70
  INPUT
71
71
 
72
72
  presxml = <<~OUTPUT
73
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
73
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
74
74
  <preface>
75
75
  <foreword obligation='informative'>
76
76
  <title>Foreword</title>
@@ -361,7 +361,7 @@ OUTPUT
361
361
  INPUT
362
362
 
363
363
  presxml = <<~OUTPUT
364
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
364
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
365
365
  <sections>
366
366
  <clause id='D' obligation='normative'>
367
367
  <title depth='1'>1<tab/>Scope</title>
@@ -61,7 +61,7 @@ RSpec.describe IsoDoc do
61
61
  </iso-standard>
62
62
  INPUT
63
63
  <?xml version='1.0'?>
64
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
64
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
65
65
  <preface>
66
66
  <foreword>
67
67
  <table id='tableD-1' alt='tool tip' summary='long desc'>
@@ -53,7 +53,7 @@ RSpec.describe IsoDoc do
53
53
  </iso-standard>
54
54
  INPUT
55
55
  presxml = <<~OUTPUT
56
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
56
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
57
57
  <sections>
58
58
  <terms id='_terms_and_definitions' obligation='normative'>
59
59
  <title depth='1'>1<tab/>Terms and Definitions</title>
@@ -56,7 +56,7 @@ RSpec.describe IsoDoc do
56
56
  </iso-standard>
57
57
  INPUT
58
58
  <?xml version='1.0'?>
59
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
59
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
60
60
  <preface>
61
61
  <foreword>
62
62
  <p>
@@ -202,7 +202,7 @@ RSpec.describe IsoDoc do
202
202
  </iso-standard>
203
203
  INPUT
204
204
  <?xml version='1.0'?>
205
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
205
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
206
206
  <preface>
207
207
  <foreword id='fwd'>
208
208
  <p>
@@ -322,7 +322,7 @@ RSpec.describe IsoDoc do
322
322
  </iso-standard>
323
323
  INPUT
324
324
  <?xml version='1.0'?>
325
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
325
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
326
326
  <preface>
327
327
  <foreword id='fwd'>
328
328
  <p>
@@ -435,7 +435,7 @@ RSpec.describe IsoDoc do
435
435
  </iso-standard>
436
436
  INPUT
437
437
  <?xml version='1.0'?>
438
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
438
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
439
439
  <preface>
440
440
  <foreword>
441
441
  <p>
@@ -568,7 +568,7 @@ RSpec.describe IsoDoc do
568
568
  </iso-standard>
569
569
  INPUT
570
570
  <?xml version='1.0'?>
571
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
571
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
572
572
  <preface>
573
573
  <foreword>
574
574
  <p>
@@ -729,7 +729,7 @@ RSpec.describe IsoDoc do
729
729
  </iso-standard>
730
730
  INPUT
731
731
  <?xml version='1.0'?>
732
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
732
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
733
733
  <preface>
734
734
  <foreword>
735
735
  <p>
@@ -863,7 +863,7 @@ RSpec.describe IsoDoc do
863
863
  </iso-standard>
864
864
  INPUT
865
865
  <?xml version='1.0'?>
866
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
866
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
867
867
  <preface>
868
868
  <foreword>
869
869
  <p>
@@ -998,7 +998,7 @@ RSpec.describe IsoDoc do
998
998
  </iso-standard>
999
999
  INPUT
1000
1000
  <?xml version='1.0'?>
1001
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1001
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1002
1002
  <preface>
1003
1003
  <foreword obligation='informative'>
1004
1004
  <title>Foreword</title>
@@ -1198,7 +1198,7 @@ RSpec.describe IsoDoc do
1198
1198
  </iso-standard>
1199
1199
  INPUT
1200
1200
  <?xml version='1.0'?>
1201
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1201
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1202
1202
  <preface>
1203
1203
  <foreword>
1204
1204
  <p>
@@ -1318,7 +1318,7 @@ RSpec.describe IsoDoc do
1318
1318
  </iso-standard>
1319
1319
  INPUT
1320
1320
  <?xml version='1.0'?>
1321
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1321
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1322
1322
  <preface>
1323
1323
  <foreword>
1324
1324
  <p>
@@ -1422,7 +1422,7 @@ RSpec.describe IsoDoc do
1422
1422
  </iso-standard>
1423
1423
  INPUT
1424
1424
  <?xml version='1.0'?>
1425
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
1425
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1426
1426
  <preface>
1427
1427
  <foreword>
1428
1428
  <p>
@@ -15,7 +15,7 @@ RSpec.describe Metanorma::Iso::Processor do
15
15
 
16
16
  it "registers output formats against metanorma" do
17
17
  expect(processor.output_formats.sort.to_s).to be_equivalent_to <<~"OUTPUT"
18
- [[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:isosts, "sts.xml"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
18
+ [[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:isosts, "iso.sts.xml"], [:pdf, "pdf"], [:presentation, "presentation.xml"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
19
19
  OUTPUT
20
20
  end
21
21
 
@@ -29,6 +29,10 @@ def strip_guid(x)
29
29
  x.gsub(%r{ id="_[^"]+"}, ' id="_"').gsub(%r{ target="_[^"]+"}, ' target="_"')
30
30
  end
31
31
 
32
+ def metadata(x)
33
+ Hash[x.sort].delete_if{ |k, v| v.nil? || v.respond_to?(:empty?) && v.empty? }
34
+ end
35
+
32
36
  def xmlpp(x)
33
37
  s = ""
34
38
  f = REXML::Formatters::Pretty.new(2)
@@ -114,10 +118,17 @@ BOILERPLATE =
114
118
  gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
115
119
  )
116
120
 
121
+ BOILERPLATE_FR =
122
+ HTMLEntities.new.decode(
123
+ File.read(File.join(File.dirname(__FILE__), "..", "lib", "asciidoctor", "iso", "boilerplate-fr.xml"), encoding: "utf-8").
124
+ gsub(/\{\{ agency \}\}/, "ISO").gsub(/\{\{ docyear \}\}/, Date.today.year.to_s).
125
+ gsub(/\{% if unpublished %\}.*\{% endif %\}/m, "").
126
+ gsub(/(?<=\p{Alnum})'(?=\p{Alpha})/, "’")
127
+ )
117
128
 
118
- BLANK_HDR = <<~"HDR"
129
+ BLANK_HDR1 = <<~"HDR"
119
130
  <?xml version="1.0" encoding="UTF-8"?>
120
- <iso-standard xmlns="https://www.metanorma.org/ns/iso">
131
+ <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="#{Metanorma::ISO::VERSION}">
121
132
  <bibdata type="standard">
122
133
  <contributor>
123
134
  <role type="author"/>
@@ -158,9 +169,18 @@ BLANK_HDR = <<~"HDR"
158
169
  <stagename>International standard</stagename>
159
170
  </ext>
160
171
  </bibdata>
172
+ HDR
173
+
174
+ BLANK_HDR = <<~"HDR"
175
+ #{BLANK_HDR1}
161
176
  #{BOILERPLATE}
162
177
  HDR
163
178
 
179
+ BLANK_HDR_FR = <<~"HDR"
180
+ #{BLANK_HDR1.sub(%r{<language>en</language>}, "<language>fr</language>")}
181
+ #{BOILERPLATE_FR}
182
+ HDR
183
+
164
184
  TERM_BOILERPLATE = <<~END
165
185
  <p id="_">For the purposes of this document,
166
186
  the following terms and definitions apply.</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.7
4
+ version: 1.5.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-11 00:00:00.000000000 Z
11
+ date: 2020-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.5.0
47
+ version: 1.6.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.5.0
54
+ version: 1.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: tokenizer
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -262,6 +262,7 @@ extra_rdoc_files: []
262
262
  files:
263
263
  - ".gitattributes"
264
264
  - ".github/workflows/macos.yml"
265
+ - ".github/workflows/rake.yml"
265
266
  - ".github/workflows/ubuntu.yml"
266
267
  - ".github/workflows/windows.yml"
267
268
  - ".gitignore"
@@ -284,6 +285,7 @@ files:
284
285
  - lib/asciidoctor/iso/base.rb
285
286
  - lib/asciidoctor/iso/basicdoc.rng
286
287
  - lib/asciidoctor/iso/biblio.rng
288
+ - lib/asciidoctor/iso/boilerplate-fr.xml
287
289
  - lib/asciidoctor/iso/boilerplate.xml
288
290
  - lib/asciidoctor/iso/cleanup.rb
289
291
  - lib/asciidoctor/iso/converter.rb
@@ -364,6 +366,7 @@ files:
364
366
  - spec/assets/word.css
365
367
  - spec/assets/wordcover.html
366
368
  - spec/assets/wordintro.html
369
+ - spec/assets/xref_error.adoc
367
370
  - spec/examples/103_01_02.html
368
371
  - spec/examples/english.yaml
369
372
  - spec/examples/iso_123_.xml