isodoc 2.0.8.2 → 2.1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +1 -1
  3. data/isodoc.gemspec +5 -3
  4. data/lib/isodoc/convert.rb +1 -1
  5. data/lib/isodoc/function/blocks.rb +0 -39
  6. data/lib/isodoc/function/blocks_example_note.rb +36 -1
  7. data/lib/isodoc/function/inline.rb +4 -0
  8. data/lib/isodoc/function/references.rb +2 -15
  9. data/lib/isodoc/function/section.rb +5 -0
  10. data/lib/isodoc/function/to_word_html.rb +7 -11
  11. data/lib/isodoc/html_function/postprocess.rb +16 -2
  12. data/lib/isodoc/metadata.rb +2 -1
  13. data/lib/isodoc/presentation_function/bibdata.rb +30 -4
  14. data/lib/isodoc/presentation_function/block.rb +13 -1
  15. data/lib/isodoc/presentation_function/section.rb +36 -0
  16. data/lib/isodoc/presentation_xml_convert.rb +7 -2
  17. data/lib/isodoc/version.rb +1 -1
  18. data/lib/isodoc/word_function/postprocess.rb +3 -4
  19. data/lib/isodoc/word_function/postprocess_cover.rb +14 -0
  20. data/lib/isodoc/word_function/table.rb +12 -10
  21. data/lib/isodoc/xref/xref_anchor.rb +1 -1
  22. data/lib/isodoc/xref/xref_counter.rb +4 -1
  23. data/lib/isodoc/xref/xref_gen_seq.rb +3 -3
  24. data/lib/isodoc/xref/xref_sect_gen.rb +34 -36
  25. data/lib/isodoc/xref.rb +19 -8
  26. data/lib/isodoc-yaml/i18n-ar.yaml +9 -0
  27. data/lib/isodoc-yaml/i18n-de.yaml +13 -0
  28. data/lib/isodoc-yaml/i18n-en.yaml +5 -0
  29. data/lib/isodoc-yaml/i18n-es.yaml +11 -0
  30. data/lib/isodoc-yaml/i18n-fr.yaml +12 -1
  31. data/lib/isodoc-yaml/i18n-ru.yaml +13 -0
  32. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +5 -0
  33. data/lib/relaton/render/config.yml +4 -0
  34. data/lib/relaton/render/general.rb +35 -0
  35. data/spec/assets/i18n.yaml +6 -0
  36. data/spec/isodoc/blocks_spec.rb +249 -61
  37. data/spec/isodoc/i18n_spec.rb +266 -197
  38. data/spec/isodoc/inline_spec.rb +80 -106
  39. data/spec/isodoc/metadata_spec.rb +5 -3
  40. data/spec/isodoc/postproc_spec.rb +539 -397
  41. data/spec/isodoc/ref_spec.rb +52 -98
  42. data/spec/isodoc/section_spec.rb +4 -4
  43. data/spec/isodoc/xref_numbering_spec.rb +31 -0
  44. metadata +30 -22
  45. data/lib/isodoc/base_style/all.css +0 -227
  46. data/lib/isodoc/base_style/blocks.css +0 -0
  47. data/lib/isodoc/base_style/coverpage.css +0 -0
  48. data/lib/isodoc/base_style/defaults.css +0 -0
  49. data/lib/isodoc/base_style/metanorma_word.css +0 -47
  50. data/lib/isodoc/base_style/nav.css +0 -0
  51. data/lib/isodoc/base_style/reset.css +0 -125
  52. data/lib/isodoc/base_style/typography.css +0 -0
@@ -55,47 +55,68 @@ RSpec.describe IsoDoc do
55
55
  <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
56
56
  <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
57
57
  <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
58
+ <span class="A"><em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt> F</span>
58
59
  </p>
59
60
  </foreword></preface>
60
61
  <sections>
61
62
  </iso-standard>
62
63
  INPUT
63
64
  html = <<~OUTPUT
64
- <div>
65
- <h1 class="ForewordTitle">Foreword</h1>
66
- <p>
67
- <i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
68
- <s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
69
- <a id="H"/> <br/> <br/>
70
- <span style='text-decoration: underline;'>J</span>
71
- </p>
72
- </div>
65
+ <div><h1 class='ForewordTitle'>Foreword</h1>
66
+ <p>
67
+ <i>A</i>
68
+ <b>B</b>
69
+ <sup>C</sup>
70
+ <sub>D</sub>
71
+ <tt>E</tt>
72
+ <s>F</s>
73
+ <span style='font-variant:small-caps;'>G</span>
74
+ <span class='keyword'>I</span>
75
+ <br/>
76
+ <hr/>
77
+ <a id='H'/>
78
+ <br/>
79
+ <br/>
80
+ <span style='text-decoration: underline;'>J</span>
81
+ <i>A</i>
82
+ <b>B</b>
83
+ <sup>C</sup>
84
+ <sub>D</sub>
85
+ <tt>E</tt>
86
+ F
87
+ </p>
88
+ </div>
73
89
  OUTPUT
