isodoc 1.7.7 → 1.8.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +2 -2
  3. data/lib/isodoc/class_utils.rb +1 -1
  4. data/lib/isodoc/convert.rb +8 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/inline.rb +3 -5
  7. data/lib/isodoc/html_function/html.rb +1 -0
  8. data/lib/isodoc/html_function/postprocess.rb +4 -6
  9. data/lib/isodoc/metadata_date.rb +13 -11
  10. data/lib/isodoc/presentation_function/bibdata.rb +2 -2
  11. data/lib/isodoc/presentation_function/block.rb +0 -36
  12. data/lib/isodoc/presentation_function/inline.rb +2 -3
  13. data/lib/isodoc/presentation_function/terms.rb +223 -0
  14. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  15. data/lib/isodoc/version.rb +1 -1
  16. data/lib/isodoc/word_function/body.rb +24 -14
  17. data/lib/isodoc/word_function/comments.rb +0 -4
  18. data/lib/isodoc/word_function/postprocess.rb +184 -176
  19. data/lib/isodoc/xref/xref_gen.rb +18 -22
  20. data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
  21. data/lib/isodoc/xslfo_convert.rb +9 -6
  22. data/lib/isodoc-yaml/i18n-ar.yaml +25 -0
  23. data/lib/isodoc-yaml/i18n-de.yaml +23 -0
  24. data/lib/isodoc-yaml/i18n-en.yaml +23 -0
  25. data/lib/isodoc-yaml/i18n-es.yaml +23 -0
  26. data/lib/isodoc-yaml/i18n-fr.yaml +23 -0
  27. data/lib/isodoc-yaml/i18n-ru.yaml +24 -1
  28. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +24 -0
  29. data/lib/metanorma/output/xslfo.rb +4 -11
  30. data/spec/isodoc/blocks_spec.rb +14 -8
  31. data/spec/isodoc/i18n_spec.rb +20 -15
  32. data/spec/isodoc/inline_spec.rb +71 -3
  33. data/spec/isodoc/lists_spec.rb +344 -222
  34. data/spec/isodoc/section_spec.rb +23 -22
  35. data/spec/isodoc/table_spec.rb +71 -73
  36. data/spec/isodoc/terms_spec.rb +498 -124
  37. data/spec/isodoc/xref_numbering_spec.rb +347 -0
  38. data/spec/isodoc/xref_spec.rb +274 -353
  39. data/spec/isodoc/xslfo_convert_spec.rb +20 -7
  40. metadata +12 -11
  41. data/lib/isodoc/presentation_function/concept.rb +0 -68
@@ -209,7 +209,7 @@ RSpec.describe IsoDoc do
209
209
  <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
210
210
  <title>Normal Terms</title>
211
211
  <term id="J">
212
- <preferred>Term2</preferred>
212
+ <preferred><expression><name>Term2</name></expression></preferred>
213
213
  </term>
214
214
  </terms>
215
215
  <definitions id="K">
@@ -328,7 +328,7 @@ RSpec.describe IsoDoc do
328
328
  <title depth='2'>3.1.<tab/>Normal Terms</title>
329
329
  <term id='J'>
330
330
  <name>3.1.1.</name>
331
- <preferred>Term2</preferred>
331
+ <preferred><strong>Term2</strong></preferred>
332
332
  </term>
333
333
  </terms>
334
334
  <definitions id='K'>
@@ -473,7 +473,7 @@ RSpec.describe IsoDoc do
473
473
  <div id="I">
474
474
  <h2>3.1.&#160; Normal Terms</h2>
475
475
  <p class="TermNum" id="J">3.1.1.</p>
476
- <p class="Terms" style="text-align:left;">Term2</p>
476
+ <p class="Terms" style="text-align:left;"><b>Term2</b></p>
477
477
  </div><div id="K"><h2>3.2.&#160; Definitions</h2>
478
478
  <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
479
479
  </div></div>
@@ -628,7 +628,7 @@ RSpec.describe IsoDoc do
628
628
 
629
629
  <p class="TermNum" id="J">3.1.1.</p>
630
630
 
631
- <p class="Terms" style="text-align:left;">Term2</p>
631
+ <p class="Terms" style="text-align:left;"><b>Term2</b></p>
632
632
 
633
633
  </div>
634
634
  <div id="K"><h2>3.2.<span style="mso-tab-count:1">&#160; </span>Definitions</h2>
@@ -745,7 +745,7 @@ RSpec.describe IsoDoc do
745
745
  <title>Normal Terms</title>
