metanorma-iso 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/iso/html/header-dis.html +111 -29
  3. data/lib/isodoc/iso/html/isodoc-dis.css +65 -64
  4. data/lib/isodoc/iso/html/isodoc-dis.scss +65 -64
  5. data/lib/isodoc/iso/html/style-human.css +1 -2
  6. data/lib/isodoc/iso/html/style-human.scss +0 -1
  7. data/lib/isodoc/iso/html/style-iso.css +1 -2
  8. data/lib/isodoc/iso/html/style-iso.scss +0 -1
  9. data/lib/isodoc/iso/html/wordstyle-dis.css +10 -4
  10. data/lib/isodoc/iso/html/wordstyle-dis.scss +10 -4
  11. data/lib/isodoc/iso/i18n-en.yaml +4 -4
  12. data/lib/isodoc/iso/iso.amendment.xsl +205 -37
  13. data/lib/isodoc/iso/iso.international-standard.xsl +205 -37
  14. data/lib/isodoc/iso/presentation_bibdata.rb +13 -9
  15. data/lib/isodoc/iso/presentation_xml_convert.rb +5 -3
  16. data/lib/isodoc/iso/word_convert.rb +6 -4
  17. data/lib/isodoc/iso/word_dis_cleanup.rb +24 -3
  18. data/lib/isodoc/iso/word_dis_convert.rb +4 -1
  19. data/lib/metanorma/iso/base.rb +2 -1
  20. data/lib/metanorma/iso/biblio.rng +5 -0
  21. data/lib/metanorma/iso/isodoc.rng +46 -12
  22. data/lib/metanorma/iso/version.rb +1 -1
  23. data/metanorma-iso.gemspec +5 -2
  24. metadata +4 -87
  25. data/.github/workflows/automerge.yml +0 -31
  26. data/.github/workflows/rake.yml +0 -15
  27. data/.github/workflows/release.yml +0 -24
  28. data/.github/workflows/ubuntu.yml +0 -41
  29. data/Rakefile +0 -8
  30. data/bin/rspec +0 -17
  31. data/spec/assets/header.html +0 -7
  32. data/spec/assets/html.css +0 -2
  33. data/spec/assets/htmlcover.html +0 -4
  34. data/spec/assets/htmlintro.html +0 -5
  35. data/spec/assets/i18n.yaml +0 -2
  36. data/spec/assets/iso.adoc +0 -10
  37. data/spec/assets/iso.headless.html +0 -33
  38. data/spec/assets/iso.xml +0 -71
  39. data/spec/assets/rice_image1.png +0 -0
  40. data/spec/assets/scripts.html +0 -3
  41. data/spec/assets/std.css +0 -2
  42. data/spec/assets/word.css +0 -2
  43. data/spec/assets/wordcover.html +0 -3
  44. data/spec/assets/wordintro.html +0 -4
  45. data/spec/examples/103_01_02.html +0 -247
  46. data/spec/examples/english.yaml +0 -69
  47. data/spec/examples/iso_123_.xml +0 -45
  48. data/spec/examples/iso_123_all_parts.xml +0 -45
  49. data/spec/examples/iso_123_no_year_note.xml +0 -46
  50. data/spec/examples/iso_124_.xml +0 -41
  51. data/spec/examples/iso_216_.xml +0 -47
  52. data/spec/examples/iso_iec_12382_.xml +0 -48
  53. data/spec/examples/rice.adoc +0 -714
  54. data/spec/examples/rice.preview.html +0 -1870
  55. data/spec/examples/rice.sh +0 -4
  56. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  57. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  58. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  59. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  60. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  61. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  62. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  63. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  64. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  65. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  66. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  67. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  68. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  69. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  70. data/spec/examples/rice_img/rice_image1.png +0 -0
  71. data/spec/examples/rice_img/rice_image2.png +0 -0
  72. data/spec/examples/rice_img/rice_image3_1.png +0 -0
  73. data/spec/examples/rice_img/rice_image3_2.png +0 -0
  74. data/spec/examples/rice_img/rice_image3_3.png +0 -0
  75. data/spec/isodoc/amd_spec.rb +0 -986
  76. data/spec/isodoc/blocks_spec.rb +0 -1174
  77. data/spec/isodoc/i18n_spec.rb +0 -1579
  78. data/spec/isodoc/inline_spec.rb +0 -1060
  79. data/spec/isodoc/iso_spec.rb +0 -255
  80. data/spec/isodoc/metadata_spec.rb +0 -701
  81. data/spec/isodoc/postproc_spec.rb +0 -1089
  82. data/spec/isodoc/ref_spec.rb +0 -439
  83. data/spec/isodoc/section_spec.rb +0 -998
  84. data/spec/isodoc/table_spec.rb +0 -420
  85. data/spec/isodoc/terms_spec.rb +0 -314
  86. data/spec/isodoc/word_dis_spec.rb +0 -2064
  87. data/spec/isodoc/xref_spec.rb +0 -1747
  88. data/spec/metanorma/amd_spec.rb +0 -724
  89. data/spec/metanorma/base_spec.rb +0 -1384
  90. data/spec/metanorma/blank_spec.rb +0 -38
  91. data/spec/metanorma/blocks_spec.rb +0 -624
  92. data/spec/metanorma/cleanup_spec.rb +0 -1645
  93. data/spec/metanorma/inline_spec.rb +0 -203
  94. data/spec/metanorma/lists_spec.rb +0 -197
  95. data/spec/metanorma/macros_spec.rb +0 -99
  96. data/spec/metanorma/processor_spec.rb +0 -161
  97. data/spec/metanorma/refs_spec.rb +0 -672
  98. data/spec/metanorma/section_spec.rb +0 -492
  99. data/spec/metanorma/table_spec.rb +0 -329
  100. data/spec/metanorma/validate_spec.rb +0 -2153
  101. data/spec/relaton/render_spec.rb +0 -568
  102. data/spec/requirements/requirement_components_spec.rb +0 -610
  103. data/spec/requirements/requirements_spec.rb +0 -1596
  104. data/spec/requirements/xref_spec.rb +0 -1211
  105. data/spec/spec_helper.rb +0 -313
  106. data/spec/vcr_cassettes/docrels.yml +0 -385
  107. data/spec/vcr_cassettes/withdrawn_iso.yml +0 -295
