metanorma-iso 2.3.1 → 2.3.3
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.
- checksums.yaml +4 -4
- data/Gemfile.devel +2 -0
- data/lib/isodoc/iso/html/style-human.css +33 -1
- data/lib/isodoc/iso/html/style-human.scss +4 -0
- data/lib/isodoc/iso/html/style-iso.css +33 -1
- data/lib/isodoc/iso/html/style-iso.scss +4 -0
- data/lib/isodoc/iso/html/wordstyle-dis.css +4 -4
- data/lib/isodoc/iso/html/wordstyle-dis.scss +4 -4
- data/lib/isodoc/iso/iso.amendment.xsl +80 -25
- data/lib/isodoc/iso/iso.international-standard.xsl +80 -25
- data/lib/isodoc/iso/presentation_xml_convert.rb +1 -1
- data/lib/isodoc/iso/presentation_xref.rb +3 -3
- data/lib/isodoc/iso/word_dis_cleanup.rb +16 -34
- data/lib/isodoc/iso/word_dis_convert.rb +33 -6
- data/lib/metanorma/iso/biblio.rng +1 -1
- data/lib/metanorma/iso/cleanup.rb +14 -16
- data/lib/metanorma/iso/isodoc.rng +1 -1
- data/lib/metanorma/iso/version.rb +1 -1
- data/lib/relaton/render/config.yml +1 -1
- data/lib/relaton/render/general.rb +6 -0
- data/lib/relaton/render/parse.rb +20 -0
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d0647a3daea24684073cb1e71bfbf231e56357153263b8722aad8bae15198743
|
|
4
|
+
data.tar.gz: 5ba4f09cba4bfe26b99f001b001cda9884df2bea21d8f81a8807df8528dcd2b2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 45a6c71aafc32fdb25ea35bfa95d5381a81ae5e21d2888d9ba65fb5c2789d7e770bb20cdf35765755251d725d6d84ffa7a85563d58acf216d0530f700b19f0ba
|
|
7
|
+
data.tar.gz: a77b5942e043bce247b7911746f7a7dd2ffc949761c22d696686ca4a9d8872835030b1cab3c833d277814cee24cb8e0d4c019f6f99d3f1bd960ab7ad7705d43b
|
data/Gemfile.devel
ADDED
|
@@ -131,6 +131,35 @@ a.FootnoteRef + a.FootnoteRef:before {
|
|
|
131
131
|
color: red;
|
|
132
132
|
text-decoration: line-through; }
|
|
133
133
|
|
|
134
|
+
/* code highlighting with line numbers */
|
|
135
|
+
table.rouge-line-table td.rouge-gutter {
|
|
136
|
+
-moz-user-select: none;
|
|
137
|
+
-ms-user-select: none;
|
|
138
|
+
-webkit-user-select: none;
|
|
139
|
+
user-select: none;
|
|
140
|
+
padding-right: 1em; }
|
|
141
|
+
|
|
142
|
+
table.rouge-line-table td.rouge-code {
|
|
143
|
+
-moz-user-select: all;
|
|
144
|
+
-ms-user-select: all;
|
|
145
|
+
-webkit-user-select: all;
|
|
146
|
+
user-select: all; }
|
|
147
|
+
|
|
148
|
+
table.rouge-line-table,
|
|
149
|
+
table.rouge-line-table th,
|
|
150
|
+
table.rouge-line-table td {
|
|
151
|
+
width: auto;
|
|
152
|
+
border: none;
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
font-size: 100%; }
|
|
156
|
+
|
|
157
|
+
table.rouge-line-table pre {
|
|
158
|
+
margin: 0;
|
|
159
|
+
padding: 0;
|
|
160
|
+
overflow-x: visible;
|
|
161
|
+
font-size: 100%; }
|
|
162
|
+
|
|
134
163
|
#standard-band {
|
|
135
164
|
background-color: #0AC442; }
|
|
136
165
|
|
|
@@ -894,7 +923,7 @@ table {
|
|
|
894
923
|
table th, table td {
|
|
895
924
|
padding: 1em; }
|
|
896
925
|
table td.header {
|
|
897
|
-
font-
|
|
926
|
+
font-weight: 400; }
|
|
898
927
|
|
|
899
928
|
td > p:first-child, th > p:first-child {
|
|
900
929
|
margin-top: 0em; }
|
|
@@ -906,6 +935,9 @@ td,
|
|
|
906
935
|
th {
|
|
907
936
|
padding: 1em !important; }
|
|
908
937
|
|
|
938
|
+
table.rouge-line-table td, table.rouge-line-table th {
|
|
939
|
+
padding: 0em !important; }
|
|
940
|
+
|
|
909
941
|
p.TableTitle {
|
|
910
942
|
text-align: center;
|
|
911
943
|
margin-top: 2.5em;
|
|
@@ -131,6 +131,35 @@ a.FootnoteRef + a.FootnoteRef:before {
|
|
|
131
131
|
color: red;
|
|
132
132
|
text-decoration: line-through; }
|
|
133
133
|
|
|
134
|
+
/* code highlighting with line numbers */
|
|
135
|
+
table.rouge-line-table td.rouge-gutter {
|
|
136
|
+
-moz-user-select: none;
|
|
137
|
+
-ms-user-select: none;
|
|
138
|
+
-webkit-user-select: none;
|
|
139
|
+
user-select: none;
|
|
140
|
+
padding-right: 1em; }
|
|
141
|
+
|
|
142
|
+
table.rouge-line-table td.rouge-code {
|
|
143
|
+
-moz-user-select: all;
|
|
144
|
+
-ms-user-select: all;
|
|
145
|
+
-webkit-user-select: all;
|
|
146
|
+
user-select: all; }
|
|
147
|
+
|
|
148
|
+
table.rouge-line-table,
|
|
149
|
+
table.rouge-line-table th,
|
|
150
|
+
table.rouge-line-table td {
|
|
151
|
+
width: auto;
|
|
152
|
+
border: none;
|
|
153
|
+
margin: 0;
|
|
154
|
+
padding: 0;
|
|
155
|
+
font-size: 100%; }
|
|
156
|
+
|
|
157
|
+
table.rouge-line-table pre {
|
|
158
|
+
margin: 0;
|
|
159
|
+
padding: 0;
|
|
160
|
+
overflow-x: visible;
|
|
161
|
+
font-size: 100%; }
|
|
162
|
+
|
|
134
163
|
#standard-band {
|
|
135
164
|
background-color: #0AC442; }
|
|
136
165
|
|
|
@@ -936,12 +965,15 @@ table {
|
|
|
936
965
|
table th, table td {
|
|
937
966
|
padding: 1em; }
|
|
938
967
|
table td.header {
|
|
939
|
-
font-
|
|
968
|
+
font-weight: 400; }
|
|
940
969
|
|
|
941
970
|
td,
|
|
942
971
|
th {
|
|
943
972
|
padding: 1em !important; }
|
|
944
973
|
|
|
974
|
+
table.rouge-line-table td, table.rouge-line-table th {
|
|
975
|
+
padding: 0em !important; }
|
|
976
|
+
|
|
945
977
|
td > p:first-child, th > p:first-child {
|
|
946
978
|
margin-top: 0em; }
|
|
947
979
|
|
|
@@ -1910,10 +1910,10 @@ p.TOCTitle, li.TOCTitle, div.TOCTitle {
|
|
|
1910
1910
|
margin: 39.7pt 53.85pt 1.0cm 53.85pt;
|
|
1911
1911
|
mso-header-margin: 35.45pt;
|
|
1912
1912
|
mso-footer-margin: 14.2pt;
|
|
1913
|
-
mso-even-header: url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1914
|
-
mso-header: url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1915
|
-
mso-even-footer: url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1916
|
-
mso-footer: url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1913
|
+
mso-even-header: url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1914
|
+
mso-header: url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1915
|
+
mso-even-footer: url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1916
|
+
mso-footer: url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1917
1917
|
mso-first-header: url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1918
1918
|
mso-first-footer: url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1919
1919
|
mso-paper-source: 0; }
|
|
@@ -1809,10 +1809,10 @@ p.TOCTitle, li.TOCTitle, div.TOCTitle
|
|
|
1809
1809
|
margin:39.7pt 53.85pt 1.0cm 53.85pt;
|
|
1810
1810
|
mso-header-margin:35.45pt;
|
|
1811
1811
|
mso-footer-margin:14.2pt;
|
|
1812
|
-
mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1813
|
-
mso-header:url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1814
|
-
mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1815
|
-
mso-footer:url("file:///C:/Doc/FILENAME_files/header.html")
|
|
1812
|
+
mso-even-header:url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1813
|
+
mso-header:url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1814
|
+
mso-even-footer:url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1815
|
+
mso-footer:url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1816
1816
|
mso-first-header:url("file:///C:/Doc/FILENAME_files/header.html") fh1;
|
|
1817
1817
|
mso-first-footer:url("file:///C:/Doc/FILENAME_files/header.html") ff1;
|
|
1818
1818
|
mso-paper-source:0;}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
|
4
4
|
|
|
5
|
-
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5
|
+
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
|
|
6
6
|
|
|
7
7
|
<xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
|
|
8
8
|
<xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
|
|
@@ -1974,12 +1974,16 @@
|
|
|
1974
1974
|
<xsl:attribute name="text-align">
|
|
1975
1975
|
<xsl:choose>
|
|
1976
1976
|
<!-- <xsl:when test="ancestor::iso:preface">justify</xsl:when> -->
|
|
1977
|
-
<xsl:when test="@align
|
|
1977
|
+
<xsl:when test="@align = 'justified'">justify</xsl:when>
|
|
1978
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
|
1978
1979
|
<xsl:when test="ancestor::iso:td/@align"><xsl:value-of select="ancestor::iso:td/@align"/></xsl:when>
|
|
1979
1980
|
<xsl:when test="ancestor::iso:th/@align"><xsl:value-of select="ancestor::iso:th/@align"/></xsl:when>
|
|
1980
1981
|
<xsl:otherwise>justify</xsl:otherwise><!-- left -->
|
|
1981
1982
|
</xsl:choose>
|
|
1982
1983
|
</xsl:attribute>
|
|
1984
|
+
<xsl:if test="@align = 'indent'">
|
|
1985
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
|
1986
|
+
</xsl:if>
|
|
1983
1987
|
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
|
|
1984
1988
|
<xsl:if test="count(ancestor::iso:li) = 1 and not(ancestor::iso:li[1]/following-sibling::iso:li) and not(following-sibling::iso:p)">
|
|
1985
1989
|
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
@@ -2326,14 +2330,14 @@
|
|
|
2326
2330
|
BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
|
|
2327
2331
|
|
|
2328
2332
|
<!--
|
|
2329
|
-
<
|
|
2333
|
+
<metanorma-extension>
|
|
2330
2334
|
<presentation-metadata>
|
|
2331
2335
|
<papersize>letter</papersize>
|
|
2332
2336
|
</presentation-metadata>
|
|
2333
|
-
</
|
|
2337
|
+
</metanorma-extension>
|
|
2334
2338
|
-->
|
|
2335
2339
|
|
|
2336
|
-
<xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2340
|
+
<xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
|
|
2337
2341
|
<xsl:variable name="papersize_width_">
|
|
2338
2342
|
<xsl:choose>
|
|
2339
2343
|
<xsl:when test="$papersize = 'letter'">215.9</xsl:when>
|
|
@@ -2454,7 +2458,7 @@
|
|
|
2454
2458
|
<xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
|
|
2455
2459
|
|
|
2456
2460
|
<xsl:variable name="title-list-tables">
|
|
2457
|
-
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2461
|
+
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
|
|
2458
2462
|
<xsl:value-of select="$toc_table_title"/>
|
|
2459
2463
|
<xsl:if test="normalize-space($toc_table_title) = ''">
|
|
2460
2464
|
<xsl:call-template name="getTitle">
|
|
@@ -2464,7 +2468,7 @@
|
|
|
2464
2468
|
</xsl:variable>
|
|
2465
2469
|
|
|
2466
2470
|
<xsl:variable name="title-list-figures">
|
|
2467
|
-
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2471
|
+
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
|
|
2468
2472
|
<xsl:value-of select="$toc_figure_title"/>
|
|
2469
2473
|
<xsl:if test="normalize-space($toc_figure_title) = ''">
|
|
2470
2474
|
<xsl:call-template name="getTitle">
|
|
@@ -2474,7 +2478,7 @@
|
|
|
2474
2478
|
</xsl:variable>
|
|
2475
2479
|
|
|
2476
2480
|
<xsl:variable name="title-list-recommendations">
|
|
2477
|
-
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2481
|
+
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
|
|
2478
2482
|
<xsl:value-of select="$toc_requirement_title"/>
|
|
2479
2483
|
<xsl:if test="normalize-space($toc_requirement_title) = ''">
|
|
2480
2484
|
<xsl:call-template name="getTitle">
|
|
@@ -2546,7 +2550,7 @@
|
|
|
2546
2550
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
|
2547
2551
|
|
|
2548
2552
|
<xsl:variable name="additional_fonts_">
|
|
2549
|
-
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = '
|
|
2553
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
|
2550
2554
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
|
2551
2555
|
</xsl:for-each>
|
|
2552
2556
|
</xsl:variable>
|
|
@@ -3655,10 +3659,10 @@
|
|
|
3655
3659
|
|
|
3656
3660
|
<xsl:template name="processTablesFigures_Contents">
|
|
3657
3661
|
<xsl:param name="always"/>
|
|
3658
|
-
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
3662
|
+
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
|
|
3659
3663
|
<xsl:call-template name="processTables_Contents"/>
|
|
3660
3664
|
</xsl:if>
|
|
3661
|
-
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
3665
|
+
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
|
|
3662
3666
|
<xsl:call-template name="processFigures_Contents"/>
|
|
3663
3667
|
</xsl:if>
|
|
3664
3668
|
</xsl:template>
|
|
@@ -3966,6 +3970,9 @@
|
|
|
3966
3970
|
<xsl:if test="not(*[local-name() = 'name'])">
|
|
3967
3971
|
<xsl:attribute name="margin-top">12pt</xsl:attribute>
|
|
3968
3972
|
</xsl:if>
|
|
3973
|
+
<xsl:if test="starts-with(@id, 'array_')">
|
|
3974
|
+
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
|
3975
|
+
</xsl:if>
|
|
3969
3976
|
|
|
3970
3977
|
<!-- end table block-container attributes -->
|
|
3971
3978
|
|
|
@@ -3996,6 +4003,8 @@
|
|
|
3996
4003
|
<xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
|
|
3997
4004
|
</xsl:if>
|
|
3998
4005
|
|
|
4006
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4007
|
+
|
|
3999
4008
|
</xsl:element>
|
|
4000
4009
|
</xsl:variable>
|
|
4001
4010
|
|
|
@@ -4140,6 +4149,15 @@
|
|
|
4140
4149
|
|
|
4141
4150
|
</xsl:template>
|
|
4142
4151
|
|
|
4152
|
+
<xsl:template name="setBordersTableArray">
|
|
4153
|
+
|
|
4154
|
+
<xsl:if test="starts-with(@id, 'array_') or starts-with(ancestor::*[local-name() = 'table'][1]/@id, 'array_')">
|
|
4155
|
+
<!-- array - table without borders -->
|
|
4156
|
+
<xsl:attribute name="border">none</xsl:attribute>
|
|
4157
|
+
</xsl:if>
|
|
4158
|
+
|
|
4159
|
+
</xsl:template>
|
|
4160
|
+
|
|
4143
4161
|
<xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
|
|
4144
4162
|
<xsl:param name="continued"/>
|
|
4145
4163
|
<xsl:if test="normalize-space() != ''">
|
|
@@ -4642,6 +4660,8 @@
|
|
|
4642
4660
|
<fo:table-row>
|
|
4643
4661
|
<fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
|
|
4644
4662
|
|
|
4663
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4664
|
+
|
|
4645
4665
|
<!-- fn will be processed inside 'note' processing -->
|
|
4646
4666
|
|
|
4647
4667
|
<!-- for BSI (not PAS) display Notes before footnotes -->
|
|
@@ -4818,6 +4838,8 @@
|
|
|
4818
4838
|
</xsl:when>
|
|
4819
4839
|
</xsl:choose>
|
|
4820
4840
|
|
|
4841
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4842
|
+
|
|
4821
4843
|
<xsl:call-template name="setTableRowAttributes"/>
|
|
4822
4844
|
|
|
4823
4845
|
<xsl:apply-templates/>
|
|
@@ -4845,6 +4867,8 @@
|
|
|
4845
4867
|
<xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
|
|
4846
4868
|
</xsl:if>
|
|
4847
4869
|
|
|
4870
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4871
|
+
|
|
4848
4872
|
<xsl:call-template name="setTableRowAttributes"/>
|
|
4849
4873
|
<xsl:apply-templates/>
|
|
4850
4874
|
</fo:table-row>
|
|
@@ -4869,6 +4893,8 @@
|
|
|
4869
4893
|
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
|
|
4870
4894
|
</xsl:if>
|
|
4871
4895
|
|
|
4896
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4897
|
+
|
|
4872
4898
|
<xsl:if test="$lang = 'ar'">
|
|
4873
4899
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
4874
4900
|
</xsl:if>
|
|
@@ -4932,6 +4958,8 @@
|
|
|
4932
4958
|
</xsl:if>
|
|
4933
4959
|
<!-- <xsl:attribute name="page-break-inside">avoid</xsl:attribute> -->
|
|
4934
4960
|
|
|
4961
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4962
|
+
|
|
4935
4963
|
<xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
|
|
4936
4964
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
4937
4965
|
</xsl:if>
|
|
@@ -4986,7 +5014,7 @@
|
|
|
4986
5014
|
</fn>
|
|
4987
5015
|
-->
|
|
4988
5016
|
<!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
|
|
4989
|
-
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5017
|
+
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
|
|
4990
5018
|
|
|
4991
5019
|
<!-- list of footnotes to calculate actual footnotes number -->
|
|
4992
5020
|
<xsl:variable name="p_fn_">
|
|
@@ -5045,8 +5073,7 @@
|
|
|
5045
5073
|
</fo:basic-link>
|
|
5046
5074
|
</fo:inline>
|
|
5047
5075
|
</xsl:variable>
|
|
5048
|
-
|
|
5049
|
-
gen_id=<xsl:value-of select="$gen_id"/> -->
|
|
5076
|
+
|
|
5050
5077
|
<xsl:choose>
|
|
5051
5078
|
<xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
|
|
5052
5079
|
<xsl:copy-of select="$footnote_inline"/>
|
|
@@ -5101,7 +5128,7 @@
|
|
|
5101
5128
|
<!-- commented:
|
|
5102
5129
|
.//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
|
|
5103
5130
|
because 'fn' there is in biblio-tag -->
|
|
5104
|
-
<xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5131
|
+
<xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
|
|
5105
5132
|
<!-- copy unique fn -->
|
|
5106
5133
|
<fn gen_id="{generate-id(.)}">
|
|
5107
5134
|
<xsl:copy-of select="@*"/>
|
|
@@ -7748,7 +7775,9 @@
|
|
|
7748
7775
|
|
|
7749
7776
|
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
|
|
7750
7777
|
<xsl:if test="number($scale) < 100">
|
|
7751
|
-
|
|
7778
|
+
|
|
7779
|
+
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
|
7780
|
+
|
|
7752
7781
|
</xsl:if>
|
|
7753
7782
|
|
|
7754
7783
|
</xsl:if>
|
|
@@ -8674,7 +8703,7 @@
|
|
|
8674
8703
|
<!-- sourcecode -->
|
|
8675
8704
|
<!-- =============== -->
|
|
8676
8705
|
|
|
8677
|
-
<xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
8706
|
+
<xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
|
|
8678
8707
|
<xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
|
|
8679
8708
|
<xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
|
|
8680
8709
|
|
|
@@ -8761,6 +8790,12 @@
|
|
|
8761
8790
|
</xsl:attribute>
|
|
8762
8791
|
</xsl:for-each>
|
|
8763
8792
|
|
|
8793
|
+
<!-- remove margin between rows in the table with sourcecode line numbers -->
|
|
8794
|
+
<xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
|
|
8795
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
|
8796
|
+
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
8797
|
+
</xsl:if>
|
|
8798
|
+
|
|
8764
8799
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
|
8765
8800
|
</fo:block>
|
|
8766
8801
|
|
|
@@ -8809,7 +8844,7 @@
|
|
|
8809
8844
|
</xsl:template>
|
|
8810
8845
|
|
|
8811
8846
|
<!-- outer table with line numbers for sourcecode -->
|
|
8812
|
-
<xsl:template match="*[local-name()='
|
|
8847
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
|
|
8813
8848
|
<fo:block>
|
|
8814
8849
|
<fo:table width="100%" table-layout="fixed">
|
|
8815
8850
|
<xsl:copy-of select="@id"/>
|
|
@@ -8821,16 +8856,16 @@
|
|
|
8821
8856
|
</fo:table>
|
|
8822
8857
|
</fo:block>
|
|
8823
8858
|
</xsl:template>
|
|
8824
|
-
<xsl:template match="*[local-name()='
|
|
8859
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
|
|
8825
8860
|
<xsl:apply-templates/>
|
|
8826
8861
|
</xsl:template>
|
|
8827
|
-
<xsl:template match="*[local-name()='
|
|
8862
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
|
|
8828
8863
|
<fo:table-row>
|
|
8829
8864
|
<xsl:apply-templates/>
|
|
8830
8865
|
</fo:table-row>
|
|
8831
8866
|
</xsl:template>
|
|
8832
8867
|
<!-- first td with line numbers -->
|
|
8833
|
-
<xsl:template match="*[local-name()='
|
|
8868
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
|
|
8834
8869
|
<fo:table-cell>
|
|
8835
8870
|
<fo:block>
|
|
8836
8871
|
|
|
@@ -8850,8 +8885,9 @@
|
|
|
8850
8885
|
</fo:block>
|
|
8851
8886
|
</fo:table-cell>
|
|
8852
8887
|
</xsl:template>
|
|
8888
|
+
|
|
8853
8889
|
<!-- second td with sourcecode -->
|
|
8854
|
-
<xsl:template match="*[local-name()='
|
|
8890
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
|
|
8855
8891
|
<fo:table-cell>
|
|
8856
8892
|
<fo:block>
|
|
8857
8893
|
<xsl:apply-templates/>
|
|
@@ -9089,7 +9125,25 @@
|
|
|
9089
9125
|
<xsl:template match="*[local-name()='pre']" name="pre">
|
|
9090
9126
|
<fo:block xsl:use-attribute-sets="pre-style">
|
|
9091
9127
|
<xsl:copy-of select="@id"/>
|
|
9092
|
-
<xsl:
|
|
9128
|
+
<xsl:choose>
|
|
9129
|
+
|
|
9130
|
+
<xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
|
|
9131
|
+
<xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
|
|
9132
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
|
9133
|
+
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
9134
|
+
</xsl:if>
|
|
9135
|
+
<fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
|
|
9136
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
|
9137
|
+
<mtext><xsl:value-of select="."/></mtext>
|
|
9138
|
+
</math>
|
|
9139
|
+
</fo:instream-foreign-object>
|
|
9140
|
+
</xsl:when>
|
|
9141
|
+
|
|
9142
|
+
<xsl:otherwise>
|
|
9143
|
+
<xsl:apply-templates/>
|
|
9144
|
+
</xsl:otherwise>
|
|
9145
|
+
|
|
9146
|
+
</xsl:choose>
|
|
9093
9147
|
</fo:block>
|
|
9094
9148
|
</xsl:template>
|
|
9095
9149
|
<!-- =============== -->
|
|
@@ -10715,8 +10769,8 @@
|
|
|
10715
10769
|
|
|
10716
10770
|
<xsl:variable name="toc_level">
|
|
10717
10771
|
<!-- https://www.metanorma.org/author/ref/document-attributes/ -->
|
|
10718
|
-
<xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = '
|
|
10719
|
-
<xsl:variable name="toclevels" select="normalize-space(//*[local-name() = '
|
|
10772
|
+
<xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
|
|
10773
|
+
<xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
|
|
10720
10774
|
<xsl:choose>
|
|
10721
10775
|
<xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
|
|
10722
10776
|
<xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
|
|
@@ -11820,6 +11874,7 @@
|
|
|
11820
11874
|
<xsl:choose>
|
|
11821
11875
|
<xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
|
|
11822
11876
|
<xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
|
|
11877
|
+
<xsl:when test="$align = 'justified'">justify</xsl:when>
|
|
11823
11878
|
<xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
|
|
11824
11879
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
|
11825
11880
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<xsl:output method="xml" encoding="UTF-8" indent="no"/>
|
|
4
4
|
|
|
5
|
-
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5
|
+
<xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure' or local-name() = 'localized-strings')] and not(ancestor::*[local-name() = 'name']))]" use="@reference"/>
|
|
6
6
|
|
|
7
7
|
<xsl:key name="attachments" match="iso:eref[java:endsWith(java:java.lang.String.new(@bibitemid),'.exp')]" use="@bibitemid"/>
|
|
8
8
|
<xsl:key name="attachments2" match="iso:eref[contains(@bibitemid,'.exp_')]" use="@bibitemid"/>
|
|
@@ -1974,12 +1974,16 @@
|
|
|
1974
1974
|
<xsl:attribute name="text-align">
|
|
1975
1975
|
<xsl:choose>
|
|
1976
1976
|
<!-- <xsl:when test="ancestor::iso:preface">justify</xsl:when> -->
|
|
1977
|
-
<xsl:when test="@align
|
|
1977
|
+
<xsl:when test="@align = 'justified'">justify</xsl:when>
|
|
1978
|
+
<xsl:when test="@align and not(@align = 'indent')"><xsl:value-of select="@align"/></xsl:when>
|
|
1978
1979
|
<xsl:when test="ancestor::iso:td/@align"><xsl:value-of select="ancestor::iso:td/@align"/></xsl:when>
|
|
1979
1980
|
<xsl:when test="ancestor::iso:th/@align"><xsl:value-of select="ancestor::iso:th/@align"/></xsl:when>
|
|
1980
1981
|
<xsl:otherwise>justify</xsl:otherwise><!-- left -->
|
|
1981
1982
|
</xsl:choose>
|
|
1982
1983
|
</xsl:attribute>
|
|
1984
|
+
<xsl:if test="@align = 'indent'">
|
|
1985
|
+
<xsl:attribute name="margin-left">7mm</xsl:attribute>
|
|
1986
|
+
</xsl:if>
|
|
1983
1987
|
<xsl:attribute name="margin-bottom">8pt</xsl:attribute>
|
|
1984
1988
|
<xsl:if test="count(ancestor::iso:li) = 1 and not(ancestor::iso:li[1]/following-sibling::iso:li) and not(following-sibling::iso:p)">
|
|
1985
1989
|
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
@@ -2326,14 +2330,14 @@
|
|
|
2326
2330
|
BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
|
|
2327
2331
|
|
|
2328
2332
|
<!--
|
|
2329
|
-
<
|
|
2333
|
+
<metanorma-extension>
|
|
2330
2334
|
<presentation-metadata>
|
|
2331
2335
|
<papersize>letter</papersize>
|
|
2332
2336
|
</presentation-metadata>
|
|
2333
|
-
</
|
|
2337
|
+
</metanorma-extension>
|
|
2334
2338
|
-->
|
|
2335
2339
|
|
|
2336
|
-
<xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2340
|
+
<xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
|
|
2337
2341
|
<xsl:variable name="papersize_width_">
|
|
2338
2342
|
<xsl:choose>
|
|
2339
2343
|
<xsl:when test="$papersize = 'letter'">215.9</xsl:when>
|
|
@@ -2454,7 +2458,7 @@
|
|
|
2454
2458
|
<xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
|
|
2455
2459
|
|
|
2456
2460
|
<xsl:variable name="title-list-tables">
|
|
2457
|
-
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2461
|
+
<xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
|
|
2458
2462
|
<xsl:value-of select="$toc_table_title"/>
|
|
2459
2463
|
<xsl:if test="normalize-space($toc_table_title) = ''">
|
|
2460
2464
|
<xsl:call-template name="getTitle">
|
|
@@ -2464,7 +2468,7 @@
|
|
|
2464
2468
|
</xsl:variable>
|
|
2465
2469
|
|
|
2466
2470
|
<xsl:variable name="title-list-figures">
|
|
2467
|
-
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2471
|
+
<xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
|
|
2468
2472
|
<xsl:value-of select="$toc_figure_title"/>
|
|
2469
2473
|
<xsl:if test="normalize-space($toc_figure_title) = ''">
|
|
2470
2474
|
<xsl:call-template name="getTitle">
|
|
@@ -2474,7 +2478,7 @@
|
|
|
2474
2478
|
</xsl:variable>
|
|
2475
2479
|
|
|
2476
2480
|
<xsl:variable name="title-list-recommendations">
|
|
2477
|
-
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
2481
|
+
<xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
|
|
2478
2482
|
<xsl:value-of select="$toc_requirement_title"/>
|
|
2479
2483
|
<xsl:if test="normalize-space($toc_requirement_title) = ''">
|
|
2480
2484
|
<xsl:call-template name="getTitle">
|
|
@@ -2546,7 +2550,7 @@
|
|
|
2546
2550
|
<xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
|
|
2547
2551
|
|
|
2548
2552
|
<xsl:variable name="additional_fonts_">
|
|
2549
|
-
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = '
|
|
2553
|
+
<xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value'] | //*[contains(local-name(), '-standard')][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
|
|
2550
2554
|
<xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
|
|
2551
2555
|
</xsl:for-each>
|
|
2552
2556
|
</xsl:variable>
|
|
@@ -3655,10 +3659,10 @@
|
|
|
3655
3659
|
|
|
3656
3660
|
<xsl:template name="processTablesFigures_Contents">
|
|
3657
3661
|
<xsl:param name="always"/>
|
|
3658
|
-
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
3662
|
+
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
|
|
3659
3663
|
<xsl:call-template name="processTables_Contents"/>
|
|
3660
3664
|
</xsl:if>
|
|
3661
|
-
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
3665
|
+
<xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
|
|
3662
3666
|
<xsl:call-template name="processFigures_Contents"/>
|
|
3663
3667
|
</xsl:if>
|
|
3664
3668
|
</xsl:template>
|
|
@@ -3966,6 +3970,9 @@
|
|
|
3966
3970
|
<xsl:if test="not(*[local-name() = 'name'])">
|
|
3967
3971
|
<xsl:attribute name="margin-top">12pt</xsl:attribute>
|
|
3968
3972
|
</xsl:if>
|
|
3973
|
+
<xsl:if test="starts-with(@id, 'array_')">
|
|
3974
|
+
<xsl:attribute name="margin-top">6pt</xsl:attribute>
|
|
3975
|
+
</xsl:if>
|
|
3969
3976
|
|
|
3970
3977
|
<!-- end table block-container attributes -->
|
|
3971
3978
|
|
|
@@ -3996,6 +4003,8 @@
|
|
|
3996
4003
|
<xsl:attribute name="border"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
|
|
3997
4004
|
</xsl:if>
|
|
3998
4005
|
|
|
4006
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4007
|
+
|
|
3999
4008
|
</xsl:element>
|
|
4000
4009
|
</xsl:variable>
|
|
4001
4010
|
|
|
@@ -4140,6 +4149,15 @@
|
|
|
4140
4149
|
|
|
4141
4150
|
</xsl:template>
|
|
4142
4151
|
|
|
4152
|
+
<xsl:template name="setBordersTableArray">
|
|
4153
|
+
|
|
4154
|
+
<xsl:if test="starts-with(@id, 'array_') or starts-with(ancestor::*[local-name() = 'table'][1]/@id, 'array_')">
|
|
4155
|
+
<!-- array - table without borders -->
|
|
4156
|
+
<xsl:attribute name="border">none</xsl:attribute>
|
|
4157
|
+
</xsl:if>
|
|
4158
|
+
|
|
4159
|
+
</xsl:template>
|
|
4160
|
+
|
|
4143
4161
|
<xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
|
|
4144
4162
|
<xsl:param name="continued"/>
|
|
4145
4163
|
<xsl:if test="normalize-space() != ''">
|
|
@@ -4642,6 +4660,8 @@
|
|
|
4642
4660
|
<fo:table-row>
|
|
4643
4661
|
<fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
|
|
4644
4662
|
|
|
4663
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4664
|
+
|
|
4645
4665
|
<!-- fn will be processed inside 'note' processing -->
|
|
4646
4666
|
|
|
4647
4667
|
<!-- for BSI (not PAS) display Notes before footnotes -->
|
|
@@ -4818,6 +4838,8 @@
|
|
|
4818
4838
|
</xsl:when>
|
|
4819
4839
|
</xsl:choose>
|
|
4820
4840
|
|
|
4841
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4842
|
+
|
|
4821
4843
|
<xsl:call-template name="setTableRowAttributes"/>
|
|
4822
4844
|
|
|
4823
4845
|
<xsl:apply-templates/>
|
|
@@ -4845,6 +4867,8 @@
|
|
|
4845
4867
|
<xsl:attribute name="border-top"><xsl:value-of select="$table-border"/></xsl:attribute>
|
|
4846
4868
|
</xsl:if>
|
|
4847
4869
|
|
|
4870
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4871
|
+
|
|
4848
4872
|
<xsl:call-template name="setTableRowAttributes"/>
|
|
4849
4873
|
<xsl:apply-templates/>
|
|
4850
4874
|
</fo:table-row>
|
|
@@ -4869,6 +4893,8 @@
|
|
|
4869
4893
|
<xsl:attribute name="border-bottom"><xsl:value-of select="$table-cell-border"/></xsl:attribute>
|
|
4870
4894
|
</xsl:if>
|
|
4871
4895
|
|
|
4896
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4897
|
+
|
|
4872
4898
|
<xsl:if test="$lang = 'ar'">
|
|
4873
4899
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
4874
4900
|
</xsl:if>
|
|
@@ -4932,6 +4958,8 @@
|
|
|
4932
4958
|
</xsl:if>
|
|
4933
4959
|
<!-- <xsl:attribute name="page-break-inside">avoid</xsl:attribute> -->
|
|
4934
4960
|
|
|
4961
|
+
<xsl:call-template name="setBordersTableArray"/>
|
|
4962
|
+
|
|
4935
4963
|
<xsl:if test=".//*[local-name() = 'table']"> <!-- if there is nested table -->
|
|
4936
4964
|
<xsl:attribute name="padding-right">1mm</xsl:attribute>
|
|
4937
4965
|
</xsl:if>
|
|
@@ -4986,7 +5014,7 @@
|
|
|
4986
5014
|
</fn>
|
|
4987
5015
|
-->
|
|
4988
5016
|
<!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
|
|
4989
|
-
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5017
|
+
<xsl:template match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))]" priority="2" name="fn">
|
|
4990
5018
|
|
|
4991
5019
|
<!-- list of footnotes to calculate actual footnotes number -->
|
|
4992
5020
|
<xsl:variable name="p_fn_">
|
|
@@ -5045,8 +5073,7 @@
|
|
|
5045
5073
|
</fo:basic-link>
|
|
5046
5074
|
</fo:inline>
|
|
5047
5075
|
</xsl:variable>
|
|
5048
|
-
|
|
5049
|
-
gen_id=<xsl:value-of select="$gen_id"/> -->
|
|
5076
|
+
|
|
5050
5077
|
<xsl:choose>
|
|
5051
5078
|
<xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
|
|
5052
5079
|
<xsl:copy-of select="$footnote_inline"/>
|
|
@@ -5101,7 +5128,7 @@
|
|
|
5101
5128
|
<!-- commented:
|
|
5102
5129
|
.//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
|
|
5103
5130
|
because 'fn' there is in biblio-tag -->
|
|
5104
|
-
<xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])
|
|
5131
|
+
<xsl:for-each select=".//*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure')] and not(ancestor::*[local-name() = 'name']))][generate-id(.)=generate-id(key('kfn',@reference)[1])]">
|
|
5105
5132
|
<!-- copy unique fn -->
|
|
5106
5133
|
<fn gen_id="{generate-id(.)}">
|
|
5107
5134
|
<xsl:copy-of select="@*"/>
|
|
@@ -7748,7 +7775,9 @@
|
|
|
7748
7775
|
|
|
7749
7776
|
<xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
|
|
7750
7777
|
<xsl:if test="number($scale) < 100">
|
|
7751
|
-
|
|
7778
|
+
|
|
7779
|
+
<xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
|
|
7780
|
+
|
|
7752
7781
|
</xsl:if>
|
|
7753
7782
|
|
|
7754
7783
|
</xsl:if>
|
|
@@ -8674,7 +8703,7 @@
|
|
|
8674
8703
|
<!-- sourcecode -->
|
|
8675
8704
|
<!-- =============== -->
|
|
8676
8705
|
|
|
8677
|
-
<xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = '
|
|
8706
|
+
<xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
|
|
8678
8707
|
<xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
|
|
8679
8708
|
<xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
|
|
8680
8709
|
|
|
@@ -8761,6 +8790,12 @@
|
|
|
8761
8790
|
</xsl:attribute>
|
|
8762
8791
|
</xsl:for-each>
|
|
8763
8792
|
|
|
8793
|
+
<!-- remove margin between rows in the table with sourcecode line numbers -->
|
|
8794
|
+
<xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
|
|
8795
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
|
8796
|
+
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
8797
|
+
</xsl:if>
|
|
8798
|
+
|
|
8764
8799
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
|
8765
8800
|
</fo:block>
|
|
8766
8801
|
|
|
@@ -8809,7 +8844,7 @@
|
|
|
8809
8844
|
</xsl:template>
|
|
8810
8845
|
|
|
8811
8846
|
<!-- outer table with line numbers for sourcecode -->
|
|
8812
|
-
<xsl:template match="*[local-name()='
|
|
8847
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
|
|
8813
8848
|
<fo:block>
|
|
8814
8849
|
<fo:table width="100%" table-layout="fixed">
|
|
8815
8850
|
<xsl:copy-of select="@id"/>
|
|
@@ -8821,16 +8856,16 @@
|
|
|
8821
8856
|
</fo:table>
|
|
8822
8857
|
</fo:block>
|
|
8823
8858
|
</xsl:template>
|
|
8824
|
-
<xsl:template match="*[local-name()='
|
|
8859
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
|
|
8825
8860
|
<xsl:apply-templates/>
|
|
8826
8861
|
</xsl:template>
|
|
8827
|
-
<xsl:template match="*[local-name()='
|
|
8862
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
|
|
8828
8863
|
<fo:table-row>
|
|
8829
8864
|
<xsl:apply-templates/>
|
|
8830
8865
|
</fo:table-row>
|
|
8831
8866
|
</xsl:template>
|
|
8832
8867
|
<!-- first td with line numbers -->
|
|
8833
|
-
<xsl:template match="*[local-name()='
|
|
8868
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
|
|
8834
8869
|
<fo:table-cell>
|
|
8835
8870
|
<fo:block>
|
|
8836
8871
|
|
|
@@ -8850,8 +8885,9 @@
|
|
|
8850
8885
|
</fo:block>
|
|
8851
8886
|
</fo:table-cell>
|
|
8852
8887
|
</xsl:template>
|
|
8888
|
+
|
|
8853
8889
|
<!-- second td with sourcecode -->
|
|
8854
|
-
<xsl:template match="*[local-name()='
|
|
8890
|
+
<xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] -->
|
|
8855
8891
|
<fo:table-cell>
|
|
8856
8892
|
<fo:block>
|
|
8857
8893
|
<xsl:apply-templates/>
|
|
@@ -9089,7 +9125,25 @@
|
|
|
9089
9125
|
<xsl:template match="*[local-name()='pre']" name="pre">
|
|
9090
9126
|
<fo:block xsl:use-attribute-sets="pre-style">
|
|
9091
9127
|
<xsl:copy-of select="@id"/>
|
|
9092
|
-
<xsl:
|
|
9128
|
+
<xsl:choose>
|
|
9129
|
+
|
|
9130
|
+
<xsl:when test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name()='td'][1][not(preceding-sibling::*)]"> <!-- pre in the first td in the table with @linenums = 'true' -->
|
|
9131
|
+
<xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
|
|
9132
|
+
<xsl:attribute name="margin-top">0pt</xsl:attribute>
|
|
9133
|
+
<xsl:attribute name="margin-bottom">0pt</xsl:attribute>
|
|
9134
|
+
</xsl:if>
|
|
9135
|
+
<fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
|
|
9136
|
+
<math xmlns="http://www.w3.org/1998/Math/MathML">
|
|
9137
|
+
<mtext><xsl:value-of select="."/></mtext>
|
|
9138
|
+
</math>
|
|
9139
|
+
</fo:instream-foreign-object>
|
|
9140
|
+
</xsl:when>
|
|
9141
|
+
|
|
9142
|
+
<xsl:otherwise>
|
|
9143
|
+
<xsl:apply-templates/>
|
|
9144
|
+
</xsl:otherwise>
|
|
9145
|
+
|
|
9146
|
+
</xsl:choose>
|
|
9093
9147
|
</fo:block>
|
|
9094
9148
|
</xsl:template>
|
|
9095
9149
|
<!-- =============== -->
|
|
@@ -10715,8 +10769,8 @@
|
|
|
10715
10769
|
|
|
10716
10770
|
<xsl:variable name="toc_level">
|
|
10717
10771
|
<!-- https://www.metanorma.org/author/ref/document-attributes/ -->
|
|
10718
|
-
<xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = '
|
|
10719
|
-
<xsl:variable name="toclevels" select="normalize-space(//*[local-name() = '
|
|
10772
|
+
<xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'HTML TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- :htmltoclevels Number of table of contents levels to render in HTML/PDF output; used to override :toclevels:-->
|
|
10773
|
+
<xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
|
|
10720
10774
|
<xsl:choose>
|
|
10721
10775
|
<xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
|
|
10722
10776
|
<xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
|
|
@@ -11820,6 +11874,7 @@
|
|
|
11820
11874
|
<xsl:choose>
|
|
11821
11875
|
<xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
|
|
11822
11876
|
<xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
|
|
11877
|
+
<xsl:when test="$align = 'justified'">justify</xsl:when>
|
|
11823
11878
|
<xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
|
|
11824
11879
|
<xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
|
|
11825
11880
|
<xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
|
|
@@ -113,11 +113,11 @@ module IsoDoc
|
|
|
113
113
|
delim = " "
|
|
114
114
|
@xrefs.anchor(container, :label)
|
|
115
115
|
# 7 a) : Clause 7 a), but Clause 7 List 1 a)
|
|
116
|
-
else
|
|
117
|
-
anchor_xref(node, container)
|
|
116
|
+
else anchor_xref(node, container)
|
|
118
117
|
end
|
|
119
118
|
|
|
120
|
-
|
|
119
|
+
ref and linkend = ref + delim + linkend
|
|
120
|
+
l10n(linkend)
|
|
121
121
|
end
|
|
122
122
|
|
|
123
123
|
def expand_citeas(text)
|
|
@@ -43,6 +43,7 @@ module IsoDoc
|
|
|
43
43
|
amd_style(docxml)
|
|
44
44
|
code_style(docxml)
|
|
45
45
|
figure_style(docxml)
|
|
46
|
+
formula_style(docxml)
|
|
46
47
|
note_style(docxml)
|
|
47
48
|
example_style(docxml)
|
|
48
49
|
dis_style_interactions(docxml)
|
|
@@ -162,6 +163,14 @@ module IsoDoc
|
|
|
162
163
|
end
|
|
163
164
|
end
|
|
164
165
|
|
|
166
|
+
def formula_style(docxml)
|
|
167
|
+
docxml.xpath("//div[@class = 'Formula']").each do |f|
|
|
168
|
+
f.xpath(".//p[not(@class)]").each do |p|
|
|
169
|
+
p["class"] = "Formula"
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
165
174
|
def code_style(doc)
|
|
166
175
|
span_style((doc.xpath("//tt//b") - doc.xpath("//tt//i//b")),
|
|
167
176
|
"ISOCodebold")
|
|
@@ -195,46 +204,13 @@ module IsoDoc
|
|
|
195
204
|
docxml
|
|
196
205
|
end
|
|
197
206
|
|
|
198
|
-
def authority_cleanup(docxml)
|
|
199
|
-
super
|
|
200
|
-
if @meta.get[:stage_int].to_s[0] == "9" ||
|
|
201
|
-
@meta.get[:stage_int].to_s[0] == "6"
|
|
202
|
-
copyright_prf(docxml)
|
|
203
|
-
else
|
|
204
|
-
copyright_dis(docxml)
|
|
205
|
-
end
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
def copyright_prf(docxml)
|
|
209
|
-
docxml.xpath("//p[@id = 'boilerplate-address']")&.each do |p|
|
|
210
|
-
p["class"] = "zzCopyright"
|
|
211
|
-
p["style"] = "text-indent:20.15pt;"
|
|
212
|
-
p.replace(to_xml(p).gsub(%r{<br/>}, "</p>\n<p class='zzCopyright' " \
|
|
213
|
-
"style='text-indent:20.15pt;'>"))
|
|
214
|
-
end
|
|
215
|
-
docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each do |p|
|
|
216
|
-
# p["class"] = "zzCopyright"
|
|
217
|
-
p.remove
|
|
218
|
-
end
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
def copyright_dis(docxml)
|
|
222
|
-
docxml.xpath("//p[@id = 'boilerplate-address']")&.each do |p|
|
|
223
|
-
p["class"] = "zzCopyright"
|
|
224
|
-
p.replace(to_xml(p).gsub(%r{<br/>}, "</p>\n<p class='zzCopyright'>"))
|
|
225
|
-
end
|
|
226
|
-
docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each do |p|
|
|
227
|
-
p.remove
|
|
228
|
-
end
|
|
229
|
-
end
|
|
230
|
-
|
|
231
207
|
def word_section_end_empty_para(docxml)
|
|
232
208
|
docxml.at("//div[@class='WordSection1']/p[last()]").remove
|
|
233
209
|
end
|
|
234
210
|
|
|
235
211
|
def word_table_cell_para(docxml)
|
|
236
212
|
docxml.xpath("//td | //th").each do |t|
|
|
237
|
-
s = t
|
|
213
|
+
s = word_table_cell_para_style(t)
|
|
238
214
|
t.delete("header")
|
|
239
215
|
if t.at("./p |./div")
|
|
240
216
|
t.xpath("./p | ./div").each { |p| p["class"] = s }
|
|
@@ -244,6 +220,12 @@ module IsoDoc
|
|
|
244
220
|
end
|
|
245
221
|
end
|
|
246
222
|
|
|
223
|
+
def word_table_cell_para_style(cell)
|
|
224
|
+
ret = cell["header"] == "true" ? "Tableheader" : "Tablebody"
|
|
225
|
+
cell["class"] == "rouge-code" and ret = "Code"
|
|
226
|
+
ret
|
|
227
|
+
end
|
|
228
|
+
|
|
247
229
|
def table_toc_class
|
|
248
230
|
["Table title", "Tabletitle", "Annex Table Title", "AnnexTableTitle"] +
|
|
249
231
|
super
|
|
@@ -3,7 +3,7 @@ require_relative "word_dis_cleanup"
|
|
|
3
3
|
module IsoDoc
|
|
4
4
|
module Iso
|
|
5
5
|
class WordDISConvert < WordConvert
|
|
6
|
-
attr_accessor :bgstripcolor
|
|
6
|
+
attr_accessor :bgstripcolor
|
|
7
7
|
|
|
8
8
|
def default_file_locations(_options)
|
|
9
9
|
{ wordstylesheet: html_doc_path("wordstyle-dis.scss"),
|
|
@@ -21,8 +21,7 @@ module IsoDoc
|
|
|
21
21
|
super
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
def init_dis(opt)
|
|
25
|
-
end
|
|
24
|
+
def init_dis(opt); end
|
|
26
25
|
|
|
27
26
|
def convert1(docxml, filename, dir)
|
|
28
27
|
update_coverpage(docxml)
|
|
@@ -48,7 +47,7 @@ module IsoDoc
|
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
def span_parse(node, out)
|
|
51
|
-
out.span
|
|
50
|
+
out.span class: node["class"] do |x|
|
|
52
51
|
node.children.each { |n| parse(n, x) }
|
|
53
52
|
end
|
|
54
53
|
end
|
|
@@ -88,7 +87,7 @@ module IsoDoc
|
|
|
88
87
|
end
|
|
89
88
|
|
|
90
89
|
def middle_title_dis(out)
|
|
91
|
-
out.p(
|
|
90
|
+
out.p(class: "zzSTDTitle") do |p|
|
|
92
91
|
p << @meta.get[:doctitleintro]
|
|
93
92
|
@meta.get[:doctitleintro] && @meta.get[:doctitlemain] and p << " — "
|
|
94
93
|
p << @meta.get[:doctitlemain]
|
|
@@ -104,7 +103,7 @@ module IsoDoc
|
|
|
104
103
|
end
|
|
105
104
|
|
|
106
105
|
def middle_title_dis_amd(para)
|
|
107
|
-
para.span(
|
|
106
|
+
para.span(style: "font-weight:normal") do |p|
|
|
108
107
|
if a = @meta.get[:doctitleamdlabel]
|
|
109
108
|
p << " #{a}"
|
|
110
109
|
a = @meta.get[:doctitleamd] and p << ": #{a}"
|
|
@@ -114,6 +113,34 @@ module IsoDoc
|
|
|
114
113
|
end
|
|
115
114
|
end
|
|
116
115
|
end
|
|
116
|
+
|
|
117
|
+
def authority_cleanup(docxml)
|
|
118
|
+
super
|
|
119
|
+
if @meta.get[:stage_int].to_s[0] == "9" ||
|
|
120
|
+
@meta.get[:stage_int].to_s[0] == "6"
|
|
121
|
+
copyright_prf(docxml)
|
|
122
|
+
else
|
|
123
|
+
copyright_dis(docxml)
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def copyright_prf(docxml)
|
|
128
|
+
docxml.xpath("//p[@id = 'boilerplate-address']")&.each do |p|
|
|
129
|
+
p["class"] = "zzCopyright"
|
|
130
|
+
p["style"] = "text-indent:20.15pt;"
|
|
131
|
+
p.replace(to_xml(p).gsub(%r{<br/>}, "</p>\n<p class='zzCopyright' " \
|
|
132
|
+
"style='text-indent:20.15pt;'>"))
|
|
133
|
+
end
|
|
134
|
+
docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each(&:remove)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def copyright_dis(docxml)
|
|
138
|
+
docxml.xpath("//p[@id = 'boilerplate-address']")&.each do |p|
|
|
139
|
+
p["class"] = "zzCopyright"
|
|
140
|
+
p.replace(to_xml(p).gsub(%r{<br/>}, "</p>\n<p class='zzCopyright'>"))
|
|
141
|
+
end
|
|
142
|
+
docxml.xpath("//p[@class = 'zzCopyrightHdr']")&.each(&:remove)
|
|
143
|
+
end
|
|
117
144
|
end
|
|
118
145
|
end
|
|
119
146
|
end
|
|
@@ -1316,7 +1316,7 @@
|
|
|
1316
1316
|
<value>commentaryOf</value>
|
|
1317
1317
|
<value>hasCommentary</value>
|
|
1318
1318
|
<value>related</value>
|
|
1319
|
-
<value>
|
|
1319
|
+
<value>hasComplement</value>
|
|
1320
1320
|
<value>complementOf</value>
|
|
1321
1321
|
<value>obsoletes</value>
|
|
1322
1322
|
<value>obsoletedBy</value>
|
|
@@ -4,14 +4,14 @@ require "htmlentities"
|
|
|
4
4
|
module Metanorma
|
|
5
5
|
module ISO
|
|
6
6
|
class Converter < Standoc::Converter
|
|
7
|
-
PRE_NORMREF_FOOTNOTES = "//preface//fn | "\
|
|
7
|
+
PRE_NORMREF_FOOTNOTES = "//preface//fn | " \
|
|
8
8
|
"//clause[@type = 'scope']//fn".freeze
|
|
9
9
|
|
|
10
10
|
NORMREF_FOOTNOTES =
|
|
11
11
|
"//references[@normative = 'true']//fn".freeze
|
|
12
12
|
|
|
13
13
|
POST_NORMREF_FOOTNOTES =
|
|
14
|
-
"//sections//clause[not(@type = 'scope')]//fn | "\
|
|
14
|
+
"//sections//clause[not(@type = 'scope')]//fn | " \
|
|
15
15
|
"//annex//fn | //references[@normative = 'false']//fn".freeze
|
|
16
16
|
|
|
17
17
|
def other_footnote_renumber(xmldoc)
|
|
@@ -33,7 +33,7 @@ module Metanorma
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def get_id_prefix(xmldoc)
|
|
36
|
-
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']"\
|
|
36
|
+
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
|
|
37
37
|
"/organization").each_with_object([]) do |x, prefix|
|
|
38
38
|
x1 = x.at("abbreviation")&.text || x.at("name")&.text
|
|
39
39
|
# (x1 == "ISO" and prefix.unshift("ISO")) or prefix << x1
|
|
@@ -60,23 +60,21 @@ module Metanorma
|
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
TERM_CLAUSE =
|
|
63
|
-
"//sections//terms | "\
|
|
63
|
+
"//sections//terms | " \
|
|
64
64
|
"//sections//clause[descendant::terms][not(descendant::definitions)]"
|
|
65
65
|
.freeze
|
|
66
66
|
|
|
67
67
|
PUBLISHER = "./contributor[role/@type = 'publisher']/organization".freeze
|
|
68
68
|
|
|
69
|
-
OTHERIDS = "@type = 'DOI' or @type = 'metanorma' or @type = 'ISSN' or "\
|
|
70
|
-
"@type = 'ISBN'".freeze
|
|
71
|
-
|
|
72
69
|
def pub_class(bib)
|
|
73
70
|
return 1 if bib.at("#{PUBLISHER}[abbreviation = 'ISO']")
|
|
74
|
-
return 1 if bib.at("#{PUBLISHER}[name = 'International Organization "\
|
|
71
|
+
return 1 if bib.at("#{PUBLISHER}[name = 'International Organization " \
|
|
75
72
|
"for Standardization']")
|
|
76
73
|
return 2 if bib.at("#{PUBLISHER}[abbreviation = 'IEC']")
|
|
77
|
-
return 2 if bib.at("#{PUBLISHER}[name = 'International "\
|
|
74
|
+
return 2 if bib.at("#{PUBLISHER}[name = 'International " \
|
|
78
75
|
"Electrotechnical Commission']")
|
|
79
|
-
return 3 if bib.at("./docidentifier[@type]
|
|
76
|
+
return 3 if bib.at("./docidentifier[@type]" \
|
|
77
|
+
"[not(#{skip_docid} or @type = 'metanorma')]") ||
|
|
80
78
|
bib.at("./docidentifier[not(@type)]")
|
|
81
79
|
|
|
82
80
|
4
|
|
@@ -99,15 +97,15 @@ module Metanorma
|
|
|
99
97
|
pubclass = pub_class(bib)
|
|
100
98
|
num = bib&.at("./docnumber")&.text
|
|
101
99
|
id = bib&.at("./docidentifier[@primary]") ||
|
|
102
|
-
bib&.at("./docidentifier[not(#{
|
|
100
|
+
bib&.at("./docidentifier[not(#{skip_docid} or @type = 'metanorma')]")
|
|
103
101
|
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
|
104
102
|
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
|
105
103
|
/\d-(?<partid>\d+)/ =~ id&.text
|
|
106
104
|
type = id["type"] if id
|
|
107
105
|
title = bib&.at("./title[@type = 'main']")&.text ||
|
|
108
106
|
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
|
|
109
|
-
"#{pubclass} :: #{type} :: "\
|
|
110
|
-
"#{num.nil? ? abbrid : sprintf('%09d', num.to_i)} :: "\
|
|
107
|
+
"#{pubclass} :: #{type} :: " \
|
|
108
|
+
"#{num.nil? ? abbrid : sprintf('%09d', num.to_i)} :: " \
|
|
111
109
|
"#{sprintf('%09d', partid.to_i)} :: #{id&.text} :: #{title}"
|
|
112
110
|
end
|
|
113
111
|
|
|
@@ -148,7 +146,7 @@ module Metanorma
|
|
|
148
146
|
end
|
|
149
147
|
|
|
150
148
|
def unpublished_note(xmldoc)
|
|
151
|
-
xmldoc.xpath("//bibitem[not(./ancestor::bibitem)]"\
|
|
149
|
+
xmldoc.xpath("//bibitem[not(./ancestor::bibitem)]" \
|
|
152
150
|
"[not(note[@type = 'Unpublished-Status'])]").each do |b|
|
|
153
151
|
next if pub_class(b) > 2
|
|
154
152
|
next unless (s = b.at("./status/stage")) && (s.text.to_i < 60)
|
|
@@ -179,7 +177,7 @@ module Metanorma
|
|
|
179
177
|
|
|
180
178
|
def replacement_standard(biblio)
|
|
181
179
|
r = biblio.at("./relation[@type = 'updates']/bibitem") or return nil
|
|
182
|
-
id = r.at("./formattedref | ./docidentifier[@primary = 'true'] | "\
|
|
180
|
+
id = r.at("./formattedref | ./docidentifier[@primary = 'true'] | " \
|
|
183
181
|
"./docidentifier | ./formattedref") or return nil
|
|
184
182
|
id.text
|
|
185
183
|
end
|
|
@@ -234,7 +232,7 @@ module Metanorma
|
|
|
234
232
|
end
|
|
235
233
|
|
|
236
234
|
def extract_publishers(xmldoc)
|
|
237
|
-
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']/"\
|
|
235
|
+
xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']/" \
|
|
238
236
|
"organization").each_with_object([]) do |p, m|
|
|
239
237
|
x = p.at("./abbreviation") || p.at("./name") or next
|
|
240
238
|
m << x.text
|
|
@@ -18,7 +18,7 @@ seriestemplate: "{% if series_formatted %}{{ series_formatted }}{%else%}{% if se
|
|
|
18
18
|
journaltemplate: "<em>{% if series_abbr %}{{series_abbr}}{% else %}{{series_title}}{% endif %}</em> ({{series_run}}) {{ labels['volume'] }}_{{series_num}} {{ labels['part'] }}_{{series_partnumber}}"
|
|
19
19
|
template:
|
|
20
20
|
# skip standardidentifier, it is inserted in front of formattedref within metanorma
|
|
21
|
-
standard: "<em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }}."
|
|
21
|
+
standard: "{% if home_standard %}<em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }}{% else %}<smallcap>{{ creatornames }}</smallcap>. <em><span_class='stddocTitle'>{{ title }}</span></em> ,_{{ extent }} . {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{labels['updated'] | capitalize }}_{{date_updated}}. {{status | capitalize}}. {{ authorizer }}. {{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>.{% endif %}"
|
|
22
22
|
website: "<smallcap>{{ creatornames }}</smallcap> ({{ role }}) . <em><span_class='stddocTitle'>{{ title }}</span></em> [website]. {{ labels['version'] | capitalize }}_{{ edition_raw }}. {{place}}: {{ publisher }}. {{date}}. {{ labels['updated'] | capitalize }}:_{{date_updated}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
|
|
23
23
|
book: "<smallcap>{{ creatornames }}</smallcap> ({{role}}) . <em>{{ title }}</em> . {{ edition | capitalize_first }}. ({{ series }}). {% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}: {{publisher}}. {{date}}. {{size}}. {{extent}}. ._{{ labels['availablefrom'] }}:_<span_class='biburl'>{{ uri }}</span>. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
|
|
24
24
|
booklet: book
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "relaton-render"
|
|
2
|
+
require_relative "parse"
|
|
2
3
|
|
|
3
4
|
module Relaton
|
|
4
5
|
module Render
|
|
@@ -7,6 +8,11 @@ module Relaton
|
|
|
7
8
|
def config_loc
|
|
8
9
|
YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
|
|
9
10
|
end
|
|
11
|
+
|
|
12
|
+
def klass_initialize(_options)
|
|
13
|
+
super
|
|
14
|
+
@parseklass = Relaton::Render::ISO::Parse
|
|
15
|
+
end
|
|
10
16
|
end
|
|
11
17
|
end
|
|
12
18
|
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Relaton
|
|
2
|
+
module Render
|
|
3
|
+
module ISO
|
|
4
|
+
class Parse < ::Relaton::Render::Parse
|
|
5
|
+
def simple_or_host_xml2hash(doc, host)
|
|
6
|
+
ret = super
|
|
7
|
+
ret.merge(home_standard: home_standard(doc, ret[:publisher_raw]))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def home_standard(_doc, pubs)
|
|
11
|
+
pubs&.any? do |r|
|
|
12
|
+
["International Organization for Standardization", "ISO",
|
|
13
|
+
"International Electrotechnical Commission", "IEC"]
|
|
14
|
+
.include?(r[:nonpersonal])
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
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: 2.3.
|
|
4
|
+
version: 2.3.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: metanorma-standoc
|
|
@@ -296,6 +296,7 @@ files:
|
|
|
296
296
|
- ".rubocop.yml"
|
|
297
297
|
- CODE_OF_CONDUCT.md
|
|
298
298
|
- Gemfile
|
|
299
|
+
- Gemfile.devel
|
|
299
300
|
- LICENSE
|
|
300
301
|
- Makefile
|
|
301
302
|
- README.adoc
|
|
@@ -395,6 +396,7 @@ files:
|
|
|
395
396
|
- lib/metanorma/requirements/requirements.rb
|
|
396
397
|
- lib/relaton/render/config.yml
|
|
397
398
|
- lib/relaton/render/general.rb
|
|
399
|
+
- lib/relaton/render/parse.rb
|
|
398
400
|
- metanorma-iso.gemspec
|
|
399
401
|
homepage: https://github.com/metanorma/metanorma-iso
|
|
400
402
|
licenses:
|