746
746
  <variant-title type="sub">Variant 1</variant-title>
747
747
  <term id="J">
748
- <preferred>Term2</preferred>
748
+ <preferred><expression><name>Term2</name></expression></preferred>
749
749
  </term>
750
750
  </terms>
751
751
  <definitions id="K">
@@ -925,7 +925,7 @@ RSpec.describe IsoDoc do
925
925
  Variant 1
926
926
  </h2>
927
927
  <p class='TermNum' id='J'>3.1.1.</p>
928
- <p class='Terms' style='text-align:left;'>Term2</p>
928
+ <p class='Terms' style='text-align:left;'><b>Term2</b></p>
929
929
  </div>
930
930
  <div id='K'>
931
931
  <h2>
@@ -1187,7 +1187,7 @@ RSpec.describe IsoDoc do
1187
1187
  Variant 1
1188
1188
  </h2>
1189
1189
  <p class='TermNum' id='J'>3.1.1.</p>
1190
- <p class='Terms' style='text-align:left;'>Term2</p>
1190
+ <p class='Terms' style='text-align:left;'><b>Term2</b></p>
1191
1191
  </div>
1192
1192
  <div id='K'>
1193
1193
  <h2>
@@ -1361,7 +1361,7 @@ RSpec.describe IsoDoc do
1361
1361
  <clause id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
1362
1362
  <title>Normal Terms</title>
1363
1363
  <term id="J">
1364
- <preferred>Term2</preferred>
1364
+ <preferred><expression><name>Term2</name></expression></preferred>
1365
1365
  </term>
1366
1366
  </terms>
1367
1367
  <definitions id="K">
@@ -1431,7 +1431,7 @@ RSpec.describe IsoDoc do
1431
1431
  <title depth='2'>Normal Terms</title>
1432
1432
  <term id='J'>
1433
1433
  <name>3.1.1.</name>
1434
- <preferred>Term2</preferred>
1434
+ <preferred><strong>Term2</strong></preferred>
1435
1435
  </term>
1436
1436
  </terms>
1437
1437
  <definitions id='K'>
@@ -1515,8 +1515,9 @@ RSpec.describe IsoDoc do
1515
1515
  </preface>
1516
1516
  </iso-standard>
1517
1517
  OUTPUT
1518
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({ suppressheadingnumbers: true })
1519
- .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1518
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1519
+ .new({ suppressheadingnumbers: true })
1520
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1520
1521
  end
1521
1522
 
1522
1523
  it "processes simple terms & definitions" do
@@ -1525,7 +1526,7 @@ RSpec.describe IsoDoc do
1525
1526
  <sections>
1526
1527
  <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
1527
1528
  <term id="J">
1528
- <preferred>Term2</preferred>
1529
+ <preferred><expression><name>Term2</name></expression></preferred>
1529
1530
  </term>
1530
1531
  </terms>
1531
1532
  </sections>
@@ -1539,7 +1540,7 @@ RSpec.describe IsoDoc do
1539
1540
  <title depth='1'>1.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
1540
1541
  <term id='J'>
1541
1542
  <name>1.1.</name>
1542
- <preferred>Term2</preferred>
1543
+ <preferred><strong>Term2</strong></preferred>
1543
1544
  </term>
1544
1545
  </terms>
1545
1546
  </sections>
@@ -1551,7 +1552,7 @@ RSpec.describe IsoDoc do
1551
1552
  <p class="zzSTDTitle1"/>
1552
1553
  <div id="H"><h1>1.&#160; Terms, Definitions, Symbols and Abbreviated Terms</h1>
1553
1554
  <p class="TermNum" id="J">1.1.</p>
1554
- <p class="Terms" style="text-align:left;">Term2</p>
1555
+ <p class="Terms" style="text-align:left;"><b>Term2</b></p>
1555
1556
  </div>
1556
1557
  </div>
1557
1558
  </body>
@@ -1786,7 +1787,7 @@ RSpec.describe IsoDoc do
1786
1787
  <title>Glossary</title>
1787
1788
  <terms id='PP1' obligation='normative'>
1788
1789
  <term id='term-glossary'>
1789
- <preferred>Glossary</preferred>
1790
+ <preferred><expression><name>Glossary</name></expression></preferred>
1790
1791
  </term>
1791
1792
  </terms>
1792
1793
  </annex>
@@ -1795,13 +1796,13 @@ RSpec.describe IsoDoc do
1795
1796
  <terms id='QQ1' obligation='normative'>