74
90
 
75
91
  doc = <<~OUTPUT
76
- <div>
77
- <h1 class='ForewordTitle'>Foreword</h1>
78
- <p>
79
- <i>A</i>
80
- <b>B</b>
81
- <sup>C</sup>
82
- <sub>D</sub>
83
- <tt>E</tt>
84
- <s>F</s>
85
- <span style='font-variant:small-caps;'>G</span>
86
- <span class='keyword'>I</span>
87
- <br/>
88
- <hr/>
89
- <a id='H'/>
90
- <p>
91
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
92
- </p>
92
+ <div><h1 class='ForewordTitle'>Foreword</h1>
93
93
  <p>
94
- <br clear='all' class='section' orientation='landscape'/>
94
+ <i>A</i>
95
+ <b>B</b>
96
+ <sup>C</sup>
97
+ <sub>D</sub>
98
+ <tt>E</tt>
99
+ <s>F</s>
100
+ <span style='font-variant:small-caps;'>G</span>
101
+ <span class='keyword'>I</span>
102
+ <br/>
103
+ <hr/>
104
+ <a id='H'/>
105
+ <p>
106
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
107
+ </p>
108
+ <p>
109
+ <br clear='all' class='section' orientation='landscape'/>
110
+ </p>
111
+ <u>J</u>
112
+ <i>A</i>
113
+ <b>B</b>
114
+ <sup>C</sup>
115
+ <sub>D</sub>
116
+ <tt>E</tt>
117
+ F
95
118
  </p>
96
- <u>J</u>
97
- </p>
98
- </div>
119
+ </div>
99
120
  OUTPUT
