metanorma-iso 1.3.25 → 1.3.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/asciidoctor/iso/base.rb +6 -0
  3. data/lib/asciidoctor/iso/biblio.rng +13 -3
  4. data/lib/asciidoctor/iso/front.rb +3 -155
  5. data/lib/asciidoctor/iso/front_id.rb +196 -0
  6. data/lib/asciidoctor/iso/isodoc.rng +17 -1
  7. data/lib/asciidoctor/iso/isostandard.rng +7 -1
  8. data/lib/asciidoctor/iso/term_lookup_cleanup.rb +5 -8
  9. data/lib/asciidoctor/iso/validate_requirements.rb +1 -1
  10. data/lib/asciidoctor/iso/validate_style.rb +6 -5
  11. data/lib/isodoc/iso/base_convert.rb +1 -33
  12. data/lib/isodoc/iso/html/header.html +5 -1
  13. data/lib/isodoc/iso/html/html_iso_titlepage.html +9 -0
  14. data/lib/isodoc/iso/html/isodoc.scss +21 -0
  15. data/lib/isodoc/iso/html/style-human.scss +5 -1
  16. data/lib/isodoc/iso/html/style-iso.scss +5 -1
  17. data/lib/isodoc/iso/html/word_iso_titlepage.html +4 -4
  18. data/lib/isodoc/iso/html/wordstyle.scss +20 -6
  19. data/lib/isodoc/iso/iso.amendment.xsl +4597 -0
  20. data/lib/isodoc/iso/iso.international-standard.xsl +494 -283
  21. data/lib/isodoc/iso/metadata.rb +30 -26
  22. data/lib/isodoc/iso/pdf_convert.rb +9 -2
  23. data/lib/isodoc/iso/sections.rb +66 -0
  24. data/lib/isodoc/iso/sts_convert.rb +29 -0
  25. data/lib/metanorma-iso.rb +1 -0
  26. data/lib/metanorma/iso/processor.rb +4 -1
  27. data/lib/metanorma/iso/version.rb +1 -1
  28. data/metanorma-iso.gemspec +4 -1
  29. data/spec/asciidoctor-iso/amd_spec.rb +412 -4
  30. data/spec/asciidoctor-iso/base_spec.rb +15 -13
  31. data/spec/asciidoctor-iso/macros_spec.rb +15 -13
  32. data/spec/isodoc/amd_spec.rb +606 -0
  33. data/spec/isodoc/metadata_spec.rb +4 -2
  34. data/spec/isodoc/postproc_spec.rb +8 -8
  35. data/spec/isodoc/ref_spec.rb +1 -1
  36. data/spec/isodoc/section_spec.rb +28 -1
  37. data/spec/metanorma/processor_spec.rb +1 -1
  38. metadata +51 -4
@@ -60,6 +60,8 @@ RSpec.describe IsoDoc::Iso::Metadata do
60
60
  </organization>
61
61
  </owner>
62
62
  </copyright>
63
+ <keyword>kw2</keyword>
64
+ <keyword>kw1</keyword>
63
65
  <ext>
64
66
  <doctype>international-standard</doctype>
65
67
  <editorialgroup>
@@ -76,7 +78,7 @@ RSpec.describe IsoDoc::Iso::Metadata do
76
78
  </bibdata>
77
79
  </iso-standard>
78
80
  INPUT