1796
1797
  <title>Term Collection</title>
1797
1798
  <term id='term-term-1'>
1798
- <preferred>Term</preferred>
1799
+ <preferred><expression><name>Term</name></expression></preferred>
1799
1800
  </term>
1800
1801
  </terms>
1801
1802
  <terms id='QQ2' obligation='normative'>
1802
1803
  <title>Term Collection 2</title>
1803
1804
  <term id='term-term-2'>
1804
- <preferred>Term</preferred>
1805
+ <preferred><expression><name>Term</name></expression></preferred>
1805
1806
  </term>
1806
1807
  </terms>
1807
1808
  </annex>
@@ -1810,7 +1811,7 @@ RSpec.describe IsoDoc do
1810
1811
  <terms id='RR1' obligation='normative'>
1811
1812
  <title>Term Collection</title>
1812
1813
  <term id='term-term-3'>
1813
- <preferred>Term</preferred>
1814
+ <preferred><expression><name>Term</name></expression></preferred>
1814
1815
  </term>
1815
1816
  </terms>
1816
1817
  <references id='RR2' obligation='normative'>
@@ -1834,7 +1835,7 @@ RSpec.describe IsoDoc do
1834
1835
  <title>A.</title>
1835
1836
  <term id='term-glossary'>
1836
1837
  <name>A.1.</name>
1837
- <preferred>Glossary</preferred>
1838
+ <preferred><strong>Glossary</strong></preferred>
1838
1839
  </term>
1839
1840
  </terms>
1840
1841
  </annex>
@@ -1855,7 +1856,7 @@ RSpec.describe IsoDoc do
1855
1856
  </title>
1856
1857
  <term id='term-term-1'>
1857
1858
  <name>B.1.1.</name>
1858
- <preferred>Term</preferred>
1859
+ <preferred><strong>Term</strong></preferred>
1859
1860
  </term>
1860
1861
  </terms>
1861
1862
  <terms id='QQ2' obligation='normative'>
@@ -1866,7 +1867,7 @@ RSpec.describe IsoDoc do
1866
1867
  </title>
1867
1868
  <term id='term-term-2'>
1868
1869
  <name>B.2.1.</name>
1869
- <preferred>Term</preferred>
1870
+ <preferred><strong>Term</strong></preferred>
1870
1871
  </term>
1871
1872
  </terms>
1872
1873
  </annex>
@@ -1887,7 +1888,7 @@ RSpec.describe IsoDoc do
1887
1888
  </title>
1888
1889
  <term id='term-term-3'>
1889
1890
  <name>C.1.1.</name>
1890
- <preferred>Term</preferred>
1891
+ <preferred><strong>Term</strong></preferred>
1891
1892
  </term>
1892
1893
  </terms>
1893
1894
  <references id='RR2' obligation='normative'>
@@ -3,71 +3,71 @@ require "spec_helper"
3
3
  RSpec.describe IsoDoc do
4
4
  it "processes IsoXML tables" do
5
5
  input = <<~INPUT