100
121
  expect(xmlpp(IsoDoc::HtmlConvert.new({})
101
122
  .convert("test", input, true))
@@ -304,15 +325,8 @@ RSpec.describe IsoDoc do
304
325
  <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1.<tab/>Normative References</title>
305
326
  <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>
306
327
  <bibitem id="ISO712" type="standard">
307
- <title format="text/plain">Cereals or cereal products</title>
308
- <title type="main" format="text/plain">Cereals and cereal products</title>
328
+ <formattedref>International Organization for Standardization. <em>Cereals and cereal products</em>.</formattedref>
309
329
  <docidentifier type="ISO">ISO 712</docidentifier>
310
- <contributor>
311
- <role type="publisher"/>
312
- <organization>
313
- <name>International Organization for Standardization</name>
314
- </organization>
315
- </contributor>
316
330
  </bibitem>
317
331
  </references></bibliography>
318
332
  </iso-standard>
@@ -394,8 +408,8 @@ RSpec.describe IsoDoc do
394
408
  (including any amendments) applies.
395
409
  </p>
396
410
  <p id='ISO712' class='NormRef'>
397
- ISO 712,
398
- <i>Cereals and cereal products</i>
411
+ ISO 712, International Organization for Standardization.
412
+ <i>Cereals and cereal products</i>.
399
413
  </p>
400
414
  </div>
401
415
  <div id='clause1'>
@@ -1033,7 +1047,7 @@ RSpec.describe IsoDoc do
1033
1047
  </foreword></preface>
1034
1048
  <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
1035
1049
  <bibitem id="ISO712" type="standard">
1036
- <title format="text/plain">Cereals and cereal products</title>
1050
+ <formattedref format="text/plain"><em>Cereals and cereal products</em></formattedref>
1037
1051
  <docidentifier>ISO 712</docidentifier>
1038
1052
  <contributor>
1039
1053
  <role type="publisher"/>
@@ -1141,14 +1155,8 @@ RSpec.describe IsoDoc do
1141
1155
  <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
1142
1156
  "2"><title depth='1'>1.<tab/>Normative References</title>
1143
1157
  <bibitem id="ISO712" type="standard">
1144
- <title format="text/plain">Cereals and cereal products</title>
1158
+ <formattedref><em>Cereals and cereal products</em>.</formattedref>
1145
1159
  <docidentifier>ISO 712</docidentifier>
1146
- <contributor>
1147
- <role type="publisher"/>
1148
- <organization>
1149
- <abbreviation>ISO</abbreviation>
1150
- </organization>
1151
- </contributor>
1152
1160
  </bibitem>
1153
1161
  </references>
1154
1162
  </bibliography>
@@ -1184,7 +1192,7 @@ RSpec.describe IsoDoc do
1184
1192
  <p class="zzSTDTitle1"/>
1185
1193
  <div>
1186
1194
  <h1>1.&#160; Normative References</h1>
1187
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
1195
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i>.</p>
1188
1196
  </div>
1189
1197
  </div>
1190
1198
  </body>
@@ -1298,37 +1306,19 @@ RSpec.describe IsoDoc do
1298
1306
  <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
1299
1307
  <title depth='1'>1.<tab/>Normative References</title>
1300
1308
  <bibitem id='ISO712' type='standard'>
1301
- <title format='text/plain'>Cereals and cereal products</title>
1309
+ <formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
1302
1310
  <uri type='citation'>http://www.example.com</uri>
1303
1311
  <docidentifier>ISO 712</docidentifier>
1304
- <contributor>
1305
- <role type='publisher'/>
1306
- <organization>
1307
- <abbreviation>ISO</abbreviation>
1308
- </organization>
1309
- </contributor>
1310
1312
  </bibitem>
1311
1313
  <bibitem id='ISO713' type='standard'>
1312
- <title format='text/plain'>Cereals and cereal products</title>
1314
+ <formattedref><em>Cereals and cereal products</em>. <link target="spec/assets/iso713">spec/assets/iso713</link>.</formattedref>
1313
1315
  <uri type='citation'>spec/assets/iso713</uri>
1314
1316
  <docidentifier>ISO 713</docidentifier>
1315
- <contributor>
1316
- <role type='publisher'/>
1317
- <organization>
1318
- <abbreviation>ISO</abbreviation>
1319
- </organization>
1320
- </contributor>
1321
1317
  </bibitem>
1322
- <bibitem id='ISO714' type='standard'>
1323
- <title format='text/plain'>Cereals and cereal products</title>
1318
+ <bibitem id='ISO714' type='standard'>
1319
+ <formattedref><em>Cereals and cereal products</em>. <link target="spec/assets/iso714.svg">spec/assets/iso714.svg</link>.</formattedref>
1324
1320
  <uri type='citation'>spec/assets/iso714.svg</uri>
1325
1321
  <docidentifier>ISO 714</docidentifier>
1326
- <contributor>
1327
- <role type='publisher'/>
1328
- <organization>
1329
- <abbreviation>ISO</abbreviation>
1330
- </organization>
1331
- </contributor>
1332
1322
  </bibitem>
1333
1323
  </references>
1334
1324
  </bibliography>
@@ -1364,15 +1354,18 @@ RSpec.describe IsoDoc do
1364
1354
  <h1>1.&#160; Normative References</h1>
1365
1355
  <p id='ISO712' class='NormRef'>
1366
1356
  ISO 712,
1367
- <i>Cereals and cereal products</i>
1357
+ <i>Cereals and cereal products</i>.
1358
+ <a href='http://www.example.com'>http://www.example.com</a>.
1368
1359
  </p>
1369
1360
  <p id='ISO713' class='NormRef'>
1370
1361
  ISO 713,
1371
- <i>Cereals and cereal products</i>
1362
+ <i>Cereals and cereal products</i>.
1363
+ <a href='spec/assets/iso713'>spec/assets/iso713</a>.
1372
1364
  </p>
1373
1365
  <p id='ISO714' class='NormRef'>
1374
1366
  ISO 714,
1375
- <i>Cereals and cereal products</i>
1367
+ <i>Cereals and cereal products</i>.
1368
+ <a href='spec/assets/iso714.svg'>spec/assets/iso714.svg</a>.
1376
1369
  </p>
1377
1370
  </div>
1378
1371
  </div>
@@ -1433,15 +1426,18 @@ RSpec.describe IsoDoc do
1433
1426
  </h1>
1434
1427
  <p id='ISO712' class='NormRef'>
1435
1428
  ISO 712,
1436
- <i>Cereals and cereal products</i>
1429
+ <i>Cereals and cereal products</i>.
1430
+ <a href='http://www.example.com'>http://www.example.com</a>.
1437
1431
  </p>
1438
1432
  <p id='ISO713' class='NormRef'>
1439
1433
  ISO 713,
1440
- <i>Cereals and cereal products</i>
1434
+ <i>Cereals and cereal products</i>.
1435
+ <a href='spec/assets/iso713'>spec/assets/iso713</a>.
1441
1436
  </p>
1442
1437
  <p id='ISO714' class='NormRef'>
1443
1438
  ISO 714,
1444
- <i>Cereals and cereal products</i>
1439
+ <i>Cereals and cereal products</i>.
1440
+ <a href='spec/assets/iso714.svg'>spec/assets/iso714.svg</a>.
1445
1441
  </p>
1446
1442
  </div>
1447
1443
  </div>
@@ -1602,33 +1598,17 @@ RSpec.describe IsoDoc do
1602
1598
  </preface>
1603
1599
  <bibliography>
1604
1600
  <references id='_normative_references' obligation='informative' normative='true' displayorder='2' hidden="true">
1605
- <title depth='1'>
1606
- 0.
1607
- <tab/>
1608
- Normative References
1609
- </title>
1601
+ <title depth='1'>Normative References</title>
1610
1602
  <bibitem id='ISO712' type='standard' hidden="true">
1611
- <title format='text/plain'>Cereals and cereal products</title>
1603
+ <formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
1612
1604
  <uri type='citation'>http://www.example.com</uri>
1613
1605
  <docidentifier>ISO 712</docidentifier>
1614
- <contributor>
1615
- <role type='publisher'/>
1616
- <organization>
1617
- <abbreviation>ISO</abbreviation>
1618
- </organization>
1619
- </contributor>
1620
1606
  </bibitem>
1621
1607
  <bibitem id='ISO713' type='standard' hidden="true">
1622
- <title format='text/plain'>Cereals and cereal products</title>
1623
- <uri type='src'>https://www.iso.org/standard/3944.html</uri>
1624
- <uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
1608
+ <formattedref><em>Cereals and cereal products</em>. <link target="https://www.iso.org/standard/3944.html">https://www.iso.org/standard/3944.html</link>.</formattedref>
1609
+ <uri type='src'>https://www.iso.org/standard/3944.html</uri>
1610
+ <uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
1625
1611
  <docidentifier>ISO 713</docidentifier>
1626
- <contributor>
1627
- <role type='publisher'/>
1628
- <organization>
1629
- <abbreviation>ISO</abbreviation>
1630
- </organization>
1631
- </contributor>
1632
1612
  </bibitem>
1633
1613
  </references>
1634
1614
  </bibliography>
@@ -1756,15 +1736,9 @@ RSpec.describe IsoDoc do
1756
1736
  Normative References
1757
1737
  </title>
1758
1738
  <bibitem id='ISO712' type='standard'>
1759
- <title format='text/plain'>Cereals and cereal products</title>
1760
- <uri type='citation'>http://www.example.com</uri>
1739
+ <formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
1740
+ <uri type='citation'>http://www.example.com</uri>
1761
1741
  <docidentifier>ISO 712</docidentifier>
1762
- <contributor>
1763
- <role type='publisher'/>
1764
- <organization>
1765
- <abbreviation>ISO</abbreviation>
1766
- </organization>
1767
- </contributor>
1768
1742
  </bibitem>
1769
1743
  </references>
1770
1744
  </bibliography>
@@ -2,7 +2,7 @@ require "spec_helper"
2
2
  require "nokogiri"
3
3
 
4
4
  RSpec.describe IsoDoc do
5
- it "processes IsoXML metadata" do
5
+ it "processes IsoXML metadata #1" do
6
6
  c = IsoDoc::Convert.new({})
7
7
  c.convert_init(<<~"INPUT", "test", false)
8
8
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -34,7 +34,7 @@ RSpec.describe IsoDoc do
34
34
  <date type="transmitted"><on>2020</on></date>
35
35
  <date type="vote-started"><on>2021</on></date>
36
36
  <date type="vote-ended"><on>2022</on></date>
37
- <edition>2</edition>
37
+ <edition>2</edition><edition language="en">second edition</edition>
38
38
  <version>
39
39
  <revision-date>2016-05-01</revision-date>
40
40
  <draft>0.4</draft>
@@ -124,6 +124,7 @@ RSpec.describe IsoDoc do
124
124
  :draft=>"0.4",
125
125
  :draftinfo=>" (draft 0.4, 2016-05-01)",
126
126
  :edition=>"2",
127
+ :edition_display=>"second edition",
127
128
  :html=>"URL B",
128
129
  :implementeddate=>"XXX",
129
130
  :isbn=>"ISBN 13",
@@ -158,7 +159,7 @@ RSpec.describe IsoDoc do
158
159
  .to be_equivalent_to output
159
160
  end
160
161
 
161
- it "processes IsoXML metadata" do
162
+ it "processes IsoXML metadata #2" do
162
163
  c = IsoDoc::Convert.new({})
163
164
  c.convert_init(<<~"INPUT", "test", false)
164
165
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -295,6 +296,7 @@ RSpec.describe IsoDoc do
295
296
  <substage lang="fr">Rétiré</substage>
296
297
  <iteration>2</iteration>
297
298
  </status>
299
+ <edition>2</edition>
298
300
  <ext>
299
301
  <doctype lang="">international-standard</doctype>
300
302
  <doctype lang="fr">Standard international</doctype>