metanorma-bipm 2.1.12 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/bipm/bipm.brochure.xsl +234 -57
- data/lib/isodoc/bipm/bipm.guide.xsl +234 -57
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +234 -57
- data/lib/isodoc/bipm/bipm.rapport.xsl +234 -57
- data/lib/isodoc/bipm/doccontrol.rb +3 -3
- data/lib/isodoc/bipm/html/htmlstyle.css +6 -0
- data/lib/isodoc/bipm/index.rb +29 -18
- data/lib/isodoc/bipm/jcgm.standard.xsl +237 -60
- data/lib/isodoc/bipm/presentation_xml_convert.rb +8 -9
- data/lib/metanorma/bipm/basicdoc.rng +3 -0
- data/lib/metanorma/bipm/biblio-standoc.rng +1 -1
- data/lib/metanorma/bipm/isodoc.rng +2 -1
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +2 -2
- metadata +7 -7
@@ -1686,6 +1686,8 @@
|
|
1686
1686
|
</fo:block-container>
|
1687
1687
|
</xsl:template>
|
1688
1688
|
|
1689
|
+
<xsl:strip-space elements="jcgm:xref"/>
|
1690
|
+
|
1689
1691
|
<!-- external parameters -->
|
1690
1692
|
|
1691
1693
|
<xsl:param name="svg_images"/> <!-- svg images array -->
|
@@ -3100,17 +3102,22 @@
|
|
3100
3102
|
</xsl:for-each>
|
3101
3103
|
</xsl:template>
|
3102
3104
|
|
3105
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
3103
3106
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
|
3104
3107
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
|
3105
3108
|
<xsl:template match="text()" name="text">
|
3106
3109
|
|
3107
|
-
<xsl:
|
3108
|
-
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3110
|
+
<xsl:choose>
|
3111
|
+
<xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
|
3112
|
+
<xsl:otherwise>
|
3113
|
+
<xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_fo_inline_keep-together_within-line_open,'$1',$tag_fo_inline_keep-together_within-line_close))"/>
|
3114
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
3115
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
3116
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
3117
|
+
<xsl:with-param name="text" select="$text"/>
|
3118
|
+
</xsl:call-template>
|
3119
|
+
</xsl:otherwise>
|
3120
|
+
</xsl:choose>
|
3114
3121
|
|
3115
3122
|
</xsl:template>
|
3116
3123
|
|
@@ -3475,7 +3482,7 @@
|
|
3475
3482
|
|
3476
3483
|
<!-- centered table when table name is centered (see table-name-style) -->
|
3477
3484
|
|
3478
|
-
<fo:table table-layout="fixed" width="100%">
|
3485
|
+
<fo:table table-layout="fixed" width="100%" xsl:use-attribute-sets="table-container-style">
|
3479
3486
|
<fo:table-column column-width="proportional-column-width(1)"/>
|
3480
3487
|
<fo:table-column column-width="{@width}"/>
|
3481
3488
|
<fo:table-column column-width="proportional-column-width(1)"/>
|
@@ -3526,7 +3533,7 @@
|
|
3526
3533
|
|
3527
3534
|
<xsl:choose>
|
3528
3535
|
<xsl:when test="$continued = 'true'">
|
3529
|
-
|
3536
|
+
<!-- $namespace = 'iso' or -->
|
3530
3537
|
<xsl:apply-templates/>
|
3531
3538
|
|
3532
3539
|
</xsl:when>
|
@@ -4195,7 +4202,7 @@
|
|
4195
4202
|
<xsl:template match="*[local-name()='tr']">
|
4196
4203
|
<fo:table-row xsl:use-attribute-sets="table-body-row-style">
|
4197
4204
|
|
4198
|
-
<xsl:if test="*[local-name() = 'th']">
|
4205
|
+
<xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
|
4199
4206
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
4200
4207
|
</xsl:if>
|
4201
4208
|
|
@@ -4364,6 +4371,10 @@
|
|
4364
4371
|
<xsl:variable name="footnote_inline">
|
4365
4372
|
<fo:inline xsl:use-attribute-sets="fn-num-style">
|
4366
4373
|
|
4374
|
+
<xsl:if test="following-sibling::*[1][local-name() = 'fn']">
|
4375
|
+
<xsl:attribute name="padding-right">0.5mm</xsl:attribute>
|
4376
|
+
</xsl:if>
|
4377
|
+
|
4367
4378
|
<fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
|
4368
4379
|
<xsl:value-of select="$current_fn_number_text"/>
|
4369
4380
|
</fo:basic-link>
|
@@ -5180,7 +5191,8 @@
|
|
5180
5191
|
<xsl:copy-of select="node()"/>
|
5181
5192
|
</td>
|
5182
5193
|
<td>
|
5183
|
-
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
|
5194
|
+
<!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
|
5195
|
+
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
|
5184
5196
|
<!-- get paragraphs from nested 'dl' -->
|
5185
5197
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
|
5186
5198
|
</td>
|
@@ -5188,6 +5200,53 @@
|
|
5188
5200
|
</xsl:template>
|
5189
5201
|
<xsl:template match="*[local-name()='dd']" mode="dl_if"/>
|
5190
5202
|
|
5203
|
+
<xsl:template match="*" mode="dl_if">
|
5204
|
+
<xsl:copy-of select="."/>
|
5205
|
+
</xsl:template>
|
5206
|
+
|
5207
|
+
<xsl:template match="*[local-name() = 'p']" mode="dl_if">
|
5208
|
+
<xsl:param name="indent"/>
|
5209
|
+
<p>
|
5210
|
+
<xsl:copy-of select="@*"/>
|
5211
|
+
<xsl:value-of select="$indent"/>
|
5212
|
+
<xsl:copy-of select="node()"/>
|
5213
|
+
</p>
|
5214
|
+
|
5215
|
+
</xsl:template>
|
5216
|
+
|
5217
|
+
<xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
|
5218
|
+
<xsl:variable name="list_rendered_">
|
5219
|
+
<xsl:apply-templates select="."/>
|
5220
|
+
</xsl:variable>
|
5221
|
+
<xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
|
5222
|
+
|
5223
|
+
<xsl:variable name="indent">
|
5224
|
+
<xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
|
5225
|
+
<xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
|
5226
|
+
</xsl:for-each>
|
5227
|
+
</xsl:variable>
|
5228
|
+
|
5229
|
+
<xsl:apply-templates mode="dl_if">
|
5230
|
+
<xsl:with-param name="indent" select="$indent"/>
|
5231
|
+
</xsl:apply-templates>
|
5232
|
+
</xsl:template>
|
5233
|
+
|
5234
|
+
<xsl:template match="*[local-name() = 'li']" mode="dl_if">
|
5235
|
+
<xsl:param name="indent"/>
|
5236
|
+
<xsl:apply-templates mode="dl_if">
|
5237
|
+
<xsl:with-param name="indent" select="$indent"/>
|
5238
|
+
</xsl:apply-templates>
|
5239
|
+
</xsl:template>
|
5240
|
+
|
5241
|
+
<xsl:template match="@provisional-distance-between-starts" mode="dl_if">
|
5242
|
+
<xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
|
5243
|
+
<!-- emulate left indent for list item -->
|
5244
|
+
<xsl:call-template name="repeat">
|
5245
|
+
<xsl:with-param name="char" select="'x'"/>
|
5246
|
+
<xsl:with-param name="count" select="$value"/>
|
5247
|
+
</xsl:call-template>
|
5248
|
+
</xsl:template>
|
5249
|
+
|
5191
5250
|
<xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
|
5192
5251
|
<xsl:for-each select="*[local-name() = 'dt']">
|
5193
5252
|
<p>
|
@@ -5486,6 +5545,23 @@
|
|
5486
5545
|
<xsl:apply-templates/>
|
5487
5546
|
</xsl:template>
|
5488
5547
|
|
5548
|
+
<!-- Don't break standard's numbers -->
|
5549
|
+
<!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
|
5550
|
+
<xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
|
5551
|
+
<xsl:choose>
|
5552
|
+
<xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
|
5553
|
+
<xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
|
5554
|
+
<fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
|
5555
|
+
</xsl:when>
|
5556
|
+
<xsl:otherwise>
|
5557
|
+
<xsl:apply-templates/>
|
5558
|
+
</xsl:otherwise>
|
5559
|
+
</xsl:choose>
|
5560
|
+
</xsl:template>
|
5561
|
+
<xsl:template match="text()[not(ancestor::*[local-name() = 'table']) and preceding-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear'] and following-sibling::*[1][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']]" priority="2">
|
5562
|
+
<fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
|
5563
|
+
</xsl:template>
|
5564
|
+
|
5489
5565
|
<!-- ========================= -->
|
5490
5566
|
<!-- END Rich text formatting -->
|
5491
5567
|
<!-- ========================= -->
|
@@ -5584,6 +5660,7 @@
|
|
5584
5660
|
</word>
|
5585
5661
|
<xsl:call-template name="tokenize_with_tags">
|
5586
5662
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
5663
|
+
<xsl:with-param name="tags" select="$tags"/>
|
5587
5664
|
</xsl:call-template>
|
5588
5665
|
</xsl:otherwise>
|
5589
5666
|
</xsl:choose>
|
@@ -5623,8 +5700,18 @@
|
|
5623
5700
|
|
5624
5701
|
<xsl:template name="add-zero-spaces-java">
|
5625
5702
|
<xsl:param name="text" select="."/>
|
5626
|
-
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space
|
5627
|
-
<xsl:
|
5703
|
+
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
|
5704
|
+
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1')"/>
|
5705
|
+
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
5706
|
+
<xsl:variable name="text2" select="java:replaceAll(java:java.lang.String.new($text1), '(\u003e)(?!\u003e)', '$1')"/><!-- negative lookahead: 'great than' not followed by 'great than' -->
|
5707
|
+
<!-- add zero-width space (#x200B) before characters: 'less than' -->
|
5708
|
+
<xsl:variable name="text3" select="java:replaceAll(java:java.lang.String.new($text2), '(?<!\u003c)(\u003c)', '$1')"/> <!-- (?<!\u003c)(\u003c) --> <!-- negative lookbehind: 'less than' not preceeded by 'less than' -->
|
5709
|
+
<!-- add zero-width space (#x200B) before character: { -->
|
5710
|
+
<xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
5711
|
+
<!-- add zero-width space (#x200B) after character: , -->
|
5712
|
+
<xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
5713
|
+
|
5714
|
+
<xsl:value-of select="$text5"/>
|
5628
5715
|
</xsl:template>
|
5629
5716
|
|
5630
5717
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -5770,7 +5857,7 @@
|
|
5770
5857
|
</xsl:copy>
|
5771
5858
|
</xsl:template>
|
5772
5859
|
|
5773
|
-
<xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
|
5860
|
+
<xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p']) and not(*[local-name()='sourcecode'])]" mode="table-without-br">
|
5774
5861
|
<xsl:copy>
|
5775
5862
|
<xsl:copy-of select="@*"/>
|
5776
5863
|
<p>
|
@@ -5818,6 +5905,28 @@
|
|
5818
5905
|
</xsl:for-each>
|
5819
5906
|
</xsl:template>
|
5820
5907
|
|
5908
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
|
5909
|
+
<xsl:apply-templates mode="table-without-br"/>
|
5910
|
+
</xsl:template>
|
5911
|
+
|
5912
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., ' ') or contains(., ' ')]" mode="table-without-br">
|
5913
|
+
|
5914
|
+
<xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
|
5915
|
+
<xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'( | | )', $sep)"/>
|
5916
|
+
<xsl:variable name="items">
|
5917
|
+
<xsl:call-template name="split">
|
5918
|
+
<xsl:with-param name="pText" select="$sourcecode_text"/>
|
5919
|
+
<xsl:with-param name="sep" select="$sep"/>
|
5920
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
5921
|
+
</xsl:call-template>
|
5922
|
+
</xsl:variable>
|
5923
|
+
<xsl:for-each select="xalan:nodeset($items)/*">
|
5924
|
+
<p>
|
5925
|
+
<sourcecode><xsl:copy-of select="node()"/></sourcecode>
|
5926
|
+
</p>
|
5927
|
+
</xsl:for-each>
|
5928
|
+
</xsl:template>
|
5929
|
+
|
5821
5930
|
<!-- remove redundant white spaces -->
|
5822
5931
|
<xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
5823
5932
|
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
@@ -5848,7 +5957,7 @@
|
|
5848
5957
|
<xsl:choose>
|
5849
5958
|
<xsl:when test="@colspan">
|
5850
5959
|
<xsl:variable name="td">
|
5851
|
-
<xsl:element name="
|
5960
|
+
<xsl:element name="{local-name()}">
|
5852
5961
|
<xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
|
5853
5962
|
<xsl:if test="local-name()='th'">
|
5854
5963
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
@@ -5863,7 +5972,7 @@
|
|
5863
5972
|
</xsl:call-template>
|
5864
5973
|
</xsl:when>
|
5865
5974
|
<xsl:otherwise>
|
5866
|
-
<xsl:element name="
|
5975
|
+
<xsl:element name="{local-name()}">
|
5867
5976
|
<xsl:apply-templates select="@*" mode="simple-table-colspan"/>
|
5868
5977
|
<xsl:if test="local-name()='th'">
|
5869
5978
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
@@ -5930,7 +6039,7 @@
|
|
5930
6039
|
<xsl:variable name="currentRow" select="."/>
|
5931
6040
|
|
5932
6041
|
<xsl:variable name="normalizedTDs">
|
5933
|
-
<xsl:for-each select="xalan:nodeset($previousRow)
|
6042
|
+
<xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
|
5934
6043
|
<xsl:choose>
|
5935
6044
|
<xsl:when test="@rowspan > 1">
|
5936
6045
|
<xsl:copy>
|
@@ -5942,7 +6051,7 @@
|
|
5942
6051
|
</xsl:copy>
|
5943
6052
|
</xsl:when>
|
5944
6053
|
<xsl:otherwise>
|
5945
|
-
<xsl:copy-of select="$currentRow
|
6054
|
+
<xsl:copy-of select="$currentRow/*[self::td or self::th][1 + count(current()/preceding-sibling::*[self::td or self::th][not(@rowspan) or (@rowspan = 1)])]"/>
|
5946
6055
|
</xsl:otherwise>
|
5947
6056
|
</xsl:choose>
|
5948
6057
|
</xsl:for-each>
|
@@ -6128,6 +6237,7 @@
|
|
6128
6237
|
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
6129
6238
|
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
6130
6239
|
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
6240
|
+
<xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
|
6131
6241
|
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
6132
6242
|
</tags>
|
6133
6243
|
</xsl:template>
|
@@ -7121,6 +7231,31 @@
|
|
7121
7231
|
<xsl:apply-templates mode="svg_update"/>
|
7122
7232
|
</xsl:copy>
|
7123
7233
|
</xsl:template>
|
7234
|
+
|
7235
|
+
<!-- regex for 'display: inline-block;' -->
|
7236
|
+
<xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
|
7237
|
+
<xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
|
7238
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
|
7239
|
+
</xsl:template>
|
7240
|
+
|
7241
|
+
<!-- replace
|
7242
|
+
stroke="rgba(r, g, b, alpha)" to
|
7243
|
+
stroke="rgb(r,g,b)" stroke-opacity="alpha", and
|
7244
|
+
fill="rgba(r, g, b, alpha)" to
|
7245
|
+
fill="rgb(r,g,b)" fill-opacity="alpha" -->
|
7246
|
+
<xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
|
7247
|
+
<xsl:variable name="components_">
|
7248
|
+
<xsl:call-template name="split">
|
7249
|
+
<xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
|
7250
|
+
<xsl:with-param name="sep" select="','"/>
|
7251
|
+
</xsl:call-template>
|
7252
|
+
</xsl:variable>
|
7253
|
+
<xsl:variable name="components" select="xalan:nodeset($components_)"/>
|
7254
|
+
<xsl:variable name="att_name" select="local-name()"/>
|
7255
|
+
<xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
|
7256
|
+
<xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
|
7257
|
+
</xsl:template>
|
7258
|
+
|
7124
7259
|
<!-- ============== -->
|
7125
7260
|
<!-- END: svg_update -->
|
7126
7261
|
<!-- ============== -->
|
@@ -7759,38 +7894,16 @@
|
|
7759
7894
|
<!-- =============== -->
|
7760
7895
|
<xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
7761
7896
|
|
7762
|
-
<
|
7763
|
-
|
7764
|
-
|
7765
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7766
|
-
</xsl:if>
|
7767
|
-
|
7768
|
-
<xsl:if test="ancestor::*[local-name() = 'example']">
|
7769
|
-
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7770
|
-
</xsl:if>
|
7771
|
-
|
7772
|
-
<xsl:copy-of select="@id"/>
|
7773
|
-
|
7774
|
-
<xsl:if test="parent::*[local-name() = 'note']">
|
7775
|
-
<xsl:attribute name="margin-left">
|
7776
|
-
<xsl:choose>
|
7777
|
-
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
|
7778
|
-
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
|
7779
|
-
</xsl:choose>
|
7780
|
-
</xsl:attribute>
|
7781
|
-
|
7782
|
-
</xsl:if>
|
7783
|
-
<fo:block-container margin-left="0mm">
|
7784
|
-
|
7785
|
-
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
7786
|
-
<xsl:variable name="_font-size">
|
7897
|
+
<xsl:variable name="sourcecode_attributes">
|
7898
|
+
<xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
|
7899
|
+
<xsl:variable name="_font-size">
|
7787
7900
|
|
7788
|
-
|
7901
|
+
<!-- 9 -->
|
7789
7902
|
|
7790
|
-
|
7791
|
-
|
7792
|
-
|
7793
|
-
|
7903
|
+
9
|
7904
|
+
<!-- <xsl:if test="$namespace = 'ieee'">
|
7905
|
+
<xsl:if test="$current_template = 'standard'">8</xsl:if>
|
7906
|
+
</xsl:if> -->
|
7794
7907
|
|
7795
7908
|
</xsl:variable>
|
7796
7909
|
|
@@ -7805,14 +7918,60 @@
|
|
7805
7918
|
</xsl:choose>
|
7806
7919
|
</xsl:attribute>
|
7807
7920
|
</xsl:if>
|
7921
|
+
</xsl:element>
|
7922
|
+
</xsl:variable>
|
7808
7923
|
|
7924
|
+
<xsl:choose>
|
7925
|
+
<xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
|
7926
|
+
<xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
|
7927
|
+
<xsl:attribute name="{local-name()}">
|
7928
|
+
<xsl:value-of select="."/>
|
7929
|
+
</xsl:attribute>
|
7930
|
+
</xsl:for-each>
|
7809
7931
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
7810
|
-
</
|
7932
|
+
</xsl:when>
|
7933
|
+
|
7934
|
+
<xsl:otherwise>
|
7935
|
+
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
7811
7936
|
|
7812
|
-
<xsl:
|
7937
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
7938
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
7939
|
+
</xsl:if>
|
7813
7940
|
|
7814
|
-
|
7815
|
-
|
7941
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
7942
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
7943
|
+
</xsl:if>
|
7944
|
+
|
7945
|
+
<xsl:copy-of select="@id"/>
|
7946
|
+
|
7947
|
+
<xsl:if test="parent::*[local-name() = 'note']">
|
7948
|
+
<xsl:attribute name="margin-left">
|
7949
|
+
<xsl:choose>
|
7950
|
+
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
|
7951
|
+
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
|
7952
|
+
</xsl:choose>
|
7953
|
+
</xsl:attribute>
|
7954
|
+
|
7955
|
+
</xsl:if>
|
7956
|
+
<fo:block-container margin-left="0mm">
|
7957
|
+
|
7958
|
+
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
7959
|
+
|
7960
|
+
<xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
|
7961
|
+
<xsl:attribute name="{local-name()}">
|
7962
|
+
<xsl:value-of select="."/>
|
7963
|
+
</xsl:attribute>
|
7964
|
+
</xsl:for-each>
|
7965
|
+
|
7966
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
7967
|
+
</fo:block>
|
7968
|
+
|
7969
|
+
<xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
|
7970
|
+
|
7971
|
+
</fo:block-container>
|
7972
|
+
</fo:block-container>
|
7973
|
+
</xsl:otherwise>
|
7974
|
+
</xsl:choose>
|
7816
7975
|
</xsl:template>
|
7817
7976
|
|
7818
7977
|
<xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -10043,7 +10202,11 @@
|
|
10043
10202
|
<!-- ===================================== -->
|
10044
10203
|
<!-- Update xml -->
|
10045
10204
|
<!-- ===================================== -->
|
10046
|
-
<!--
|
10205
|
+
<!-- =========================================================================== -->
|
10206
|
+
<!-- STEP1: -->
|
10207
|
+
<!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
|
10208
|
+
<!-- - Ignore 'span' without style -->
|
10209
|
+
<!-- =========================================================================== -->
|
10047
10210
|
<xsl:template match="@*|node()" mode="update_xml_step1">
|
10048
10211
|
<xsl:copy>
|
10049
10212
|
<xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
|
@@ -10125,7 +10288,8 @@
|
|
10125
10288
|
</xsl:copy>
|
10126
10289
|
</xsl:template>
|
10127
10290
|
|
10128
|
-
|
10291
|
+
<!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
|
10292
|
+
<xsl:template match="*[local-name() = 'span'][@style or @class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" mode="update_xml_step1" priority="2">
|
10129
10293
|
<xsl:copy>
|
10130
10294
|
<xsl:copy-of select="@*"/>
|
10131
10295
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -10135,10 +10299,15 @@
|
|
10135
10299
|
<xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
10136
10300
|
<xsl:apply-templates mode="update_xml_step1"/>
|
10137
10301
|
</xsl:template>
|
10138
|
-
|
10302
|
+
<!-- =========================================================================== -->
|
10139
10303
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
10304
|
+
<!-- =========================================================================== -->
|
10140
10305
|
|
10306
|
+
<!-- =========================================================================== -->
|
10141
10307
|
<!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
10308
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
10309
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
10310
|
+
<!-- =========================================================================== -->
|
10142
10311
|
<!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
|
10143
10312
|
<xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
10144
10313
|
<xsl:copy>
|
@@ -10154,10 +10323,15 @@
|
|
10154
10323
|
<xsl:template match="text()[not(ancestor::*[local-name() = 'bibdata'] or ancestor::*[local-name() = 'link'][not(contains(.,' '))] or ancestor::*[local-name() = 'sourcecode'] or ancestor::*[local-name() = 'math'] or starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.') )]" name="keep_together_standard_number" mode="update_xml_enclose_keep-together_within-line">
|
10155
10324
|
|
10156
10325
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
10157
|
-
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
10158
10326
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
10159
10327
|
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
10160
|
-
<xsl:variable name="
|
10328
|
+
<xsl:variable name="text__" select="java:replaceAll(java:java.lang.String.new(.), $regex_standard_reference, concat($tag_keep-together_within-line_open,'$1',$tag_keep-together_within-line_close))"/>
|
10329
|
+
<xsl:variable name="text_">
|
10330
|
+
<xsl:choose>
|
10331
|
+
<xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when> <!-- no need enclose standard's number into tag 'keep-together_within-line' in table cells -->
|
10332
|
+
<xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
|
10333
|
+
</xsl:choose>
|
10334
|
+
</xsl:variable>
|
10161
10335
|
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
10162
10336
|
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
10163
10337
|
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
@@ -10173,7 +10347,11 @@
|
|
10173
10347
|
</xsl:variable>
|
10174
10348
|
|
10175
10349
|
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
10176
|
-
|
10350
|
+
<!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
|
10351
|
+
<!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
|
10352
|
+
<!-- add < and > to \S -->
|
10353
|
+
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>]</xsl:variable>
|
10354
|
+
<xsl:variable name="regex_solidus_units">((\b((<xsl:value-of select="$regex_S"/>{1,3}\/<xsl:value-of select="$regex_S"/>+)|(<xsl:value-of select="$regex_S"/>+\/<xsl:value-of select="$regex_S"/>{1,3}))\b)|(\/<xsl:value-of select="$regex_S"/>{1,3})\b)</xsl:variable>
|
10177
10355
|
<xsl:variable name="text3">
|
10178
10356
|
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
10179
10357
|
<xsl:choose>
|
@@ -10237,9 +10415,8 @@
|
|
10237
10415
|
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
10238
10416
|
</xsl:choose>
|
10239
10417
|
</xsl:template>
|
10240
|
-
|
10241
10418
|
<!-- ===================================== -->
|
10242
|
-
<!--
|
10419
|
+
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
10243
10420
|
<!-- ===================================== -->
|
10244
10421
|
|
10245
10422
|
<!-- for correct rendering combining chars -->
|
@@ -9,7 +9,7 @@ module IsoDoc
|
|
9
9
|
module BIPM
|
10
10
|
class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
|
11
11
|
def convert1(docxml, filename, dir)
|
12
|
-
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
|
12
|
+
@jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/" \
|
13
13
|
"@acronym"))&.value == "JCGM"
|
14
14
|
@iso = IsoDoc::Iso::PresentationXMLConvert
|
15
15
|
.new({ language: @lang, script: @script })
|
@@ -18,9 +18,8 @@ module IsoDoc
|
|
18
18
|
super
|
19
19
|
end
|
20
20
|
|
21
|
-
def eref_localities1(
|
22
|
-
@jcgm and return @iso.eref_localities1(
|
23
|
-
node, lang)
|
21
|
+
def eref_localities1(opt)
|
22
|
+
@jcgm and return @iso.eref_localities1(opt)
|
24
23
|
super
|
25
24
|
end
|
26
25
|
|
@@ -46,7 +45,7 @@ module IsoDoc
|
|
46
45
|
|
47
46
|
lbl = @xrefs.anchor(elem["id"], :label)
|
48
47
|
t = elem.at(ns("./title")) and
|
49
|
-
t.children = "<strong>#{t.children
|
48
|
+
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
50
49
|
prefix_name(elem, ".<tab/>", lbl, "title")
|
51
50
|
end
|
52
51
|
|
@@ -118,7 +117,7 @@ module IsoDoc
|
|
118
117
|
end
|
119
118
|
|
120
119
|
def bibdata_titles(bibdata)
|
121
|
-
return unless app = bibdata.at(ns("//bibdata/ext/"\
|
120
|
+
return unless app = bibdata.at(ns("//bibdata/ext/" \
|
122
121
|
"structuredidentifier/part"))
|
123
122
|
|
124
123
|
bibdata.xpath(ns("//bibdata/title[@type = 'part']")).each do |t|
|
@@ -126,7 +125,7 @@ module IsoDoc
|
|
126
125
|
t["type"] = "part-with-numbering"
|
127
126
|
part = t["language"] == "en" ? "Part" : "Partie"
|
128
127
|
# not looking up in YAML
|
129
|
-
t.children = l10n("#{part} #{app.text}: #{t.children
|
128
|
+
t.children = l10n("#{part} #{app.text}: #{to_xml(t.children)}",
|
130
129
|
t["language"])
|
131
130
|
end
|
132
131
|
end
|
@@ -204,9 +203,9 @@ module IsoDoc
|
|
204
203
|
|
205
204
|
def termsource1(elem)
|
206
205
|
while elem&.next_element&.name == "termsource"
|
207
|
-
elem << "; #{elem.next_element.remove.children
|
206
|
+
elem << "; #{to_xml(elem.next_element.remove.children)}"
|
208
207
|
end
|
209
|
-
elem.children = l10n("[#{@i18n.source} #{elem.children.
|
208
|
+
elem.children = l10n("[#{@i18n.source} #{to_xml(elem.children).strip}]")
|
210
209
|
end
|
211
210
|
|
212
211
|
include Init
|
@@ -1152,7 +1152,7 @@
|
|
1152
1152
|
<data type="boolean"/>
|
1153
1153
|
</attribute>
|
1154
1154
|
</optional>
|
1155
|
-
<ref name="
|
1155
|
+
<ref name="ReducedBibliographicItem"/>
|
1156
1156
|
</element>
|
1157
1157
|
</define>
|
1158
1158
|
<define name="image" combine="choice">
|
@@ -2653,6 +2653,7 @@
|
|
2653
2653
|
<value>full</value>
|
2654
2654
|
<value>short</value>
|
2655
2655
|
<value>id</value>
|
2656
|
+
<value>modspec</value>
|
2656
2657
|
</choice>
|
2657
2658
|
</define>
|
2658
2659
|
<define name="erefTypeWithConnective">
|
data/metanorma-bipm.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.require_paths = ["lib"]
|
28
28
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
29
29
|
|
30
|
-
spec.add_dependency "metanorma-generic", "~> 2.
|
31
|
-
spec.add_dependency "metanorma-iso", "~> 2.
|
30
|
+
spec.add_dependency "metanorma-generic", "~> 2.3.0"
|
31
|
+
spec.add_dependency "metanorma-iso", "~> 2.3.0"
|
32
32
|
|
33
33
|
spec.add_development_dependency "debug"
|
34
34
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|