metanorma-iso 1.5.6 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/macos.yml +9 -1
  3. data/.github/workflows/ubuntu.yml +8 -0
  4. data/.github/workflows/windows.yml +7 -0
  5. data/lib/asciidoctor/iso/basicdoc.rng +4 -11
  6. data/lib/asciidoctor/iso/boilerplate-fr.xml +40 -0
  7. data/lib/asciidoctor/iso/boilerplate.xml +1 -0
  8. data/lib/asciidoctor/iso/cleanup.rb +5 -0
  9. data/lib/asciidoctor/iso/front.rb +9 -15
  10. data/lib/asciidoctor/iso/isodoc.rng +14 -50
  11. data/lib/asciidoctor/iso/isostandard.rng +8 -1
  12. data/lib/isodoc/iso/html/header.html +8 -16
  13. data/lib/isodoc/iso/html/style-human.css +5 -1
  14. data/lib/isodoc/iso/html/style-iso.css +5 -1
  15. data/lib/isodoc/iso/i18n-en.yaml +3 -0
  16. data/lib/isodoc/iso/i18n-fr.yaml +3 -0
  17. data/lib/isodoc/iso/i18n-zh-Hans.yaml +4 -0
  18. data/lib/isodoc/iso/iso.amendment.xsl +543 -94
  19. data/lib/isodoc/iso/iso.international-standard.xsl +543 -94
  20. data/lib/isodoc/iso/isosts_convert.rb +31 -0
  21. data/lib/isodoc/iso/metadata.rb +19 -19
  22. data/lib/metanorma-iso.rb +1 -0
  23. data/lib/metanorma/iso/processor.rb +1 -1
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/metanorma-iso.gemspec +1 -1
  26. data/spec/asciidoctor-iso/amd_spec.rb +7 -7
  27. data/spec/asciidoctor-iso/base_spec.rb +144 -18
  28. data/spec/asciidoctor-iso/validate_spec.rb +35 -15
  29. data/spec/assets/xref_error.adoc +7 -0
  30. data/spec/isodoc/amd_spec.rb +191 -17
  31. data/spec/isodoc/blocks_spec.rb +1 -1
  32. data/spec/isodoc/i18n_spec.rb +13 -13
  33. data/spec/isodoc/inline_spec.rb +2 -2
  34. data/spec/isodoc/iso_spec.rb +2 -2
  35. data/spec/isodoc/metadata_spec.rb +170 -19
  36. data/spec/isodoc/postproc_spec.rb +3 -3
  37. data/spec/isodoc/ref_spec.rb +3 -3
  38. data/spec/isodoc/section_spec.rb +2 -2
  39. data/spec/isodoc/table_spec.rb +1 -1
  40. data/spec/isodoc/terms_spec.rb +1 -1
  41. data/spec/isodoc/xref_spec.rb +11 -11
  42. data/spec/metanorma/processor_spec.rb +1 -1
  43. data/spec/spec_helper.rb +22 -2
  44. metadata +7 -4
@@ -611,9 +611,9 @@ documentation.</p>
611
611
  INPUT
612
612
 
613
613
  presxml = <<~OUTPUT
614
- <iso-standard xmlns="http://riboseinc.com/isoxml">
614
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
615
615
  <bibdata type="standard">
616
- <status><stage>30</stage></status>
616
+ <status><stage language="">30</stage></status>
617
617
  </bibdata>
618
618
  <boilerplate>
619
619
  <copyright-statement>
@@ -661,7 +661,7 @@ documentation.</p>
661
661
 
662
662
  FileUtils.rm_f "test.doc"
663
663
  FileUtils.rm_f "test.html"
664
- expect((IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
664
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
665
665
  IsoDoc::Iso::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", presxml, false)
666
666
  word = File.read("test.html", encoding: "UTF-8")
667
667
  expect((word)).to include '<h1 class="IntroTitle">Warning for Stuff</h1>'
@@ -121,9 +121,9 @@ RSpec.describe IsoDoc do
121
121
  </iso-standard>
122
122
  INPUT
123
123
  presxml = <<~OUTPUT
124
- <iso-standard xmlns='http://riboseinc.com/isoxml'>
124
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
125
125
  <bibdata>
126
- <language>en</language>
126
+ <language current="true">en</language>
127
127
  </bibdata>
128
128
  <preface>
129
129
  <foreword>
@@ -339,7 +339,7 @@ html = <<~OUTPUT
339
339
  </body>
340
340
  </html>
341
341
  OUTPUT
342
- expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
342
+ expect(xmlpp(IsoDoc::Iso::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
343
343
  expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
344
344
  end
345
345
 
@@ -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.6
4
+ version: 1.5.11
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-10-25 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
@@ -284,6 +284,7 @@ files:
284
284
  - lib/asciidoctor/iso/base.rb
285
285
  - lib/asciidoctor/iso/basicdoc.rng
286
286
  - lib/asciidoctor/iso/biblio.rng
287
+ - lib/asciidoctor/iso/boilerplate-fr.xml
287
288
  - lib/asciidoctor/iso/boilerplate.xml
288
289
  - lib/asciidoctor/iso/cleanup.rb
289
290
  - lib/asciidoctor/iso/converter.rb
@@ -327,6 +328,7 @@ files:
327
328
  - lib/isodoc/iso/init.rb
328
329
  - lib/isodoc/iso/iso.amendment.xsl
329
330
  - lib/isodoc/iso/iso.international-standard.xsl
331
+ - lib/isodoc/iso/isosts_convert.rb
330
332
  - lib/isodoc/iso/metadata.rb
331
333
  - lib/isodoc/iso/pdf_convert.rb
332
334
  - lib/isodoc/iso/presentation_xml_convert.rb
@@ -363,6 +365,7 @@ files:
363
365
  - spec/assets/word.css
364
366
  - spec/assets/wordcover.html
365
367
  - spec/assets/wordintro.html
368
+ - spec/assets/xref_error.adoc
366
369
  - spec/examples/103_01_02.html
367
370
  - spec/examples/english.yaml
368
371
  - spec/examples/iso_123_.xml