@@ -121,8 +121,8 @@
121
121
 
122
122
  <xsl:variable name="stagename-header-coverpage">
123
123
  <xsl:choose>
124
- <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM'">DRAFT</xsl:when>
125
- <xsl:when test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM'">FINAL DRAFT</xsl:when>
124
+ <xsl:when test="$stage-abbreviation = 'DIS' or $stage-abbreviation = 'DAmd' or $stage-abbreviation = 'DAM' or starts-with($stage-abbreviation, 'DTS') or starts-with($stage-abbreviation, 'DTR')">DRAFT</xsl:when>
125
+ <xsl:when test="$stage-abbreviation = 'FDIS' or $stage-abbreviation = 'FDAmd' or $stage-abbreviation = 'FDAM' or starts-with($stage-abbreviation, 'FDTS') or starts-with($stage-abbreviation, 'FDTR')">FINAL DRAFT</xsl:when>
126
126
  <xsl:when test="$stage-abbreviation = 'PRF'"/>
127
127
  <xsl:when test="$stage-abbreviation = 'IS'"/>
128
128
  <xsl:otherwise>
@@ -980,9 +980,14 @@
980
980
  </fo:table>
981
981
  </fo:block-container>
982
982
  <fo:block-container position="absolute" left="60mm" top="222mm" height="25mm" display-align="after">
983
- <fo:block>
983
+ <fo:block margin-bottom="2mm">
984
984
  <xsl:if test="$stage-abbreviation = 'PRF'">
985
- <fo:block font-size="39pt" font-weight="bold"><xsl:value-of select="$proof-text"/></fo:block>
985
+ <fo:block font-size="36pt" font-weight="bold" margin-left="1mm">
986
+ <xsl:call-template name="add-letter-spacing">
987
+ <xsl:with-param name="text" select="$proof-text"/>
988
+ <xsl:with-param name="letter-spacing" select="0.65"/>
989
+ </xsl:call-template>
990
+ </fo:block>
986
991
  </xsl:if>
987
992
  </fo:block>
988
993
  </fo:block-container>
@@ -1456,7 +1461,7 @@
1456
1461
  <fo:block font-size="9pt"><xsl:value-of select="$copyrightText"/></fo:block>
1457
1462
  </fo:table-cell>
1458
1463
  <fo:table-cell>
1459
- <fo:block font-size="11pt" font-weight="bold" text-align="center">
1464
+ <fo:block font-size="10pt" font-weight="bold" text-align="center">
1460
1465
  <xsl:if test="$stage-abbreviation = 'PRF'">
1461
1466
  <xsl:value-of select="$proof-text"/>
1462
1467
  </xsl:if>
@@ -1676,6 +1681,7 @@
1676
1681
  <xsl:variable name="display">
1677
1682
  <xsl:choose>
1678
1683
  <xsl:when test="ancestor-or-self::iso:annex and $level &gt;= 2">false</xsl:when>
1684
+ <xsl:when test="ancestor-or-self::iso:introduction and $level &gt;= 2">false</xsl:when>
1679
1685
  <xsl:when test="$section = '' and $type = 'clause'">false</xsl:when>
1680
1686
  <xsl:when test="$level &lt;= $toc_level">true</xsl:when>
1681
1687
  <xsl:otherwise>false</xsl:otherwise>
@@ -1796,6 +1802,7 @@
1796
1802
  <xsl:choose>
1797
1803
  <xsl:when test="ancestor::iso:annex and $level = 2">13pt</xsl:when>
1798
1804
  <xsl:when test="ancestor::iso:annex and $level = 3">12pt</xsl:when>
1805
+ <xsl:when test="ancestor::iso:introduction and $level &gt;= 2">11pt</xsl:when>
1799
1806
  <xsl:when test="ancestor::iso:preface">16pt</xsl:when>
1800
1807
  <xsl:when test="$level = 2">12pt</xsl:when>
1801
1808
  <xsl:when test="$level &gt;= 3">11pt</xsl:when>
@@ -1822,19 +1829,30 @@
1822
1829
  <xsl:element name="{$element-name}">
1823
1830
  <xsl:attribute name="font-size"><xsl:value-of select="$font-size"/></xsl:attribute>
1824
1831
  <xsl:attribute name="font-weight">bold</xsl:attribute>
1825
- <xsl:attribute name="margin-top"> <!-- margin-top -->
1832
+ <xsl:variable name="attribute-name-before">
1833
+ <xsl:choose>
1834
+ <xsl:when test="ancestor::iso:preface and $level = 1">margin-top</xsl:when> <!-- for Foreword and Introduction titles -->
1835
+ <xsl:otherwise>space-before</xsl:otherwise>
1836
+ </xsl:choose>
1837
+ </xsl:variable>
1838
+ <xsl:attribute name="{$attribute-name-before}"> <!-- space-before or margin-top -->
1826
1839
  <xsl:choose>
1840
+ <xsl:when test="ancestor::iso:introduction and $level &gt;= 2 and ../preceding-sibling::iso:clause">30pt</xsl:when>
1827
1841
  <xsl:when test="ancestor::iso:preface">8pt</xsl:when>
1828
1842
  <xsl:when test="$level = 2 and ancestor::iso:annex">18pt</xsl:when>
1829
1843
  <xsl:when test="$level = 1">18pt</xsl:when>
1830
- <xsl:when test="$level &gt;= 3">3pt</xsl:when>
1831
- <xsl:when test="$level = ''">6pt</xsl:when><!-- 13.5pt -->
1844
+ <xsl:when test="($level = 2 or $level = 3) and not(../preceding-sibling::iso:clause)">14pt</xsl:when> <!-- first title in 3rd level clause -->
1845
+ <xsl:when test="$level = 3">14pt</xsl:when>
1846
+ <xsl:when test="$level &gt; 3">3pt</xsl:when>
1847
+ <xsl:when test="$level = ''">6pt</xsl:when>
1832
1848
  <xsl:otherwise>12pt</xsl:otherwise>
1833
1849
  </xsl:choose>
1834
1850
  </xsl:attribute>
1835
- <xsl:attribute name="margin-bottom">
1851
+ <xsl:attribute name="space-after"> <!-- margin-bottom -->
1836
1852
  <xsl:choose>
1853
+ <xsl:when test="ancestor::iso:introduction and $level &gt;= 2">8pt</xsl:when>
1837
1854
  <xsl:when test="ancestor::iso:preface">18pt</xsl:when>
1855
+ <xsl:when test="$level = 3">9pt</xsl:when>
1838
1856
  <!-- <xsl:otherwise>12pt</xsl:otherwise> -->
1839
1857
  <xsl:otherwise>8pt</xsl:otherwise>
1840
1858
  </xsl:choose>
@@ -1900,9 +1918,26 @@
1900
1918
  </xsl:choose>
1901
1919
  </xsl:attribute>
1902
1920
  <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
1921
+ <xsl:if test="count(ancestor::iso:li) = 1 and not(ancestor::iso:li[1]/following-sibling::iso:li) and not(following-sibling::iso:p)">
1922
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1923
+ </xsl:if>
1903
1924
  <xsl:if test="starts-with(ancestor::*[local-name() = 'table'][1]/@type, 'recommend') and not(following-sibling::*[local-name() = 'p'])">
1904
1925
  <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
1905
1926
  </xsl:if>
1927
+ <xsl:if test="parent::*[local-name() = 'td' or local-name() = 'th']">
1928
+ <xsl:choose>
1929
+ <xsl:when test="not(following-sibling::*)"> <!-- last paragraph in table cell -->
1930
+ <xsl:attribute name="margin-bottom">2pt</xsl:attribute>
1931
+ </xsl:when>
1932
+ <xsl:otherwise>
1933
+ <xsl:attribute name="margin-bottom">5pt</xsl:attribute>
1934
+ </xsl:otherwise>
1935
+ </xsl:choose>
1936
+ <!-- Special case: if paragraph in 'strong', i.e. it's sub-header, then keeps with next -->
1937
+ <xsl:if test="count(node()) = count(*[local-name() = 'strong']) and following-sibling::*">
1938
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
1939
+ </xsl:if>
1940
+ </xsl:if>
1906
1941
  <xsl:if test="@id">
1907
1942
  <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
1908
1943
  </xsl:if>
@@ -2061,7 +2096,7 @@
2061
2096
  <fo:block><fo:page-number/></fo:block>
2062
2097
  </fo:table-cell>
2063
2098
  <fo:table-cell display-align="center">
2064
- <fo:block font-size="11pt" font-weight="bold" text-align="center">
2099
+ <fo:block font-size="10pt" font-weight="bold" text-align="center">
2065
2100
  <xsl:if test="$stage-abbreviation = 'PRF'">
2066
2101
  <xsl:value-of select="$proof-text"/>
2067
2102
  </xsl:if>
@@ -2114,7 +2149,7 @@
2114
2149
  <fo:block><xsl:value-of select="$copyrightText"/></fo:block>
2115
2150
  </fo:table-cell>
2116
2151
  <fo:table-cell display-align="center">
2117
- <fo:block font-size="11pt" font-weight="bold" text-align="center">
2152
+ <fo:block font-size="10pt" font-weight="bold" text-align="center">
2118
2153
  <xsl:if test="$stage-abbreviation = 'PRF'">
2119
2154
  <xsl:value-of select="$proof-text"/>
2120
2155
  </xsl:if>
@@ -2589,6 +2624,14 @@
2589
2624
 
2590
2625
  </xsl:attribute-set>
2591
2626
 