79
- {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>"ISO/PreCD3 17301-1 (E)", :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)", :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>"XXX", :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
81
+ {:accesseddate=>"2012", :activateddate=>"2013", :agency=>"ISO", :authors=>[], :authors_affiliations=>{}, :createddate=>"2010&ndash;2011", :docnumber=>"ISO/PreCD3 17301-1", :docnumber_lang=>"ISO/PreCD3 17301-1 (E)", :docnumber_reference=>"ISO/PreCD3 17301-1:2000 (E)", :docnumeric=>"1730", :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1", :doctype=>"International Standard", :docyear=>"2016", :draft=>"0.4", :draftinfo=>" (draft 0.4, 2016-05-01)", :edition=>"2", :editorialgroup=>["TC 34", "SC 4", "WG 3"], :ics=>nil, :keywords=>["kw2", "kw1"], :obsoleteddate=>"2014", :obsoletes=>nil, :obsoletes_part=>nil, :publisheddate=>"2011", :publisher=>"International Organization for Standardization", :revdate=>"2016-05-01", :revdate_monthyear=>"May 2016", :sc=>"SC 4", :secretariat=>"GB", :stage=>"30", :stage_int=>30, :stageabbr=>"CD", :statusabbr=>"PreCD3", :tc=>"TC 34", :tc_docnumber=>["17301", "17302"], :unpublished=>true, :wg=>"WG 3"}
80
82
  OUTPUT
81
83
  end
82
84
 
@@ -157,7 +159,7 @@ OUTPUT
157
159
  </bibdata>
158
160
  </iso-standard>
159
161
  INPUT
160
- {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)", :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)", :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
162
+ {:agency=>"ISO/IEC", :authors=>[], :authors_affiliations=>{}, :docnumber=>"ISO/IEC/CD 17301-1-3", :docnumber_lang=>"ISO/IEC/CD 17301-1-3 (E)", :docnumber_reference=>"ISO/IEC/CD 17301-1-3 (E)", :docnumeric=>nil, :docsubtitle=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses&nbsp;&mdash; Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai&nbsp;&mdash; Partie&nbsp;1&ndash;3: Riz", :docsubtitleintro=>"C&#xe9;r&#xe9;ales et l&#xe9;gumineuses", :docsubtitlemain=>"Sp&#xe9;cification et m&#xe9;thodes d&#x27;essai", :docsubtitlepart=>"Riz", :docsubtitlepartlabel=>"Partie&nbsp;1&ndash;3", :doctitle=>"Cereals and pulses&nbsp;&mdash; Specifications and test methods&nbsp;&mdash; Part&nbsp;1&ndash;3: Rice", :doctitleintro=>"Cereals and pulses", :doctitlemain=>"Specifications and test methods", :doctitlepart=>"Rice", :doctitlepartlabel=>"Part&nbsp;1&ndash;3", :doctype=>"International Standard", :docyear=>"2016", :draft=>nil, :draftinfo=>"", :edition=>nil, :editorialgroup=>["ABC 34", "DEF 4", "GHI 3"], :ics=>"1.2.3, 1.2.3", :keywords=>[], :obsoletes=>"IEC 8121", :obsoletes_part=>"3.1", :publisher=>"International Organization for Standardization and International Electrotechnical Commission", :revdate=>nil, :revdate_monthyear=>nil, :sc=>"DEF 4", :secretariat=>"XXXX", :stage=>"60", :stage_int=>60, :statusabbr=>"IS", :tc=>"ABC 34", :tc_docnumber=>["17301"], :unpublished=>false, :wg=>"GHI 3"}
161
163
  OUTPUT
162
164
  end
163
165
 
@@ -292,25 +292,25 @@ RSpec.describe IsoDoc do
292
292
  <p class="zzSTDTitle1"></p>
293
293
  <div id="A">
294
294
  <h1 id="toc0">1&#xA0; Clause 4</h1>
295
- <a rel="footnote" href="#fn:3" epub:type="footnote" id="fnref:1">
295
+ <a href="#fn:3" class="FootnoteRef" id="fnref:1">
296
296
  <sup>1)</sup>
297
297
  </a>
298
298
  <div id="N">
299
299
 
300
- <h2 id="toc1">1.1&#xA0; Introduction to this<a rel="footnote" href="#fn:2" epub:type="footnote" id="fnref:2"><sup>2)</sup></a></h2>
300
+ <h2 id="toc1">1.1&#xA0; Introduction to this<a href="#fn:2" class="FootnoteRef" id="fnref:2"><sup>2)</sup></a></h2>
301
301
  </div>
302
302
  <div id="O">
303
303
  <h2 id="toc2">1.2&#xA0; Clause 4.2</h2>
304
- <p>A<a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a></p>
304
+ <p>A<a class="FootnoteRef" href="#fn:2"><sup>2)</sup></a></p>
305
305
  </div>
