metanorma-bipm 2.2.1 → 2.2.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.
@@ -4,7 +4,7 @@
4
4
 
5
5
  <xsl:param name="align-cross-elements"/>
6
6
 
7
- <xsl:key name="kfn" match="*[local-name() = 'fn'][not(ancestor::*[(local-name() = 'table' or local-name() = 'figure') and not(ancestor::*[local-name() = 'name'])])]" use="@reference"/>
7
+ <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"/>
8
8
 
9
9
  <xsl:variable name="align_cross_elements_default">clause</xsl:variable>
10
10
  <xsl:variable name="align_cross_elements_doc">
@@ -1750,14 +1750,14 @@
1750
1750
  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 -->
1751
1751
 
1752
1752
  <!--
1753
- <misc-container>
1753
+ <metanorma-extension>
1754
1754
  <presentation-metadata>
1755
1755
  <papersize>letter</papersize>
1756
1756
  </presentation-metadata>
1757
- </misc-container>
1757
+ </metanorma-extension>
1758
1758
  -->
1759
1759
 
1760
- <xsl:variable name="papersize" select="java:toLowerCase(java:java.lang.String.new(normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata']/*[local-name() = 'papersize'])))"/>
1760
+ <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'])))"/>
1761
1761
  <xsl:variable name="papersize_width_">
1762
1762
  <xsl:choose>
1763
1763
  <xsl:when test="$papersize = 'letter'">215.9</xsl:when>
@@ -1872,7 +1872,7 @@
1872
1872
  <xsl:variable name="titles" select="xalan:nodeset($titles_)"/>
1873
1873
 
1874
1874
  <xsl:variable name="title-list-tables">
1875
- <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1875
+ <xsl:variable name="toc_table_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']"/>
1876
1876
  <xsl:value-of select="$toc_table_title"/>
1877
1877
  <xsl:if test="normalize-space($toc_table_title) = ''">
1878
1878
  <xsl:call-template name="getTitle">
@@ -1882,7 +1882,7 @@
1882
1882
  </xsl:variable>
1883
1883
 
1884
1884
  <xsl:variable name="title-list-figures">
1885
- <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1885
+ <xsl:variable name="toc_figure_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']"/>
1886
1886
  <xsl:value-of select="$toc_figure_title"/>
1887
1887
  <xsl:if test="normalize-space($toc_figure_title) = ''">
1888
1888
  <xsl:call-template name="getTitle">
@@ -1892,7 +1892,7 @@
1892
1892
  </xsl:variable>
1893
1893
 
1894
1894
  <xsl:variable name="title-list-recommendations">