2627
+ <xsl:attribute-set name="pre-style">
2628
+ <xsl:attribute name="font-family">Courier New, <xsl:value-of select="$font_noto_sans_mono"/></xsl:attribute>
2629
+ <xsl:attribute name="margin-bottom">6pt</xsl:attribute>
2630
+
2631
+ <xsl:attribute name="margin-bottom">12pt</xsl:attribute>
2632
+
2633
+ </xsl:attribute-set>
2634
+
2592
2635
  <xsl:attribute-set name="permission-style">
2593
2636
 
2594
2637
  </xsl:attribute-set>
@@ -2710,9 +2753,15 @@
2710
2753
  <!-- ========================== -->
2711
2754
  <xsl:variable name="table-border_">
2712
2755
 
2756
+ 1pt solid black
2713
2757
  </xsl:variable>
2714
2758
  <xsl:variable name="table-border" select="normalize-space($table-border_)"/>
2715
2759
 
2760
+ <xsl:variable name="table-cell-border_">
2761
+ 0.5pt solid black
2762
+ </xsl:variable>
2763
+ <xsl:variable name="table-cell-border" select="normalize-space($table-cell-border_)"/>
2764
+
2716
2765
  <xsl:attribute-set name="table-container-style">
2717
2766
  <xsl:attribute name="margin-left">0mm</xsl:attribute>
2718
2767
  <xsl:attribute name="margin-right">0mm</xsl:attribute>
@@ -2726,10 +2775,8 @@
2726
2775
  <xsl:attribute-set name="table-style">
2727
2776
  <xsl:attribute name="table-omit-footer-at-break">true</xsl:attribute>
2728
2777
  <xsl:attribute name="table-layout">fixed</xsl:attribute>
2729
- <xsl:attribute name="margin-left">0mm</xsl:attribute>
2730
- <xsl:attribute name="margin-right">0mm</xsl:attribute>
2731
2778
 
2732
- <xsl:attribute name="border">1.5pt solid black</xsl:attribute>
2779
+ <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
2733
2780
 
2734
2781
  </xsl:attribute-set><!-- table-style -->
2735
2782
 
@@ -2751,16 +2798,16 @@
2751
2798
  <xsl:attribute-set name="table-header-row-style" use-attribute-sets="table-row-style">
2752
2799
  <xsl:attribute name="font-weight">bold</xsl:attribute>
2753
2800
 
2754
- <xsl:attribute name="border-top">solid black 1pt</xsl:attribute>
2755
- <xsl:attribute name="border-bottom">solid black 1pt</xsl:attribute>
2801
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
2802
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
2756
2803
 
2757
2804
  </xsl:attribute-set>
2758
2805
 
2759
2806
  <xsl:attribute-set name="table-footer-row-style" use-attribute-sets="table-row-style">
2760
2807
 
2761
2808
  <xsl:attribute name="font-size">9pt</xsl:attribute>
2762
- <xsl:attribute name="border-left">solid black 1pt</xsl:attribute>
2763
- <xsl:attribute name="border-right">solid black 1pt</xsl:attribute>
2809
+ <xsl:attribute name="border-left"><xsl:value-of select="$table-border"/></xsl:attribute>
2810
+ <xsl:attribute name="border-right"><xsl:value-of select="$table-border"/></xsl:attribute>
2764
2811
 
2765
2812
  </xsl:attribute-set>
2766
2813
 
@@ -2776,6 +2823,8 @@
2776
2823
  <xsl:attribute name="display-align">center</xsl:attribute>
2777
2824
 
2778
2825
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
2826
+ <xsl:attribute name="border-left"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2827
+ <xsl:attribute name="border-right"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2779
2828
 
2780
2829
  </xsl:attribute-set> <!-- table-header-cell-style -->
2781
2830
 
@@ -2786,6 +2835,7 @@
2786
2835
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2787
2836
 
2788
2837
  <xsl:attribute name="padding-top">0.5mm</xsl:attribute>
2838
+ <xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
2789
2839
 
2790
2840
  </xsl:attribute-set> <!-- table-cell-style -->
2791
2841
 
@@ -2795,6 +2845,7 @@
2795
2845
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
2796
2846
  <xsl:attribute name="padding-top">1mm</xsl:attribute>
2797
2847
 
2848
+ <xsl:attribute name="border"><xsl:value-of select="$table-border"/></xsl:attribute>
2798
2849
  <xsl:attribute name="border-top">solid black 0pt</xsl:attribute>
2799
2850
 
2800
2851
  </xsl:attribute-set> <!-- table-footer-cell-style -->
@@ -3851,14 +3902,20 @@
3851
3902
  <xsl:variable name="table_attributes">
3852
3903
 
3853
3904
  <xsl:element name="table_attributes" use-attribute-sets="table-style">
3905
+
3906
+ <xsl:if test="$margin-side != 0">
3907
+ <xsl:attribute name="margin-left">0mm</xsl:attribute>
3908
+ <xsl:attribute name="margin-right">0mm</xsl:attribute>
3909
+ </xsl:if>
3910
+
3854
3911
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3855
3912
 
3856
3913
  <xsl:if test="*[local-name()='thead']">
3857
- <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
3914
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
3858
3915
  </xsl:if>
3859
3916
  <xsl:if test="ancestor::*[local-name() = 'table']">
3860
3917
  <!-- for internal table in table cell -->
3861
- <xsl:attribute name="border">0.5pt solid black</xsl:attribute>
3918
+ <xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
3862
3919
  </xsl:if>
3863
3920
 
3864
3921
  </xsl:element>