306
306
  </div>
307
307
  <aside id="fn:3" class="footnote">
308
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:3" epub:type="footnote">
308
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a class="FootnoteRef" href="#fn:3">
309
309
  <sup>1)</sup>
310
310
  </a>This is a footnote.</p>
311
311
  <a href="#fnref:1">&#x21A9;</a></aside>
312
312
  <aside id="fn:2" class="footnote">
313
- <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a rel="footnote" href="#fn:2" epub:type="footnote"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
313
+ <p id="_ff27c067-2785-4551-96cf-0a73530ff1e6"><a href="#fn:2" class="FootnoteRef"><sup>2)</sup></a>Formerly denoted as 15 % (m/m).</p>
314
314
  <a href="#fnref:2">&#x21A9;</a></aside>
315
315
 
316
316
  </main>
@@ -353,7 +353,7 @@ RSpec.describe IsoDoc do
353
353
  Clause 4
354
354
  </h1>
355
355
  <span style='mso-bookmark:_Ref'>
356
- <a href='#_ftn1' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
356
+ <a href='#_ftn1' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn1' name='_ftnref1' title='' id='_ftnref1'>
357
357
  <span class='MsoFootnoteReference'>
358
358
  <span style='mso-special-character:footnote'/>
359
359
  </span>
@@ -367,7 +367,7 @@ RSpec.describe IsoDoc do
367
367
  <span style='mso-tab-count:1'>&#xA0; </span>
368
368
  Introduction to this
369
369
  <span style='mso-bookmark:_Ref'>
370
- <a href='#_ftn2' epub:type='footnote' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
370
+ <a href='#_ftn2' epub:type='footnote' class='FootnoteRef' style='mso-footnote-id:ftn2' name='_ftnref2' title='' id='_ftnref2'>
371
371
  <span class='MsoFootnoteReference'>
372
372
  <span style='mso-special-character:footnote'/>
373
373
  </span>
@@ -386,7 +386,7 @@ RSpec.describe IsoDoc do
386
386
  <p class='MsoNormal'>
387
387
  A
388
388
  <span style='mso-bookmark:_Ref'>
389
- <a href='#_ftn3' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
389
+ <a href='#_ftn3' class='FootnoteRef' epub:type='footnote' style='mso-footnote-id:ftn3' name='_ftnref3' title='' id='_ftnref3'>
390
390
  <span class='MsoFootnoteReference'>
391
391
  <span style='mso-special-character:footnote'/>
392
392
  </span>
@@ -139,7 +139,7 @@ RSpec.describe IsoDoc do
139
139
  <h1>1&#160; Normative references</h1>
140
140
  <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
141
141
  <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
142
- <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a rel="footnote" href="#fn:1" epub:type="footnote"><sup>1</sup></a>, <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
142
+ <p id="ISO16634" class="NormRef">ISO 16634:-- (all parts)<a class="FootnoteRef" href="#fn:1"><sup>1</sup></a>, <i>Cereals, pulses, milled cereal products, oilseeds and animal feeding stuffs</i></p>
143
143
  <p id="ISO20483" class="NormRef">ISO 20483:2013-2014, <i>Cereals and pulses</i></p>