6
- <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <preface>
8
- <foreword>
9
- <table id="tableD-1" alt="tool tip" summary="long desc" width="70%" keep-with-next="true" keep-lines-together="true">
10
- <name>Repeatability and reproducibility of <em>husked</em> rice yield<fn reference="1"><p>X</p></fn></name>
11
- <colgroup>
12
- <col width="30%"/>
13
- <col width="20%"/>
14
- <col width="20%"/>
15
- <col width="20%"/>
16
- <col width="10%"/>
17
- </colgroup>
18
- <thead>
19
- <tr>
20
- <td rowspan="2" align="left">Description</td>
21
- <td colspan="4" align="center">Rice sample</td>
22
- </tr>
23
- <tr>
24
- <td valign="top" align="left">Arborio</td>
25
- <td valign="middle" align="center">Drago<fn reference="a">
26
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
27
- </fn></td>
28
- <td valign="bottom" align="center">Balilla<fn reference="a">
29
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
30
- </fn></td>
31
- <td align="center">Thaibonnet</td>
32
- </tr>
33
- </thead>
34
- <tbody>
35
- <tr>
36
- <th align="left">Number of laboratories retained after eliminating outliers</th>
37
- <td align="center">13</td>
38
- <td align="center">11</td>
39
- <td align="center">13</td>
40
- <td align="center">13</td>
41
- </tr>
42
- <tr>
43
- <td align="left">Mean value, g/100 g</td>
44
- <td align="center">81,2</td>
45
- <td align="center">82,0</td>
46
- <td align="center">81,8</td>
47
- <td align="center">77,7</td>
48
- </tr>
49
- </tbody>
50
- <tfoot>
51
- <tr>
52
- <td align="left">Reproducibility limit, <stem type="AsciiMath">R</stem> (= 2,83 <stem type="AsciiMath">s_R</stem>)</td>
53
- <td align="center">2,89</td>
54
- <td align="center">0,57</td>
55
- <td align="center">2,26</td>
56
- <td align="center">6,06</td>
57
- </tr>
58
- </tfoot>
59
- <dl>
60
- <dt>Drago</dt>
61
- <dd>A type of rice</dd>
62
- </dl>
63
- <note><p>This is a table about rice</p></note>
64
- </table>
65
- <table id="tableD-2" unnumbered="true">
66
- <tbody><tr><td>A</td></tr></tbody>
67
- </table>
68
- </foreword>
69
- </preface>
70
- </iso-standard>
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <foreword>
9
+ <table id="tableD-1" alt="tool tip" summary="long desc" width="70%" keep-with-next="true" keep-lines-together="true">
10
+ <name>Repeatability and reproducibility of <em>husked</em> rice yield<fn reference="1"><p>X</p></fn></name>
11
+ <colgroup>
12
+ <col width="30%"/>
13
+ <col width="20%"/>
14
+ <col width="20%"/>
15
+ <col width="20%"/>
16
+ <col width="10%"/>
17
+ </colgroup>
18
+ <thead>
19
+ <tr>
20
+ <td rowspan="2" align="left">Description</td>
21
+ <td colspan="4" align="center">Rice sample</td>
22
+ </tr>
23
+ <tr>
24
+ <td valign="top" align="left">Arborio</td>
25
+ <td valign="middle" align="center">Drago<fn reference="a">
26
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
27
+ </fn></td>
28
+ <td valign="bottom" align="center">Balilla<fn reference="a">
29
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
30
+ </fn></td>
31
+ <td align="center">Thaibonnet</td>
32
+ </tr>
33
+ </thead>
34
+ <tbody>
35
+ <tr>
36
+ <th align="left">Number of laboratories retained after eliminating outliers</th>
37
+ <td align="center">13</td>
38
+ <td align="center">11</td>
39
+ <td align="center">13</td>
40
+ <td align="center">13</td>
41
+ </tr>
42
+ <tr>
43
+ <td align="left">Mean value, g/100 g</td>
44
+ <td align="center">81,2</td>
45
+ <td align="center">82,0</td>
46
+ <td align="center">81,8</td>
47
+ <td align="center">77,7</td>
48
+ </tr>
49
+ </tbody>
50
+ <tfoot>
51
+ <tr>
52
+ <td align="left">Reproducibility limit, <stem type="AsciiMath">R</stem> (= 2,83 <stem type="AsciiMath">s_R</stem>)</td>
53
+ <td align="center">2,89</td>
54
+ <td align="center">0,57</td>
55
+ <td align="center">2,26</td>
56
+ <td align="center">6,06</td>
57
+ </tr>
58
+ </tfoot>
59
+ <dl>
60
+ <dt>Drago</dt>
61
+ <dd>A type of rice</dd>
62
+ </dl>
63
+ <note><p>This is a table about rice</p></note>
64
+ </table>
65
+ <table id="tableD-2" unnumbered="true">
66
+ <tbody><tr><td>A</td></tr></tbody>
67
+ </table>
68
+ </foreword>
69
+ </preface>
70
+ </iso-standard>
71
71
  INPUT
72
72
 
73
73
  presxml = <<~OUTPUT
@@ -344,14 +344,12 @@ RSpec.describe IsoDoc do
344
344
  <td align='center' style='border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;'>6,06</td>
345
345
  </tr>
346
346
  </tfoot>
347
- <table class='dl'>
348
- <tr>
349
- <td valign='top' align='left'>
350
- <p align='left' style='margin-left:0pt;text-align:left;'>Drago</p>
351
- </td>
352
- <td valign='top'>A type of rice</td>
353
- </tr>
354
- </table>
347
+ <dl>
348
+ <dt>
349
+ <p align='left' style='margin-left:0pt;text-align:left;'>Drago</p>
350
+ </dt>
351
+ <dd>A type of rice</dd>
352
+ </dl>
355
353
  <div class='Note'>
356
354
  <p class='Note'>
357
355
  <span class='note_label'>NOTE</span>