@@ -4393,6 +4450,12 @@
4393
4450
  <fo:table-row>
4394
4451
  <fo:table-cell number-columns-spanned="{$cols-count}" border-left="1.5pt solid white" border-right="1.5pt solid white" border-top="1.5pt solid white" border-bottom="1.5pt solid black">
4395
4452
 
4453
+ <xsl:attribute name="border-left">1pt solid white</xsl:attribute>
4454
+ <xsl:attribute name="border-right">1pt solid white</xsl:attribute>
4455
+ <xsl:attribute name="border-top">1pt solid white</xsl:attribute>
4456
+ <!-- <xsl:attribute name="border-bottom">0.5pt solid white</xsl:attribute> -->
4457
+ <xsl:attribute name="border-bottom">none</xsl:attribute>
4458
+
4396
4459
  <xsl:apply-templates select="ancestor::*[local-name()='table']/*[local-name()='name']">
4397
4460
  <xsl:with-param name="continued">true</xsl:with-param>
4398
4461
  </xsl:apply-templates>
@@ -4654,12 +4717,12 @@
4654
4717
 
4655
4718
  <xsl:choose>
4656
4719
  <xsl:when test="position() = 1">
4657
- <xsl:attribute name="border-top">solid black 1.5pt</xsl:attribute>
4658
- <xsl:attribute name="border-bottom">solid black 1pt</xsl:attribute>
4720
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
4721
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4659
4722
  </xsl:when>
4660
4723
  <xsl:when test="position() = last()">
4661
- <xsl:attribute name="border-top">solid black 1pt</xsl:attribute>
4662
- <xsl:attribute name="border-bottom">solid black 1.5pt</xsl:attribute>
4724
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4725
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-border"/></xsl:attribute>
4663
4726
  </xsl:when>
4664
4727
  </xsl:choose>
4665
4728
 
@@ -4682,6 +4745,14 @@
4682
4745
  <xsl:template match="*[local-name()='tr']">
4683
4746
  <fo:table-row xsl:use-attribute-sets="table-body-row-style">
4684
4747
 
4748
+ <xsl:if test="*[local-name() = 'th']">
4749
+ <xsl:attribute name="keep-with-next">always</xsl:attribute>
4750
+ </xsl:if>
4751
+
4752
+ <xsl:if test="position() = 1 and not(ancestor::*[local-name() = 'table']/*[local-name() = 'thead'])">
4753
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
4754
+ </xsl:if>
4755
+
4685
4756
  <xsl:call-template name="setTableRowAttributes"/>
4686
4757
  <xsl:apply-templates/>
4687
4758
  </fo:table-row>
@@ -4701,6 +4772,11 @@
4701
4772
  <xsl:with-param name="default">center</xsl:with-param>
4702
4773
  </xsl:call-template>
4703
4774
 
4775
+ <xsl:if test="../parent::*[local-name() = 'tbody'] and (following-sibling::*[local-name() = 'td'] or preceding-sibling::*[local-name() = 'td'])">
4776
+ <xsl:attribute name="border-top"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4777
+ <xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
4778
+ </xsl:if>
4779
+
4704
4780
  <xsl:if test="$lang = 'ar'">
4705
4781
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4706
4782
  </xsl:if>
@@ -4759,6 +4835,10 @@
4759
4835
  <xsl:if test="starts-with(ancestor::*[local-name() = 'table'][1]/@type, 'recommend')">
4760
4836
  <xsl:attribute name="display-align">before</xsl:attribute>
4761
4837
  </xsl:if>
4838
+ <xsl:if test="ancestor::*[local-name() = 'tbody'] and not(../preceding-sibling::*[local-name() = 'tr']) and ancestor::*[local-name() = 'table'][1]/*[local-name() = 'thead']"> <!-- cells in 1st row in the table body, and if thead exists -->
4839
+ <xsl:attribute name="border-top">0pt solid black</xsl:attribute>
4840
+ </xsl:if>
4841
+ <!-- <xsl:attribute name="page-break-inside">avoid</xsl:attribute> -->
4762
4842
 
4763
4843
  <xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
4764
4844
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
@@ -6676,6 +6756,9 @@
6676
6756
  <xsl:value-of select="substring($str, 2)"/>
6677
6757
  </xsl:template>
6678
6758
 
6759
+ <!-- ======================================= -->
6760
+ <!-- math -->
6761
+ <!-- ======================================= -->
6679
6762
  <xsl:template match="mathml:math">
6680
6763
  <xsl:variable name="isAdded" select="@added"/>
6681
6764
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -6726,14 +6809,57 @@
6726
6809
  <xsl:value-of select="$comment_text"/>
6727
6810
  </xsl:template>
6728
6811
 