144
144
  <p id="ref1" class="NormRef">ICC 167, <span style="font-variant:small-caps;">Standard No I.C.C 167</span>. <i>Determination of the protein content in cereal and cereal products for food and animal feeding stuffs according to the Dumas combustion method</i> (see <a href="http://www.icc.or.at">http://www.icc.or.at</a>)</p>
145
145
  <div id="" class="Note">
@@ -391,7 +391,7 @@ OUTPUT
391
391
  <h2>1.1&#160; Introduction</h2>
392
392
  </div>
393
393
  <div id="O">
394
- <span class="zzMoveToFollowing"><b>1.2&#160; Clause 4.2 </b></span>
394
+ <span class="zzMoveToFollowing"><b>1.2&#160; Clause 4.2&#160; </b></span>
395
395
  </div>
396
396
  </div>
397
397
  </div>
@@ -458,5 +458,32 @@ OUTPUT
458
458
  OUTPUT
459
459
  end
460
460
 
461
+ it "processes middle title" do
462
+ expect(xmlpp(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
463
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
464
+ <bibdata>
465
+ <title language='en' format='text/plain' type='title-intro'>Introduction</title>
466
+ <title language='en' format='text/plain' type='title-main'>Main Title — Title</title>
467
+ <title language='en' format='text/plain' type='title-part'>Title Part</title>
468
+ <ext>
469
+ <structuredidentifier>
470
+ <project-number part='1' origyr='2016-05-01'>17301</project-number>
471
+ </structuredidentifier>
472
+ </ext>
473
+ </bibdata>
474
+ <sections/>
475
+ </iso-standard>
476
+ INPUT
477
+ #{HTML_HDR}
478
+ <p class='zzSTDTitle1'>Introduction &#8212; Main Title&#8201;&#8212;&#8201;Title &#8212; </p>
479
+ <p class='zzSTDTitle2'>
480
+ Part&#160;1:
481
+ <br/><b>Title Part</b>
482
+ </p>
483
+ </div>
484
+ </body>
485
+ </html>
486
+ OUTPUT
487
+ end
461
488
 
462
489
  end
@@ -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"], [:pdf, "pdf"], [:rxl, "rxl"], [:xml, "xml"]]
18
+ [[:doc, "doc"], [:html, "html"], [:html_alt, "alt.html"], [:pdf, "pdf"], [:rxl, "rxl"], [:sts, "sts.xml"], [:xml, "xml"]]
19
19
  OUTPUT
20
20
  end
21
21
 
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.3.25
4
+ version: 1.3.26
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-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-jing
@@ -44,14 +44,56 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.0
47
+ version: 1.4.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.3.0
54
+ version: 1.4.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: tokenizer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.3.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: twitter_cldr
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: mn2sts
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.2.0
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.2.0
55
97
  - !ruby/object:Gem::Dependency
56
98
  name: byebug
57
99
  requirement: !ruby/object:Gem::Requirement
@@ -232,6 +274,7 @@ files:
232
274
  - lib/asciidoctor/iso/cleanup.rb
233
275
  - lib/asciidoctor/iso/converter.rb
234
276
  - lib/asciidoctor/iso/front.rb
277
+ - lib/asciidoctor/iso/front_id.rb
235
278
  - lib/asciidoctor/iso/i18n-en.yaml
236
279
  - lib/asciidoctor/iso/i18n-fr.yaml
237
280
  - lib/asciidoctor/iso/i18n-zh-Hans.yaml
@@ -261,9 +304,12 @@ files:
261
304
  - lib/isodoc/iso/html/word_iso_titlepage.html
262
305
  - lib/isodoc/iso/html/wordstyle.scss
263
306
  - lib/isodoc/iso/html_convert.rb
307
+ - lib/isodoc/iso/iso.amendment.xsl
264
308
  - lib/isodoc/iso/iso.international-standard.xsl
265
309
  - lib/isodoc/iso/metadata.rb
266
310
  - lib/isodoc/iso/pdf_convert.rb
311
+ - lib/isodoc/iso/sections.rb
312
+ - lib/isodoc/iso/sts_convert.rb
267
313
  - lib/isodoc/iso/word_convert.rb
268
314
  - lib/metanorma-iso.rb
269
315
  - lib/metanorma/iso.rb
@@ -310,6 +356,7 @@ files:
310
356
  - spec/examples/rice_img/rice_image3_1.png
311
357
  - spec/examples/rice_img/rice_image3_2.png
312
358
  - spec/examples/rice_img/rice_image3_3.png
359
+ - spec/isodoc/amd_spec.rb
313
360
  - spec/isodoc/blocks_spec.rb
314
361
  - spec/isodoc/i18n_spec.rb
315
362
  - spec/isodoc/inline_spec.rb