1895
- <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1895
+ <xsl:variable name="toc_requirement_title" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='requirement']/*[local-name() = 'title']"/>
1896
1896
  <xsl:value-of select="$toc_requirement_title"/>
1897
1897
  <xsl:if test="normalize-space($toc_requirement_title) = ''">
1898
1898
  <xsl:call-template name="getTitle">
@@ -1964,7 +1964,7 @@
1964
1964
  <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1965
1965
 
1966
1966
  <xsl:variable name="additional_fonts_">
1967
- <xsl:for-each select="//*[contains(local-name(), '-standard')][1]/*[local-name() = 'misc-container']/*[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']">
1967
+ <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']">
1968
1968
  <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1969
1969
  </xsl:for-each>
1970
1970
  </xsl:variable>
@@ -3055,10 +3055,10 @@
3055
3055
 
3056
3056
  <xsl:template name="processTablesFigures_Contents">
3057
3057
  <xsl:param name="always"/>
3058
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3058
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='table']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3059
3059
  <xsl:call-template name="processTables_Contents"/>
3060
3060
  </xsl:if>
3061
- <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3061
+ <xsl:if test="(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'toc'][@type='figure']/*[local-name() = 'title']) or normalize-space($always) = 'true'">
3062
3062
  <xsl:call-template name="processFigures_Contents"/>
3063
3063
  </xsl:if>
3064
3064
  </xsl:template>
@@ -3383,6 +3383,8 @@
3383
3383
 
3384
3384
  <xsl:attribute name="width"><xsl:value-of select="normalize-space($table_width)"/></xsl:attribute>
3385
3385
 
3386
+ <xsl:call-template name="setBordersTableArray"/>
3387
+
3386
3388
  <xsl:if test="*[local-name()='thead']">
3387
3389
  <xsl:attribute name="border-top">1pt solid black</xsl:attribute>
3388
3390
  </xsl:if>
@@ -3531,6 +3533,10 @@
3531
3533
 
3532
3534
  </xsl:template>
3533
3535
 
3536
+ <xsl:template name="setBordersTableArray">
3537
+
3538
+ </xsl:template>
3539
+
3534
3540
  <xsl:template match="*[local-name()='table']/*[local-name() = 'name']">
3535
3541
  <xsl:param name="continued"/>
3536
3542
  <xsl:if test="normalize-space() != ''">
@@ -4020,6 +4026,8 @@
4020
4026
  <fo:table-row>
4021
4027
  <fo:table-cell xsl:use-attribute-sets="table-footer-cell-style" number-columns-spanned="{$cols-count}">
4022
4028
 
4029
+ <xsl:call-template name="setBordersTableArray"/>
4030
+
4023
4031
  <!-- fn will be processed inside 'note' processing -->
4024
4032
 
4025
4033
  <!-- for BSI (not PAS) display Notes before footnotes -->
@@ -4182,6 +4190,8 @@
4182
4190
  <xsl:template match="*[local-name()='thead']/*[local-name()='tr']" priority="2">
4183
4191
  <fo:table-row xsl:use-attribute-sets="table-header-row-style">
4184
4192
 
4193
+ <xsl:call-template name="setBordersTableArray"/>
4194
+
4185
4195
  <xsl:choose>
4186
4196
  <xsl:when test="position() = 1">
4187
4197
  <xsl:attribute name="border-top">solid black 1.5pt</xsl:attribute>
@@ -4216,6 +4226,8 @@
4216
4226
  <xsl:attribute name="keep-with-next">always</xsl:attribute>
4217
4227
  </xsl:if>
4218
4228
 
4229
+ <xsl:call-template name="setBordersTableArray"/>
4230
+
4219
4231
  <xsl:call-template name="setTableRowAttributes"/>
4220
4232
  <xsl:apply-templates/>
4221
4233
  </fo:table-row>
@@ -4235,6 +4247,8 @@
4235
4247
  <xsl:with-param name="default">center</xsl:with-param>
4236
4248
  </xsl:call-template>
4237
4249
 
4250
+ <xsl:call-template name="setBordersTableArray"/>
4251
+
4238
4252
  <xsl:if test="$lang = 'ar'">
4239
4253
  <xsl:attribute name="padding-right">1mm</xsl:attribute>
4240
4254
  </xsl:if>
@@ -4287,6 +4301,8 @@
4287
4301
 
4288
4302
  <!-- bsi -->
4289
4303
 
4304
+ <xsl:call-template name="setBordersTableArray"/>
4305
+
4290
4306
  <xsl:if test="count(*) = 1 and (local-name(*[1]) = 'stem' or local-name(*[1]) = 'figure')">
4291
4307
  <xsl:attribute name="padding-left">0mm</xsl:attribute>
4292
4308
  </xsl:if>
@@ -4348,7 +4364,7 @@
4348
4364
  </fn>
4349
4365
  -->
4350
4366
  <!-- footnotes in text (title, bibliography, main body, table's, figure's names), not for tables, figures -->
4351
- <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">
4367
+ <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">
4352
4368
 
4353
4369
  <!-- list of footnotes to calculate actual footnotes number -->
4354
4370
  <xsl:variable name="p_fn_">
@@ -4405,8 +4421,7 @@
4405
4421
  </fo:basic-link>
4406
4422
  </fo:inline>
4407
4423
  </xsl:variable>
4408
- <!-- DEBUG: p_fn=<xsl:copy-of select="$p_fn"/>
4409
- gen_id=<xsl:value-of select="$gen_id"/> -->
4424
+
4410
4425
  <xsl:choose>
4411
4426
  <xsl:when test="normalize-space(@skip_footnote_body) = 'true'">
4412
4427
  <xsl:copy-of select="$footnote_inline"/>
@@ -4461,7 +4476,7 @@
4461
4476
  <!-- commented:
4462
4477
  .//*[local-name() = 'bibitem'][ancestor::*[local-name() = 'references']]/*[local-name() = 'note'] |
4463
4478
  because 'fn' there is in biblio-tag -->
4464
- <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])]">
4479
+ <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])]">
4465
4480
  <!-- copy unique fn -->
4466
4481
  <fn gen_id="{generate-id(.)}">
4467
4482
  <xsl:copy-of select="@*"/>
@@ -7028,7 +7043,9 @@
7028
7043
 
7029
7044
  <xsl:variable name="scale" select="java:org.metanorma.fop.Util.getImageScale($img_src, $width_effective, $height_effective)"/>
7030
7045
  <xsl:if test="number($scale) &lt; 100">
7031
- <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7046
+
7047
+ <xsl:attribute name="content-width"><xsl:value-of select="$scale"/>%</xsl:attribute>
7048
+
7032
7049
  </xsl:if>
7033
7050
 
7034
7051
  </xsl:if>
@@ -7954,7 +7971,7 @@
7954
7971
  <!-- sourcecode -->
7955
7972
  <!-- =============== -->
7956
7973
 
7957
- <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'misc-container']/*[local-name() = 'source-highlighter-css']"/>
7974
+ <xsl:variable name="source-highlighter-css_" select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'source-highlighter-css']"/>
7958
7975
  <xsl:variable name="sourcecode_css_" select="java:org.metanorma.fop.Util.parseCSS($source-highlighter-css_)"/>
7959
7976
  <xsl:variable name="sourcecode_css" select="xalan:nodeset($sourcecode_css_)"/>
7960
7977
 
@@ -8042,6 +8059,12 @@
8042
8059
  </xsl:attribute>
8043
8060
  </xsl:for-each>
8044
8061
 
8062
+ <!-- remove margin between rows in the table with sourcecode line numbers -->
8063
+ <xsl:if test="ancestor::*[local-name() = 'sourcecode'][@linenums = 'true'] and ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']">
8064
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8065
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8066
+ </xsl:if>
8067
+
8045
8068
  <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8046
8069
  </fo:block>
8047
8070
 
@@ -8090,7 +8113,7 @@
8090
8113
  </xsl:template>
8091
8114
 
8092
8115
  <!-- outer table with line numbers for sourcecode -->
8093
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']" priority="2">
8116
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode'] | -->
8094
8117
  <fo:block>
8095
8118
  <fo:table width="100%" table-layout="fixed">
8096
8119
  <xsl:copy-of select="@id"/>
@@ -8102,16 +8125,16 @@
8102
8125
  </fo:table>
8103
8126
  </fo:block>
8104
8127
  </xsl:template>
8105
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody']" priority="2">
8128
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']/*[local-name() = 'tbody']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']/*[local-name() = 'tbody'] | -->
8106
8129
  <xsl:apply-templates/>
8107
8130
  </xsl:template>
8108
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']" priority="2">
8131
+ <xsl:template match="*[local-name() = 'sourcecode'][@linenums = 'true']/*[local-name()='table']//*[local-name()='tr']" priority="2"> <!-- *[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr'] | -->
8109
8132
  <fo:table-row>
8110
8133
  <xsl:apply-templates/>
8111
8134
  </fo:table-row>
8112
8135
  </xsl:template>
8113
8136
  <!-- first td with line numbers -->
8114
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][not(preceding-sibling::*)]" priority="2">
8137
+ <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'] -->
8115
8138
  <fo:table-cell>
8116
8139
  <fo:block>
8117
8140
 
@@ -8131,8 +8154,9 @@
8131
8154
  </fo:block>
8132
8155
  </fo:table-cell>
8133
8156
  </xsl:template>
8157
+
8134
8158
  <!-- second td with sourcecode -->
8135
- <xsl:template match="*[local-name()='table'][@type = 'sourcecode']//*[local-name()='tr']/*[local-name()='td'][preceding-sibling::*]" priority="2">
8159
+ <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'] -->
8136
8160
  <fo:table-cell>
8137
8161
  <fo:block>
8138
8162
  <xsl:apply-templates/>
@@ -8370,7 +8394,25 @@
8370
8394
  <xsl:template match="*[local-name()='pre']" name="pre">
8371
8395
  <fo:block xsl:use-attribute-sets="pre-style">
8372
8396
  <xsl:copy-of select="@id"/>
8373
- <xsl:apply-templates/>
8397
+ <xsl:choose>
8398
+
8399
+ <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' -->
8400
+ <xsl:if test="ancestor::*[local-name() = 'tr'][1]/following-sibling::*[local-name() = 'tr']"> <!-- is current tr isn't last -->
8401
+ <xsl:attribute name="margin-top">0pt</xsl:attribute>
8402
+ <xsl:attribute name="margin-bottom">0pt</xsl:attribute>
8403
+ </xsl:if>
8404
+ <fo:instream-foreign-object fox:alt-text="{.}" content-width="95%">
8405
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
8406
+ <mtext><xsl:value-of select="."/></mtext>
8407
+ </math>
8408
+ </fo:instream-foreign-object>
8409
+ </xsl:when>
8410
+
8411
+ <xsl:otherwise>
8412
+ <xsl:apply-templates/>
8413
+ </xsl:otherwise>
8414
+
8415
+ </xsl:choose>
8374
8416
  </fo:block>
8375
8417
  </xsl:template>
8376
8418
  <!-- =============== -->
@@ -10006,8 +10048,8 @@
10006
10048
 
10007
10049
  <xsl:variable name="toc_level">
10008
10050
  <!-- https://www.metanorma.org/author/ref/document-attributes/ -->
10009
- <xsl:variable name="htmltoclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[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:-->
10010
- <xsl:variable name="toclevels" select="normalize-space(//*[local-name() = 'misc-container']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name']/text() = 'TOC Heading Levels']/*[local-name() = 'value'])"/> <!-- Number of table of contents levels to render -->
10051
+ <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:-->
10052
+ <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 -->
10011
10053
  <xsl:choose>
10012
10054
  <xsl:when test="$htmltoclevels != ''"><xsl:value-of select="number($htmltoclevels)"/></xsl:when> <!-- if there is value in xml -->
10013
10055
  <xsl:when test="$toclevels != ''"><xsl:value-of select="number($toclevels)"/></xsl:when> <!-- if there is value in xml -->
@@ -11001,6 +11043,7 @@
11001
11043
  <xsl:choose>
11002
11044
  <xsl:when test="$lang = 'ar' and $align = 'left'">start</xsl:when>
11003
11045
  <xsl:when test="$lang = 'ar' and $align = 'right'">end</xsl:when>
11046
+ <xsl:when test="$align = 'justified'">justify</xsl:when>
11004
11047
  <xsl:when test="$align != '' and not($align = 'indent')"><xsl:value-of select="$align"/></xsl:when>
11005
11048
  <xsl:when test="ancestor::*[local-name() = 'td']/@align"><xsl:value-of select="ancestor::*[local-name() = 'td']/@align"/></xsl:when>
11006
11049
  <xsl:when test="ancestor::*[local-name() = 'th']/@align"><xsl:value-of select="ancestor::*[local-name() = 'th']/@align"/></xsl:when>
@@ -1316,7 +1316,7 @@
1316
1316
  <value>commentaryOf</value>
1317
1317
  <value>hasCommentary</value>
1318
1318
  <value>related</value>
1319
- <value>complements</value>
1319
+ <value>hasComplement</value>
1320
1320
  <value>complementOf</value>
1321
1321
  <value>obsoletes</value>
1322
1322
  <value>obsoletedBy</value>
@@ -1580,7 +1580,7 @@
1580
1580
  </element>
1581
1581
  </define>
1582
1582
  <define name="misccontainer">
1583
- <element name="misc-container">
1583
+ <element name="metanorma-extension">
1584
1584
  <oneOrMore>
1585
1585
  <ref name="AnyElement"/>
1586
1586
  </oneOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.2.1".freeze
3
+ VERSION = "2.2.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-19 00:00:00.000000000 Z
11
+ date: 2023-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic