isodoc 1.7.6 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -1
  3. data/lib/isodoc/class_utils.rb +23 -0
  4. data/lib/isodoc/convert.rb +9 -0
  5. data/lib/isodoc/function/cleanup.rb +4 -0
  6. data/lib/isodoc/function/inline.rb +2 -4
  7. data/lib/isodoc/function/utils.rb +1 -1
  8. data/lib/isodoc/html_function/html.rb +1 -0
  9. data/lib/isodoc/html_function/postprocess.rb +4 -6
  10. data/lib/isodoc/metadata_date.rb +13 -11
  11. data/lib/isodoc/presentation_function/bibdata.rb +2 -2
  12. data/lib/isodoc/presentation_function/block.rb +0 -36
  13. data/lib/isodoc/presentation_function/inline.rb +14 -11
  14. data/lib/isodoc/presentation_function/terms.rb +179 -0
  15. data/lib/isodoc/presentation_xml_convert.rb +11 -4
  16. data/lib/isodoc/version.rb +1 -1
  17. data/lib/isodoc/word_function/body.rb +24 -14
  18. data/lib/isodoc/word_function/comments.rb +0 -4
  19. data/lib/isodoc/word_function/postprocess.rb +184 -176
  20. data/lib/isodoc/xref/xref_gen.rb +18 -22
  21. data/lib/isodoc/xref/xref_gen_seq.rb +10 -16
  22. data/lib/isodoc/xref/xref_sect_gen.rb +134 -129
  23. data/lib/isodoc/xslfo_convert.rb +11 -7
  24. data/lib/isodoc-yaml/i18n-ar.yaml +22 -0
  25. data/lib/isodoc-yaml/i18n-de.yaml +20 -0
  26. data/lib/isodoc-yaml/i18n-en.yaml +20 -0
  27. data/lib/isodoc-yaml/i18n-es.yaml +20 -0
  28. data/lib/isodoc-yaml/i18n-fr.yaml +20 -0
  29. data/lib/isodoc-yaml/i18n-ru.yaml +21 -1
  30. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +21 -0
  31. data/lib/metanorma/output/xslfo.rb +4 -11
  32. data/spec/assets/i18n.yaml +3 -1
  33. data/spec/isodoc/blocks_spec.rb +14 -8
  34. data/spec/isodoc/i18n_spec.rb +8 -8
  35. data/spec/isodoc/inline_spec.rb +200 -6
  36. data/spec/isodoc/lists_spec.rb +344 -222
  37. data/spec/isodoc/section_spec.rb +11 -10
  38. data/spec/isodoc/table_spec.rb +71 -73
  39. data/spec/isodoc/terms_spec.rb +354 -34
  40. data/spec/isodoc/xref_numbering_spec.rb +347 -0
  41. data/spec/isodoc/xref_spec.rb +271 -350
  42. data/spec/isodoc/xslfo_convert_spec.rb +34 -9
  43. metadata +7 -6
  44. 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">
@@ -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">
@@ -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">
@@ -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>
@@ -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'>
@@ -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>