6812
+ <xsl:template match="*[local-name() = 'asciimath']">
6813
+ <xsl:param name="process" select="'false'"/>
6814
+ <xsl:if test="$process = 'true'">
6815
+ <xsl:apply-templates/>
6816
+ </xsl:if>
6817
+ </xsl:template>
6818
+
6819
+ <xsl:template match="*[local-name() = 'latexmath']"/>
6820
+
6821
+ <xsl:template name="getMathml_asciimath_text">
6822
+ <xsl:variable name="asciimath" select="../*[local-name() = 'asciimath']"/>
6823
+ <xsl:variable name="latexmath">
6824
+
6825
+ </xsl:variable>
6826
+ <xsl:variable name="asciimath_text_following">
6827
+ <xsl:choose>
6828
+ <xsl:when test="normalize-space($latexmath) != ''">
6829
+ <xsl:value-of select="$latexmath"/>
6830
+ </xsl:when>
6831
+ <xsl:when test="normalize-space($asciimath) != ''">
6832
+ <xsl:value-of select="$asciimath"/>
6833
+ </xsl:when>
6834
+ <xsl:otherwise>
6835
+ <xsl:value-of select="following-sibling::node()[1][self::comment()]"/>
6836
+ </xsl:otherwise>
6837
+ </xsl:choose>
6838
+ </xsl:variable>
6839
+ <xsl:variable name="asciimath_text_">
6840
+ <xsl:choose>
6841
+ <xsl:when test="normalize-space($asciimath_text_following) != ''">
6842
+ <xsl:value-of select="$asciimath_text_following"/>
6843
+ </xsl:when>
6844
+ <xsl:otherwise>
6845
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
6846
+ </xsl:otherwise>
6847
+ </xsl:choose>
6848
+ </xsl:variable>
6849
+ <xsl:variable name="asciimath_text_2" select="java:org.metanorma.fop.Util.unescape($asciimath_text_)"/>
6850
+ <xsl:variable name="asciimath_text" select="java:trim(java:java.lang.String.new($asciimath_text_2))"/>
6851
+ <xsl:value-of select="$asciimath_text"/>
6852
+ </xsl:template>
6853
+
6729
6854
  <xsl:template name="mathml_instream_object">
6730
- <xsl:param name="comment_text"/>
6855
+ <xsl:param name="asciimath_text"/>
6731
6856
  <xsl:param name="mathml_content"/>
6732
6857
 
6733
- <xsl:variable name="comment_text_">
6858
+ <xsl:variable name="asciimath_text_">
6734
6859
  <xsl:choose>
6735
- <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
6736
- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
6860
+ <xsl:when test="normalize-space($asciimath_text) != ''"><xsl:value-of select="$asciimath_text"/></xsl:when>
6861
+ <!-- <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise> -->
6862
+ <xsl:otherwise><xsl:call-template name="getMathml_asciimath_text"/></xsl:otherwise>
6737
6863
  </xsl:choose>
6738
6864
  </xsl:variable>
6739
6865
 
@@ -6757,10 +6883,10 @@
6757
6883
  </xsl:attribute>
6758
6884
 
6759
6885
  <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
6760
- <xsl:if test="normalize-space($comment_text_) != ''">
6886
+ <xsl:if test="normalize-space($asciimath_text_) != ''">
6761
6887
  <!-- put Mathin Alternate Text -->
6762
6888
  <xsl:attribute name="fox:alt-text">
6763
- <xsl:value-of select="$comment_text_"/>
6889
+ <xsl:value-of select="$asciimath_text_"/>
6764
6890
  </xsl:attribute>
6765
6891
  </xsl:if>
6766
6892
  <!-- </xsl:if> -->
@@ -6833,6 +6959,29 @@
6833
6959
  <xsl:value-of select="."/><xsl:value-of select="$zero_width_space"/>
6834
6960
  </xsl:template>
6835
6961
 
6962
+ <!-- Examples:
6963
+ <stem type="AsciiMath">x = 1</stem>
6964
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath></stem>
6965
+ <stem type="AsciiMath"><asciimath>x = 1</asciimath><latexmath>x = 1</latexmath></stem>
6966
+ -->
6967
+ <xsl:template match="*[local-name() = 'stem'][@type = 'AsciiMath'][count(*) = 0]/text() | *[local-name() = 'stem'][@type = 'AsciiMath'][*[local-name() = 'asciimath']]" priority="3">
6968
+ <fo:inline xsl:use-attribute-sets="mathml-style">
6969
+
6970
+ <xsl:choose>
6971
+ <xsl:when test="self::text()"><xsl:value-of select="."/></xsl:when>
6972
+ <xsl:otherwise>
6973
+ <xsl:apply-templates>
6974
+ <xsl:with-param name="process">true</xsl:with-param>
6975
+ </xsl:apply-templates>
6976
+ </xsl:otherwise>
6977
+ </xsl:choose>
6978
+
6979
+ </fo:inline>
6980
+ </xsl:template>
6981
+ <!-- ======================================= -->
6982
+ <!-- END: math -->
6983
+ <!-- ======================================= -->
6984
+
6836
6985
  <xsl:template match="*[local-name()='localityStack']"/>
6837
6986
 
6838
6987
  <xsl:template match="*[local-name()='link']" name="link">
@@ -8181,9 +8330,9 @@
8181
8330
  <xsl:apply-templates mode="contents_item"/>
8182
8331
  </xsl:template>
8183
8332
 
8184
- <!-- ====== -->
8185
- <!-- sourcecode -->
8186
- <!-- ====== -->
8333
+ <!-- =============== -->
8334
+ <!-- sourcecode -->
8335
+ <!-- =============== -->
8187
8336
  <xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
8188
8337
 
8189
8338
  <fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
@@ -8480,8 +8629,22 @@
8480
8629
  </fo:block>
8481
8630
  </xsl:if>
8482
8631
  </xsl:template>
8483
- <!-- ====== -->
8484
- <!-- ====== -->
8632
+ <!-- =============== -->
8633
+ <!-- END sourcecode -->
8634
+ <!-- =============== -->
8635
+
8636
+ <!-- =============== -->
8637
+ <!-- pre -->
8638
+ <!-- =============== -->
8639
+ <xsl:template match="*[local-name()='pre']" name="pre">
8640
+ <fo:block xsl:use-attribute-sets="pre-style">
8641
+ <xsl:copy-of select="@id"/>
8642
+ <xsl:apply-templates/>
8643
+ </fo:block>
8644
+ </xsl:template>
8645
+ <!-- =============== -->
8646
+ <!-- pre -->
8647
+ <!-- =============== -->
8485
8648
 
8486
8649
  <!-- ========== -->
8487
8650
  <!-- permission -->
@@ -9525,6 +9688,10 @@
9525
9688
 
9526
9689
  <fo:list-block xsl:use-attribute-sets="list-style">
9527
9690
 
9691
+ <xsl:if test="not(ancestor::*[local-name() = 'ul' or local-name() = 'ol'])">
9692
+ <xsl:attribute name="margin-bottom">8pt</xsl:attribute>
9693
+ </xsl:if>
9694
+
9528
9695
  <xsl:if test="*[local-name() = 'name']">
9529
9696
  <xsl:attribute name="margin-top">0pt</xsl:attribute>
9530
9697
  </xsl:if>
@@ -11143,13 +11310,14 @@
11143
11310
  </xsl:template>
11144
11311
 
11145
11312
  <xsl:template name="setId">
11313
+ <xsl:param name="prefix"/>
11146
11314
  <xsl:attribute name="id">
11147
11315
  <xsl:choose>
11148
11316
  <xsl:when test="@id">
11149
- <xsl:value-of select="@id"/>
11317
+ <xsl:value-of select="concat($prefix, @id)"/>
11150
11318
  </xsl:when>
11151
11319
  <xsl:otherwise>
11152
- <xsl:value-of select="generate-id()"/>
11320
+ <xsl:value-of select="concat($prefix, generate-id())"/>
11153
11321
  </xsl:otherwise>
11154
11322
  </xsl:choose>
11155
11323
  </xsl:attribute>
@@ -10,23 +10,28 @@ module IsoDoc
10
10
  def warning_for_missing_metadata(docxml)
11
11
  return unless @meta.get[:unpublished]
12
12
 
13
+ ret = warning_for_missing_metadata_create(docxml)
14
+ return if ret.empty?
15
+
16
+ warning_for_missing_metadata_post(docxml, ret)
17
+ end
18
+
19
+ def warning_for_missing_metadata_create(docxml)
13
20
  ret = ""
14
21
  docxml.at(ns("//bibdata/ext//secretariat")) or
15
22
  ret += "<p>Secretariat is missing.</p>"
16
23
  docxml.at(ns("//bibdata/ext//editorialgroup")) or
17
24
  ret += "<p>Editorial groups are missing.</p>"
18
- docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' "\
25
+ docxml.at(ns("//bibdata/date[@type = 'published' or @type = 'issued' " \
19
26
  "or @type = 'created']")) ||
20
27
  docxml.at(ns("//bibdata/version/revision-date")) or
21
28
  ret += "<p>Document date is missing.</p>"
22
- return if ret.empty?
23
-
24
- warning_for_missing_metadata1(docxml, ret)
29
+ ret
25
30
  end
26
31
 
27
- def warning_for_missing_metadata1(docxml, ret)
32
+ def warning_for_missing_metadata_post(docxml, ret)
28
33
  id = UUIDTools::UUID.random_create
29
- ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>"\
34
+ ret = "<review date='#{Date.today}' reviewer='Metanorma' id='_#{id}'>" \
30
35
  "<p><strong>Metadata warnings:<strong></p> #{ret}</review>"
31
36
  ins = docxml.at(ns("//sections//title")) or return
32
37
  ins.children.first.previous = ret
@@ -65,9 +70,8 @@ module IsoDoc
65
70
  i18n.get["stage_dict"][stage.text].is_a?(Hash) or
66
71
  return hash_translate(bib, i18n.get["stage_dict"],
67
72
  "./status/stage", lang)
68
- i18n.get["stage_dict"][stage.text][type&.text] and
69
- tag_translate(stage, lang,
70
- i18n.get["stage_dict"][stage.text][type&.text])
73
+ stagetype = i18n.get["stage_dict"][stage.text][type&.text] and
74
+ tag_translate(stage, lang, stagetype)
71
75
  end
72
76
  end
73
77
  end
@@ -76,9 +76,11 @@ module IsoDoc
76
76
  end
77
77
 
78
78
  def clause(docxml)
