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
@@ -3798,6 +3798,8 @@
|
|
3798
3798
|
</xsl:if>
|
3799
3799
|
</xsl:template>
|
3800
3800
|
|
3801
|
+
<xsl:strip-space elements="bipm:xref"/>
|
3802
|
+
|
3801
3803
|
<!-- external parameters -->
|
3802
3804
|
|
3803
3805
|
<xsl:param name="svg_images"/> <!-- svg images array -->
|
@@ -5193,17 +5195,22 @@
|
|
5193
5195
|
</xsl:for-each>
|
5194
5196
|
</xsl:template>
|
5195
5197
|
|
5198
|
+
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
5196
5199
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
|
5197
5200
|
<xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
|
5198
5201
|
<xsl:template match="text()" name="text">
|
5199
5202
|
|
5200
|
-
<xsl:
|
5201
|
-
|
5202
|
-
|
5203
|
-
|
5204
|
-
|
5205
|
-
|
5206
|
-
|
5203
|
+
<xsl:choose>
|
5204
|
+
<xsl:when test="ancestor::*[local-name() = 'table']"><xsl:value-of select="."/></xsl:when>
|
5205
|
+
<xsl:otherwise>
|
5206
|
+
<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))"/>
|
5207
|
+
<xsl:call-template name="replace_fo_inline_tags">
|
5208
|
+
<xsl:with-param name="tag_open" select="$tag_fo_inline_keep-together_within-line_open"/>
|
5209
|
+
<xsl:with-param name="tag_close" select="$tag_fo_inline_keep-together_within-line_close"/>
|
5210
|
+
<xsl:with-param name="text" select="$text"/>
|
5211
|
+
</xsl:call-template>
|
5212
|
+
</xsl:otherwise>
|
5213
|
+
</xsl:choose>
|
5207
5214
|
|
5208
5215
|
</xsl:template>
|
5209
5216
|
|
@@ -6272,7 +6279,7 @@
|
|
6272
6279
|
<xsl:template match="*[local-name()='tr']">
|
6273
6280
|
<fo:table-row xsl:use-attribute-sets="table-body-row-style">
|
6274
6281
|
|
6275
|
-
<xsl:if test="*[local-name() = 'th']">
|
6282
|
+
<xsl:if test="count(*) = count(*[local-name() = 'th'])"> <!-- row contains 'th' only -->
|
6276
6283
|
<xsl:attribute name="keep-with-next">always</xsl:attribute>
|
6277
6284
|
</xsl:if>
|
6278
6285
|
|
@@ -6485,6 +6492,10 @@
|
|
6485
6492
|
<xsl:variable name="footnote_inline">
|
6486
6493
|
<fo:inline xsl:use-attribute-sets="fn-num-style">
|
6487
6494
|
|
6495
|
+
<xsl:if test="following-sibling::*[1][local-name() = 'fn']">
|
6496
|
+
<xsl:attribute name="padding-right">0.5mm</xsl:attribute>
|
6497
|
+
</xsl:if>
|
6498
|
+
|
6488
6499
|
<fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}">
|
6489
6500
|
<xsl:value-of select="$current_fn_number_text"/>
|
6490
6501
|
</fo:basic-link>
|
@@ -7291,7 +7302,8 @@
|
|
7291
7302
|
<xsl:copy-of select="node()"/>
|
7292
7303
|
</td>
|
7293
7304
|
<td>
|
7294
|
-
<xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/>
|
7305
|
+
<!-- <xsl:copy-of select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]"/> -->
|
7306
|
+
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/node()[not(local-name() = 'dl')]" mode="dl_if"/>
|
7295
7307
|
<!-- get paragraphs from nested 'dl' -->
|
7296
7308
|
<xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]/*[local-name() = 'dl']" mode="dl_if_nested"/>
|
7297
7309
|
</td>
|
@@ -7299,6 +7311,53 @@
|
|
7299
7311
|
</xsl:template>
|
7300
7312
|
<xsl:template match="*[local-name()='dd']" mode="dl_if"/>
|
7301
7313
|
|
7314
|
+
<xsl:template match="*" mode="dl_if">
|
7315
|
+
<xsl:copy-of select="."/>
|
7316
|
+
</xsl:template>
|
7317
|
+
|
7318
|
+
<xsl:template match="*[local-name() = 'p']" mode="dl_if">
|
7319
|
+
<xsl:param name="indent"/>
|
7320
|
+
<p>
|
7321
|
+
<xsl:copy-of select="@*"/>
|
7322
|
+
<xsl:value-of select="$indent"/>
|
7323
|
+
<xsl:copy-of select="node()"/>
|
7324
|
+
</p>
|
7325
|
+
|
7326
|
+
</xsl:template>
|
7327
|
+
|
7328
|
+
<xsl:template match="*[local-name() = 'ul' or local-name() = 'ol']" mode="dl_if">
|
7329
|
+
<xsl:variable name="list_rendered_">
|
7330
|
+
<xsl:apply-templates select="."/>
|
7331
|
+
</xsl:variable>
|
7332
|
+
<xsl:variable name="list_rendered" select="xalan:nodeset($list_rendered_)"/>
|
7333
|
+
|
7334
|
+
<xsl:variable name="indent">
|
7335
|
+
<xsl:for-each select="($list_rendered//fo:block[not(.//fo:block)])[1]">
|
7336
|
+
<xsl:apply-templates select="ancestor::*[@provisional-distance-between-starts]/@provisional-distance-between-starts" mode="dl_if"/>
|
7337
|
+
</xsl:for-each>
|
7338
|
+
</xsl:variable>
|
7339
|
+
|
7340
|
+
<xsl:apply-templates mode="dl_if">
|
7341
|
+
<xsl:with-param name="indent" select="$indent"/>
|
7342
|
+
</xsl:apply-templates>
|
7343
|
+
</xsl:template>
|
7344
|
+
|
7345
|
+
<xsl:template match="*[local-name() = 'li']" mode="dl_if">
|
7346
|
+
<xsl:param name="indent"/>
|
7347
|
+
<xsl:apply-templates mode="dl_if">
|
7348
|
+
<xsl:with-param name="indent" select="$indent"/>
|
7349
|
+
</xsl:apply-templates>
|
7350
|
+
</xsl:template>
|
7351
|
+
|
7352
|
+
<xsl:template match="@provisional-distance-between-starts" mode="dl_if">
|
7353
|
+
<xsl:variable name="value" select="round(substring-before(.,'mm'))"/>
|
7354
|
+
<!-- emulate left indent for list item -->
|
7355
|
+
<xsl:call-template name="repeat">
|
7356
|
+
<xsl:with-param name="char" select="'x'"/>
|
7357
|
+
<xsl:with-param name="count" select="$value"/>
|
7358
|
+
</xsl:call-template>
|
7359
|
+
</xsl:template>
|
7360
|
+
|
7302
7361
|
<xsl:template match="*[local-name()='dl']" mode="dl_if_nested">
|
7303
7362
|
<xsl:for-each select="*[local-name() = 'dt']">
|
7304
7363
|
<p>
|
@@ -7594,6 +7653,23 @@
|
|
7594
7653
|
<xsl:apply-templates/>
|
7595
7654
|
</xsl:template>
|
7596
7655
|
|
7656
|
+
<!-- Don't break standard's numbers -->
|
7657
|
+
<!-- Example : <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
|
7658
|
+
<xsl:template match="*[local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']" priority="2">
|
7659
|
+
<xsl:choose>
|
7660
|
+
<xsl:when test="ancestor::*[local-name() = 'table']"><xsl:apply-templates/></xsl:when>
|
7661
|
+
<xsl:when test="following-sibling::*[2][local-name() = 'span'][@class = 'stdpublisher' or @class = 'stddocNumber' or @class = 'stddocPartNumber' or @class = 'stdyear']">
|
7662
|
+
<fo:inline keep-with-next.within-line="always"><xsl:apply-templates/></fo:inline>
|
7663
|
+
</xsl:when>
|
7664
|
+
<xsl:otherwise>
|
7665
|
+
<xsl:apply-templates/>
|
7666
|
+
</xsl:otherwise>
|
7667
|
+
</xsl:choose>
|
7668
|
+
</xsl:template>
|
7669
|
+
<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">
|
7670
|
+
<fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
|
7671
|
+
</xsl:template>
|
7672
|
+
|
7597
7673
|
<!-- ========================= -->
|
7598
7674
|
<!-- END Rich text formatting -->
|
7599
7675
|
<!-- ========================= -->
|
@@ -7692,6 +7768,7 @@
|
|
7692
7768
|
</word>
|
7693
7769
|
<xsl:call-template name="tokenize_with_tags">
|
7694
7770
|
<xsl:with-param name="text" select="substring-after($text, $separator)"/>
|
7771
|
+
<xsl:with-param name="tags" select="$tags"/>
|
7695
7772
|
</xsl:call-template>
|
7696
7773
|
</xsl:otherwise>
|
7697
7774
|
</xsl:choose>
|
@@ -7731,8 +7808,18 @@
|
|
7731
7808
|
|
7732
7809
|
<xsl:template name="add-zero-spaces-java">
|
7733
7810
|
<xsl:param name="text" select="."/>
|
7734
|
-
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space
|
7735
|
-
<xsl:
|
7811
|
+
<!-- add zero-width space (#x200B) after characters: dash, dot, colon, equal, underscore, em dash, thin space, arrow right -->
|
7812
|
+
<xsl:variable name="text1" select="java:replaceAll(java:java.lang.String.new($text),'(-|\.|:|=|_|—| |→)','$1')"/>
|
7813
|
+
<!-- add zero-width space (#x200B) after characters: 'great than' -->
|
7814
|
+
<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' -->
|
7815
|
+
<!-- add zero-width space (#x200B) before characters: 'less than' -->
|
7816
|
+
<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' -->
|
7817
|
+
<!-- add zero-width space (#x200B) before character: { -->
|
7818
|
+
<xsl:variable name="text4" select="java:replaceAll(java:java.lang.String.new($text3), '(?<!\W)(\{)', '$1')"/> <!-- negative lookbehind: '{' not preceeded by 'punctuation char' -->
|
7819
|
+
<!-- add zero-width space (#x200B) after character: , -->
|
7820
|
+
<xsl:variable name="text5" select="java:replaceAll(java:java.lang.String.new($text4), '(\,)(?!\d)', '$1')"/> <!-- negative lookahead: ',' not followed by digit -->
|
7821
|
+
|
7822
|
+
<xsl:value-of select="$text5"/>
|
7736
7823
|
</xsl:template>
|
7737
7824
|
|
7738
7825
|
<xsl:template name="add-zero-spaces-link-java">
|
@@ -7878,7 +7965,7 @@
|
|
7878
7965
|
</xsl:copy>
|
7879
7966
|
</xsl:template>
|
7880
7967
|
|
7881
|
-
<xsl:template match="*[local-name()='th' or local-name() = 'td'][not(*[local-name()='br']) and not(*[local-name()='p'])]" mode="table-without-br">
|
7968
|
+
<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">
|
7882
7969
|
<xsl:copy>
|
7883
7970
|
<xsl:copy-of select="@*"/>
|
7884
7971
|
<p>
|
@@ -7926,6 +8013,28 @@
|
|
7926
8013
|
</xsl:for-each>
|
7927
8014
|
</xsl:template>
|
7928
8015
|
|
8016
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']" mode="table-without-br">
|
8017
|
+
<xsl:apply-templates mode="table-without-br"/>
|
8018
|
+
</xsl:template>
|
8019
|
+
|
8020
|
+
<xsl:template match="*[local-name()='th' or local-name()='td']/*[local-name() = 'sourcecode']/text()[contains(., ' ') or contains(., ' ')]" mode="table-without-br">
|
8021
|
+
|
8022
|
+
<xsl:variable name="sep">###SOURCECODE_NEWLINE###</xsl:variable>
|
8023
|
+
<xsl:variable name="sourcecode_text" select="java:replaceAll(java:java.lang.String.new(.),'( | | )', $sep)"/>
|
8024
|
+
<xsl:variable name="items">
|
8025
|
+
<xsl:call-template name="split">
|
8026
|
+
<xsl:with-param name="pText" select="$sourcecode_text"/>
|
8027
|
+
<xsl:with-param name="sep" select="$sep"/>
|
8028
|
+
<xsl:with-param name="normalize-space">false</xsl:with-param>
|
8029
|
+
</xsl:call-template>
|
8030
|
+
</xsl:variable>
|
8031
|
+
<xsl:for-each select="xalan:nodeset($items)/*">
|
8032
|
+
<p>
|
8033
|
+
<sourcecode><xsl:copy-of select="node()"/></sourcecode>
|
8034
|
+
</p>
|
8035
|
+
</xsl:for-each>
|
8036
|
+
</xsl:template>
|
8037
|
+
|
7929
8038
|
<!-- remove redundant white spaces -->
|
7930
8039
|
<xsl:template match="text()[not(ancestor::*[local-name() = 'sourcecode'])]" mode="table-without-br">
|
7931
8040
|
<xsl:variable name="text" select="translate(.,'	 ','')"/>
|
@@ -7956,7 +8065,7 @@
|
|
7956
8065
|
<xsl:choose>
|
7957
8066
|
<xsl:when test="@colspan">
|
7958
8067
|
<xsl:variable name="td">
|
7959
|
-
<xsl:element name="
|
8068
|
+
<xsl:element name="{local-name()}">
|
7960
8069
|
<xsl:attribute name="divide"><xsl:value-of select="@colspan"/></xsl:attribute>
|
7961
8070
|
<xsl:if test="local-name()='th'">
|
7962
8071
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
@@ -7971,7 +8080,7 @@
|
|
7971
8080
|
</xsl:call-template>
|
7972
8081
|
</xsl:when>
|
7973
8082
|
<xsl:otherwise>
|
7974
|
-
<xsl:element name="
|
8083
|
+
<xsl:element name="{local-name()}">
|
7975
8084
|
<xsl:apply-templates select="@*" mode="simple-table-colspan"/>
|
7976
8085
|
<xsl:if test="local-name()='th'">
|
7977
8086
|
<xsl:attribute name="font-weight">bold</xsl:attribute>
|
@@ -8038,7 +8147,7 @@
|
|
8038
8147
|
<xsl:variable name="currentRow" select="."/>
|
8039
8148
|
|
8040
8149
|
<xsl:variable name="normalizedTDs">
|
8041
|
-
<xsl:for-each select="xalan:nodeset($previousRow)
|
8150
|
+
<xsl:for-each select="xalan:nodeset($previousRow)//*[self::td or self::th]">
|
8042
8151
|
<xsl:choose>
|
8043
8152
|
<xsl:when test="@rowspan > 1">
|
8044
8153
|
<xsl:copy>
|
@@ -8050,7 +8159,7 @@
|
|
8050
8159
|
</xsl:copy>
|
8051
8160
|
</xsl:when>
|
8052
8161
|
<xsl:otherwise>
|
8053
|
-
<xsl:copy-of select="$currentRow
|
8162
|
+
<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)])]"/>
|
8054
8163
|
</xsl:otherwise>
|
8055
8164
|
</xsl:choose>
|
8056
8165
|
</xsl:for-each>
|
@@ -8236,6 +8345,7 @@
|
|
8236
8345
|
<xsl:if test="ancestor::*[local-name() = 'sub']"><tag>sub</tag></xsl:if>
|
8237
8346
|
<xsl:if test="ancestor::*[local-name() = 'sup']"><tag>sup</tag></xsl:if>
|
8238
8347
|
<xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
|
8348
|
+
<xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
|
8239
8349
|
<xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
|
8240
8350
|
</tags>
|
8241
8351
|
</xsl:template>
|
@@ -9290,6 +9400,31 @@
|
|
9290
9400
|
<xsl:apply-templates mode="svg_update"/>
|
9291
9401
|
</xsl:copy>
|
9292
9402
|
</xsl:template>
|
9403
|
+
|
9404
|
+
<!-- regex for 'display: inline-block;' -->
|
9405
|
+
<xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
|
9406
|
+
<xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
|
9407
|
+
<xsl:value-of select="java:replaceAll(java:java.lang.String.new(.), $regex_svg_style_notsupported, '')"/>
|
9408
|
+
</xsl:template>
|
9409
|
+
|
9410
|
+
<!-- replace
|
9411
|
+
stroke="rgba(r, g, b, alpha)" to
|
9412
|
+
stroke="rgb(r,g,b)" stroke-opacity="alpha", and
|
9413
|
+
fill="rgba(r, g, b, alpha)" to
|
9414
|
+
fill="rgb(r,g,b)" fill-opacity="alpha" -->
|
9415
|
+
<xsl:template match="@*[local-name() = 'stroke' or local-name() = 'fill'][starts-with(normalize-space(.), 'rgba')]" mode="svg_update">
|
9416
|
+
<xsl:variable name="components_">
|
9417
|
+
<xsl:call-template name="split">
|
9418
|
+
<xsl:with-param name="pText" select="substring-before(substring-after(., '('), ')')"/>
|
9419
|
+
<xsl:with-param name="sep" select="','"/>
|
9420
|
+
</xsl:call-template>
|
9421
|
+
</xsl:variable>
|
9422
|
+
<xsl:variable name="components" select="xalan:nodeset($components_)"/>
|
9423
|
+
<xsl:variable name="att_name" select="local-name()"/>
|
9424
|
+
<xsl:attribute name="{$att_name}"><xsl:value-of select="concat('rgb(', $components/item[1], ',', $components/item[2], ',', $components/item[3], ')')"/></xsl:attribute>
|
9425
|
+
<xsl:attribute name="{$att_name}-opacity"><xsl:value-of select="$components/item[4]"/></xsl:attribute>
|
9426
|
+
</xsl:template>
|
9427
|
+
|
9293
9428
|
<!-- ============== -->
|
9294
9429
|
<!-- END: svg_update -->
|
9295
9430
|
<!-- ============== -->
|
@@ -9942,37 +10077,15 @@
|
|
9942
10077
|
<!-- =============== -->
|
9943
10078
|
<xsl:template match="*[local-name()='sourcecode']" name="sourcecode">
|
9944
10079
|
|
9945
|
-
<
|
9946
|
-
|
9947
|
-
|
9948
|
-
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
9949
|
-
</xsl:if>
|
9950
|
-
|
9951
|
-
<xsl:if test="ancestor::*[local-name() = 'example']">
|
9952
|
-
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
9953
|
-
</xsl:if>
|
9954
|
-
|
9955
|
-
<xsl:copy-of select="@id"/>
|
9956
|
-
|
9957
|
-
<xsl:if test="parent::*[local-name() = 'note']">
|
9958
|
-
<xsl:attribute name="margin-left">
|
9959
|
-
<xsl:choose>
|
9960
|
-
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
|
9961
|
-
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
|
9962
|
-
</xsl:choose>
|
9963
|
-
</xsl:attribute>
|
9964
|
-
|
9965
|
-
</xsl:if>
|
9966
|
-
<fo:block-container margin-left="0mm">
|
10080
|
+
<xsl:variable name="sourcecode_attributes">
|
10081
|
+
<xsl:element name="sourcecode_attributes" use-attribute-sets="sourcecode-style">
|
10082
|
+
<xsl:variable name="_font-size">
|
9967
10083
|
|
9968
|
-
|
9969
|
-
<xsl:variable name="_font-size">
|
10084
|
+
<!-- 9 -->
|
9970
10085
|
|
9971
|
-
|
9972
|
-
|
9973
|
-
|
9974
|
-
<xsl:if test="$current_template = 'standard'">8</xsl:if>
|
9975
|
-
</xsl:if> -->
|
10086
|
+
<!-- <xsl:if test="$namespace = 'ieee'">
|
10087
|
+
<xsl:if test="$current_template = 'standard'">8</xsl:if>
|
10088
|
+
</xsl:if> -->
|
9976
10089
|
|
9977
10090
|
</xsl:variable>
|
9978
10091
|
|
@@ -9987,14 +10100,60 @@
|
|
9987
10100
|
</xsl:choose>
|
9988
10101
|
</xsl:attribute>
|
9989
10102
|
</xsl:if>
|
10103
|
+
</xsl:element>
|
10104
|
+
</xsl:variable>
|
9990
10105
|
|
10106
|
+
<xsl:choose>
|
10107
|
+
<xsl:when test="$isGenerateTableIF = 'true' and (ancestor::*[local-name() = 'td'] or ancestor::*[local-name() = 'th'])">
|
10108
|
+
<xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
|
10109
|
+
<xsl:attribute name="{local-name()}">
|
10110
|
+
<xsl:value-of select="."/>
|
10111
|
+
</xsl:attribute>
|
10112
|
+
</xsl:for-each>
|
9991
10113
|
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
9992
|
-
</
|
10114
|
+
</xsl:when>
|
9993
10115
|
|
9994
|
-
|
10116
|
+
<xsl:otherwise>
|
10117
|
+
<fo:block-container xsl:use-attribute-sets="sourcecode-container-style">
|
9995
10118
|
|
9996
|
-
|
9997
|
-
|
10119
|
+
<xsl:if test="not(ancestor::*[local-name() = 'li']) or ancestor::*[local-name() = 'example']">
|
10120
|
+
<xsl:attribute name="margin-left">0mm</xsl:attribute>
|
10121
|
+
</xsl:if>
|
10122
|
+
|
10123
|
+
<xsl:if test="ancestor::*[local-name() = 'example']">
|
10124
|
+
<xsl:attribute name="margin-right">0mm</xsl:attribute>
|
10125
|
+
</xsl:if>
|
10126
|
+
|
10127
|
+
<xsl:copy-of select="@id"/>
|
10128
|
+
|
10129
|
+
<xsl:if test="parent::*[local-name() = 'note']">
|
10130
|
+
<xsl:attribute name="margin-left">
|
10131
|
+
<xsl:choose>
|
10132
|
+
<xsl:when test="not(ancestor::*[local-name() = 'table'])"><xsl:value-of select="$note-body-indent"/></xsl:when>
|
10133
|
+
<xsl:otherwise><xsl:value-of select="$note-body-indent-table"/></xsl:otherwise>
|
10134
|
+
</xsl:choose>
|
10135
|
+
</xsl:attribute>
|
10136
|
+
|
10137
|
+
</xsl:if>
|
10138
|
+
<fo:block-container margin-left="0mm">
|
10139
|
+
|
10140
|
+
<fo:block xsl:use-attribute-sets="sourcecode-style">
|
10141
|
+
|
10142
|
+
<xsl:for-each select="xalan:nodeset($sourcecode_attributes)/sourcecode_attributes/@*">
|
10143
|
+
<xsl:attribute name="{local-name()}">
|
10144
|
+
<xsl:value-of select="."/>
|
10145
|
+
</xsl:attribute>
|
10146
|
+
</xsl:for-each>
|
10147
|
+
|
10148
|
+
<xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
|
10149
|
+
</fo:block>
|
10150
|
+
|
10151
|
+
<xsl:apply-templates select="*[local-name()='name']"/> <!-- show sourcecode's name AFTER content -->
|
10152
|
+
|
10153
|
+
</fo:block-container>
|
10154
|
+
</fo:block-container>
|
10155
|
+
</xsl:otherwise>
|
10156
|
+
</xsl:choose>
|
9998
10157
|
</xsl:template>
|
9999
10158
|
|
10000
10159
|
<xsl:template match="*[local-name()='sourcecode']/text()" priority="2">
|
@@ -12223,7 +12382,11 @@
|
|
12223
12382
|
<!-- ===================================== -->
|
12224
12383
|
<!-- Update xml -->
|
12225
12384
|
<!-- ===================================== -->
|
12226
|
-
<!--
|
12385
|
+
<!-- =========================================================================== -->
|
12386
|
+
<!-- STEP1: -->
|
12387
|
+
<!-- - Re-order elements in 'preface', 'sections' based on @displayorder -->
|
12388
|
+
<!-- - Ignore 'span' without style -->
|
12389
|
+
<!-- =========================================================================== -->
|
12227
12390
|
<xsl:template match="@*|node()" mode="update_xml_step1">
|
12228
12391
|
<xsl:copy>
|
12229
12392
|
<xsl:apply-templates select="@*|node()" mode="update_xml_step1"/>
|
@@ -12305,7 +12468,8 @@
|
|
12305
12468
|
</xsl:copy>
|
12306
12469
|
</xsl:template>
|
12307
12470
|
|
12308
|
-
|
12471
|
+
<!-- Example with 'class': <span class="stdpublisher">ISO</span> <span class="stddocNumber">10303</span>-<span class="stddocPartNumber">1</span>:<span class="stdyear">1994</span> -->
|
12472
|
+
<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">
|
12309
12473
|
<xsl:copy>
|
12310
12474
|
<xsl:copy-of select="@*"/>
|
12311
12475
|
<xsl:apply-templates mode="update_xml_step1"/>
|
@@ -12315,10 +12479,15 @@
|
|
12315
12479
|
<xsl:template match="*[local-name() = 'span']" mode="update_xml_step1">
|
12316
12480
|
<xsl:apply-templates mode="update_xml_step1"/>
|
12317
12481
|
</xsl:template>
|
12318
|
-
|
12482
|
+
<!-- =========================================================================== -->
|
12319
12483
|
<!-- END STEP1: Re-order elements in 'preface', 'sections' based on @displayorder -->
|
12484
|
+
<!-- =========================================================================== -->
|
12320
12485
|
|
12486
|
+
<!-- =========================================================================== -->
|
12321
12487
|
<!-- XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
12488
|
+
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
12489
|
+
<!-- keep-together_within-line for: a.b, aaa.b, a.bbb, .b in table's cell ONLY -->
|
12490
|
+
<!-- =========================================================================== -->
|
12322
12491
|
<!-- Example: <keep-together_within-line>ISO 10303-51</keep-together_within-line> -->
|
12323
12492
|
<xsl:template match="@*|node()" mode="update_xml_enclose_keep-together_within-line">
|
12324
12493
|
<xsl:copy>
|
@@ -12334,10 +12503,15 @@
|
|
12334
12503
|
<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">
|
12335
12504
|
|
12336
12505
|
<!-- enclose standard's number into tag 'keep-together_within-line' -->
|
12337
|
-
<xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
|
12338
12506
|
<xsl:variable name="tag_keep-together_within-line_open">###<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
12339
12507
|
<xsl:variable name="tag_keep-together_within-line_close">###/<xsl:value-of select="$element_name_keep-together_within-line"/>###</xsl:variable>
|
12340
|
-
<xsl:variable name="
|
12508
|
+
<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))"/>
|
12509
|
+
<xsl:variable name="text_">
|
12510
|
+
<xsl:choose>
|
12511
|
+
<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 -->
|
12512
|
+
<xsl:otherwise><xsl:value-of select="$text__"/></xsl:otherwise>
|
12513
|
+
</xsl:choose>
|
12514
|
+
</xsl:variable>
|
12341
12515
|
<xsl:variable name="text"><text><xsl:call-template name="replace_text_tags">
|
12342
12516
|
<xsl:with-param name="tag_open" select="$tag_keep-together_within-line_open"/>
|
12343
12517
|
<xsl:with-param name="tag_close" select="$tag_keep-together_within-line_close"/>
|
@@ -12353,7 +12527,11 @@
|
|
12353
12527
|
</xsl:variable>
|
12354
12528
|
|
12355
12529
|
<!-- keep-together_within-line for: a/b, aaa/b, a/bbb, /b -->
|
12356
|
-
|
12530
|
+
<!-- \S matches any non-whitespace character (equivalent to [^\r\n\t\f\v ]) -->
|
12531
|
+
<!-- <xsl:variable name="regex_solidus_units">((\b((\S{1,3}\/\S+)|(\S+\/\S{1,3}))\b)|(\/\S{1,3})\b)</xsl:variable> -->
|
12532
|
+
<!-- add < and > to \S -->
|
12533
|
+
<xsl:variable name="regex_S">[^\r\n\t\f\v \<>]</xsl:variable>
|
12534
|
+
<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>
|
12357
12535
|
<xsl:variable name="text3">
|
12358
12536
|
<text><xsl:for-each select="xalan:nodeset($text2)/text/node()">
|
12359
12537
|
<xsl:choose>
|
@@ -12417,9 +12595,8 @@
|
|
12417
12595
|
<xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
|
12418
12596
|
</xsl:choose>
|
12419
12597
|
</xsl:template>
|
12420
|
-
|
12421
12598
|
<!-- ===================================== -->
|
12422
|
-
<!--
|
12599
|
+
<!-- END XML UPDATE STEP: enclose standard's name into tag 'keep-together_within-line' -->
|
12423
12600
|
<!-- ===================================== -->
|
12424
12601
|
|
12425
12602
|
<!-- for correct rendering combining chars -->
|
@@ -87,9 +87,9 @@ module IsoDoc
|
|
87
87
|
def list_people(xml, xpath)
|
88
88
|
ret = []
|
89
89
|
xml.xpath(ns(xpath)).each do |p|
|
90
|
-
name = p
|
91
|
-
aff = p
|
92
|
-
p
|
90
|
+
name = p.at(ns("./name/completename"))&.text
|
91
|
+
aff = p.at(ns("./affiliation/organization/abbreviation"))&.text ||
|
92
|
+
p.at(ns("./affiliation/organization/name"))&.text
|
93
93
|
c = name || ""
|
94
94
|
aff and c += " (#{aff})"
|
95
95
|
ret << c
|
@@ -266,6 +266,12 @@ main {
|
|
266
266
|
padding-left: 30px; }
|
267
267
|
#toc .h3, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h3 {
|
268
268
|
padding-left: 50px; }
|
269
|
+
#toc .h4, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h4 {
|
270
|
+
padding-left: 70px; }
|
271
|
+
#toc .h5, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h5 {
|
272
|
+
padding-left: 90px; }
|
273
|
+
#toc .h6, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .h6 {
|
274
|
+
padding-left: 110px; }
|
269
275
|
#toc .toc-active, #toc li:hover, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) .toc-active, #toc > ul :is(.h1, .h2, .h3, .h4, .h5, .h6) li:hover {
|
270
276
|
background: #6C734A;
|
271
277
|
box-shadow: inset -5px 0px 10px -5px #6C734A !important; }
|
data/lib/isodoc/bipm/index.rb
CHANGED
@@ -14,12 +14,12 @@ module IsoDoc
|
|
14
14
|
return
|
15
15
|
end
|
16
16
|
i = docxml.at(ns("//indexsect")) ||
|
17
|
-
docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}"\
|
17
|
+
docxml.root.add_child("<indexsect #{add_id}><title>#{@i18n.index}" \
|
18
18
|
"</title></indexsect>").first
|
19
19
|
index = sort_indexterms(
|
20
20
|
docxml.xpath(ns("//index")),
|
21
21
|
docxml.xpath(ns("//index-xref[@also = 'false']")),
|
22
|
-
docxml.xpath(ns("//index-xref[@also = 'true']"))
|
22
|
+
docxml.xpath(ns("//index-xref[@also = 'true']")),
|
23
23
|
)
|
24
24
|
index1(docxml, i, index)
|
25
25
|
end
|
@@ -27,7 +27,9 @@ module IsoDoc
|
|
27
27
|
def index1(docxml, i, index)
|
28
28
|
index.keys.sort.each do |k|
|
29
29
|
c = i.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
|
30
|
-
words = index[k].keys.each_with_object({})
|
30
|
+
words = index[k].keys.each_with_object({}) do |w, v|
|
31
|
+
v[sortable(w).downcase] = w
|
32
|
+
end
|
31
33
|
words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
32
34
|
c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
|
33
35
|
end
|
@@ -64,12 +66,13 @@ module IsoDoc
|
|
64
66
|
ret = index_entries_head(words[secondary],
|
65
67
|
index.dig(words[secondary], nil),
|
66
68
|
index_entries_opt)
|
67
|
-
words3 = index[words[secondary]]&.keys&.reject
|
69
|
+
words3 = index[words[secondary]]&.keys&.reject(&:nil?)
|
68
70
|
&.each_with_object({}) { |w, v| v[w.downcase] = w }
|
69
71
|
unless words3.empty?
|
70
72
|
ret += "<ul>"
|
71
73
|
words3.keys.localize(@lang.to_sym).sort.to_a.each do |w|
|
72
|
-
ret += (index_entries_head(words3[w],
|
74
|
+
ret += (index_entries_head(words3[w],
|
75
|
+
index[words[secondary]][words3[w]], index_entries_opt) + "</li>")
|
73
76
|
end
|
74
77
|
ret += "</ul>"
|
75
78
|
end
|
@@ -79,10 +82,18 @@ module IsoDoc
|
|
79
82
|
def index_entries_head(head, entries, opt)
|
80
83
|
ret = "<li>#{head}"
|
81
84
|
xref = entries&.dig(:xref)&.join(", ")
|
82
|
-
see_sort = entries&.dig(:see)&.each_with_object({})
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
see_sort = entries&.dig(:see)&.each_with_object({}) do |w, v|
|
86
|
+
v[sortable(w).downcase] = w
|
87
|
+
end
|
88
|
+
see = see_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
89
|
+
see_sort[k]
|
90
|
+
end&.join(", ")
|
91
|
+
also_sort = entries&.dig(:also)&.each_with_object({}) do |w, v|
|
92
|
+
v[sortable(w).downcase] = w
|
93
|
+
end
|
94
|
+
also = also_sort&.keys&.localize(@lang.to_sym)&.sort&.to_a&.map do |k|
|
95
|
+
also_sort[k]
|
96
|
+
end&.join(", ")
|
86
97
|
ret += "#{opt[:xref_lbl]} #{xref}" if xref
|
87
98
|
ret += "#{opt[:see_lbl]} #{see}" if see
|
88
99
|
ret += "#{opt[:also_lbl]} #{also}" if also
|
@@ -107,16 +118,16 @@ module IsoDoc
|
|
107
118
|
end
|
108
119
|
end
|
109
120
|
|
110
|
-
def extract_indexsee(
|
111
|
-
terms.each_with_object(
|
112
|
-
term = t
|
113
|
-
term2 = t
|
114
|
-
term3 = t
|
121
|
+
def extract_indexsee(idx, terms, label)
|
122
|
+
terms.each_with_object(idx) do |t, v|
|
123
|
+
term = to_xml(t.at(ns("./primary"))&.children)
|
124
|
+
term2 = to_xml(t.at(ns("./secondary"))&.children)
|
125
|
+
term3 = to_xml(t.at(ns("./tertiary"))&.children)
|
115
126
|
v[term] ||= {}
|
116
127
|
v[term][term2] ||= {}
|
117
128
|
v[term][term2][term3] ||= {}
|
118
129
|
v[term][term2][term3][label] ||= []
|
119
|
-
v[term][term2][term3][label] << t
|
130
|
+
v[term][term2][term3][label] << to_xml(t.at(ns("./target"))&.children)
|
120
131
|
t.remove
|
121
132
|
end
|
122
133
|
end
|
@@ -129,9 +140,9 @@ module IsoDoc
|
|
129
140
|
# attributes are decoded into UTF-8, elements in extract_indexsee are still in entities
|
130
141
|
def extract_indexterms(terms)
|
131
142
|
terms.each_with_object({}) do |t, v|
|
132
|
-
term = t
|
133
|
-
term2 = t
|
134
|
-
term3 = t
|
143
|
+
term = to_xml(t.at(ns("./primary"))&.children)
|
144
|
+
term2 = to_xml(t.at(ns("./secondary"))&.children)
|
145
|
+
term3 = to_xml(t.at(ns("./tertiary"))&.children)
|
135
146
|
index2bookmark(t)
|
136
147
|
v[term] ||= {}
|
137
148
|
v[term][term2] ||= {}
|