79
- docxml.xpath(ns("//clause[not(ancestor::annex)] | "\
80
- "//terms | //definitions | //references | "\
79
+ docxml.xpath(ns("//clause[not(ancestor::annex)] | " \
80
+ "//terms | //definitions | //references | " \
81
81
  "//preface/introduction[clause]")).each do |f|
82
+ f.parent.name == "annex" &&
83
+ @xrefs.klass.single_term_clause?(f.parent) and next
82
84
  clause1(f)
83
85
  end
84
86
  end
@@ -133,7 +135,7 @@ module IsoDoc
133
135
  i = display_order_at(docxml, "//clause[@type = 'scope']", i)
134
136
  i = display_order_at(docxml, @xrefs.klass.norm_ref_xpath, i)
135
137
  i = display_order_xpath(docxml,
136
- "//sections/clause[not(@type = 'scope')] | "\
138
+ "//sections/clause[not(@type = 'scope')] | " \
137
139
  "//sections/terms | //sections/definitions", i)
138
140
  i = display_order_xpath(docxml, "//annex", i)
139
141
  i = display_order_xpath(docxml, @xrefs.klass.bibliography_xpath, i)
@@ -17,9 +17,11 @@ module IsoDoc
17
17
  init_dis(options)
18
18
  end
19
19
 
20
- def init_dis(options)
21
- @wordtemplate = options[:isowordtemplate]
22
- @dis = ::IsoDoc::Iso::WordDISConvert.new(options)
20
+ def init_dis(opt)
21
+ @wordtemplate = opt[:isowordtemplate]
22
+ opt[:isowordbgstripcolor] ||= "true"
23
+ @dis = ::IsoDoc::Iso::WordDISConvert.new(opt)
24
+ @dis.bgstripcolor = opt[:isowordbgstripcolor]
23
25
  end
24
26
 
25
27
  def font_choice(options)
@@ -80,7 +82,7 @@ module IsoDoc
80
82
  stage = @meta.get[:stage_int]
81
83
  return if !stage.nil? && stage < 60
82
84
 
83
- body.br **{ clear: "all", style: "page-break-before:left;"\
85
+ body.br **{ clear: "all", style: "page-break-before:left;" \
84
86
  "mso-break-type:section-break" }
85
87
  body.div **{ class: "colophon" } do |div|
86
88
  end
@@ -43,11 +43,32 @@ module IsoDoc
43
43
  example_style(docxml)
44
44
  dis_style_interactions(docxml)
45
45
  quote_style(docxml)
46
+ stripbgcolor(docxml)
47
+ end
48
+
49
+ def stripbgcolor(docxml)
50
+ @bgstripcolor == "true" or return
51
+ %w(aucollab audeg aufname aurole ausuffix ausurname bibarticle bibetal
52
+ bibfname bibfpage bibissue bibjournal biblpage bibnumber
53
+ biborganization bibsuppl bibsurname biburl bibvolume bibyear
54
+ citebib citeen citefig citefn citetbl bibextlink citeeq citetfn
55
+ auprefix citeapp citesec stddocNumber stddocPartNumber
56
+ stddocTitle aumember stdfootnote stdpublisher stdsection stdyear
57
+ stddocumentType bibalt-year bibbook bbichapterno bibchaptertitle
58
+ bibed-etal bibed-fname bibeditionno bibed-organization bibed-suffix
59
+ bibed-surname bibinstitution bibisbn biblocation bibpagecount
60
+ bibpatent bibpublisher bibreportnum bibschool bibseries bibseriesno
61
+ bibtrans stdsuppl citesection).each do |t|
62
+ docxml.xpath("//span[@class = '#{t}']").each do |s|
63
+ s["style"] ||= ""
64
+ s["style"] = "mso-pattern:none;#{s['style']}"
65
+ end
66
+ end
46
67
  end
47
68
 
48
69
  def dis_style_interactions(docxml)
49
- docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or "\
50
- "@class = 'Code--']"\
70
+ docxml.xpath("//p[@class = 'Code' or @class = 'Code-' or " \
71
+ "@class = 'Code--']" \
51
72
  "[following::p[@class = 'Examplecontinued']]").each do |p|
52
73
  p["style"] ||= ""
53
74
  p["style"] = "margin-bottom:12pt;#{p['style']}"
@@ -184,7 +205,7 @@ module IsoDoc
184
205
  docxml.xpath("//p[@id = 'boilerplate-address']")&.each do |p|
185
206
  p["class"] = "zzCopyright"
186
207
  p["style"] = "text-indent:20.15pt;"
187
- p.replace(p.to_xml.gsub(%r{<br/>}, "</p>\n<p class='zzCopyright' "\
208
+ p.replace(p.to_xml.gsub(%r{<br/>}, "</p>\n<p class='zzCopyright' " \
188
209
  "style='text-indent:20.15pt;'>"))
189
210
  end
190
211
  docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each do |p|
@@ -3,6 +3,8 @@ require_relative "word_dis_cleanup"
3
3
  module IsoDoc
4
4
  module Iso
5
5
  class WordDISConvert < WordConvert
6
+ attr_accessor :bgstripcolor
7
+
6
8
  def default_file_locations(_options)
7
9
  { wordstylesheet: html_doc_path("wordstyle-dis.scss"),
8
10
  standardstylesheet: html_doc_path("isodoc-dis.scss"),
@@ -19,7 +21,8 @@ module IsoDoc
19
21
  super
20
22
  end
21
23
 
22
- def init_dis(options); end
24
+ def init_dis(opt)
25
+ end
23
26
 
24
27
  def convert1(docxml, filename, dir)
25
28
  update_coverpage(docxml)
@@ -30,7 +30,8 @@ module Metanorma
30
30
  end
31
31
 
32
32
  def doc_extract_attributes(node)
33
- super.merge(isowordtemplate: node.attr("iso-word-template"))
33
+ super.merge(isowordtemplate: node.attr("iso-word-template"),
34
+ isowordbgstripcolor: node.attr("iso-word-bg-strip-color"))
34
35
  end
35
36
 
36
37
  def pdf_converter(node)