metanorma-iso 2.0.8 → 2.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 270772cf99831fb493ca68a370d9954b842096aeed522b7e4657aef7743a3557
4
- data.tar.gz: 0fb34c7f8786206cbfff5e12714f89f8bf38cc51abbd108a9410d40d3bb5f2f4
3
+ metadata.gz: 6e1f30a38a5b01c33aa1960a80937b5a1c965a7a4f6a02e87e214838161c0197
4
+ data.tar.gz: bfcc9c484f6508515c342de4b00641bbfefc263e643ce231e3e95e0d3277461d
5
5
  SHA512:
6
- metadata.gz: 68afd7bbc05425d59bcef20308269243ebaad1e711b6bf7a2db76cd17a2b685d74773a0b36994187d7261bb02f7c29780f1776471f815148266d69ff0389e5b8
7
- data.tar.gz: 6881356aa0f6743f86aab7557993b7b3316b3320d48d379458aef11c9f327a7f00cb4048ff8902ef1d180e2a45ee2dadb49c12d5c9e04c043d367febd012e6a2
6
+ metadata.gz: 8ac1e270c4c96ba79b6f64bd2d824d9c54bd9f3d87782ee33930186d8594043f35d1bb92bd61f85f0fca0401681e7a964291233f614da5d6cdfeae0fde8108d5
7
+ data.tar.gz: e8d4385235de53bc7c691272ccebf231bf09dad6ad58779aa6e6841b0e7de63c3c93e501d270113f0e71a592358a183b2a4a0438ba6622b563064fc2380c1364
@@ -42,7 +42,6 @@
42
42
  {% if docsubtitlecorrlabel %}
43
43
  <p class="zzCover">{{ docsubtitlecorrlabel }}</p>
44
44
  {% endif %}
45
- {% endif %}
46
45
 
47
46
  </div>
48
47
 
@@ -1973,7 +1973,7 @@
1973
1973
  </xsl:template>
1974
1974
 
1975
1975
 
1976
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1976
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
1977
1977
  <xsl:call-template name="getLang"/>
1978
1978
  </xsl:variable><xsl:variable name="pageWidth_">
1979
1979
  210
@@ -3506,9 +3506,19 @@
3506
3506
  <xsl:with-param name="margin" select="$margin"/>
3507
3507
  </xsl:call-template>
3508
3508
 
3509
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3510
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3511
- <xsl:call-template name="add-zero-spaces-java"/>
3509
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3510
+
3511
+ <xsl:choose>
3512
+ <!-- if EXPRESS reference -->
3513
+ <xsl:when test="parent::*[local-name()='strong'] and translate(., $express_reference_characters, '') = ''">
3514
+ <xsl:value-of select="."/>
3515
+ </xsl:when>
3516
+ <xsl:otherwise>
3517
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3518
+ <xsl:call-template name="add-zero-spaces-java"/>
3519
+ </xsl:otherwise>
3520
+ </xsl:choose>
3521
+
3512
3522
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3513
3523
 
3514
3524
  <xsl:variable name="table-preamble">
@@ -3630,16 +3640,9 @@
3630
3640
  </xsl:for-each>
3631
3641
  </xsl:when>
3632
3642
  <xsl:otherwise>
3633
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3634
- <xsl:choose>
3635
- <xsl:when test=". = 1 or . = 0">
3636
- <fo:table-column column-width="proportional-column-width(2)"/>
3637
- </xsl:when>
3638
- <xsl:otherwise>
3639
- <fo:table-column column-width="proportional-column-width({.})"/>
3640
- </xsl:otherwise>
3641
- </xsl:choose>
3642
- </xsl:for-each>
3643
+ <xsl:call-template name="insertTableColumnWidth">
3644
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3645
+ </xsl:call-template>
3643
3646
  </xsl:otherwise>
3644
3647
  </xsl:choose>
3645
3648
 
@@ -3849,6 +3852,13 @@
3849
3852
  <xsl:with-param name="table" select="$table"/>
3850
3853
  </xsl:call-template>
3851
3854
  </xsl:if>
3855
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3856
+ <xsl:apply-templates mode="td_text"/>
3857
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3858
+
3859
+ <!-- replace underscore, back slash, dot to 'x', just to skip further tokenization -->
3860
+ <xsl:value-of select="translate(., $express_reference_separators, 'xxx')"/>
3861
+
3852
3862
  </xsl:template><xsl:template match="text()" mode="td_text">
3853
3863
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3854
3864
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3963,16 +3973,9 @@
3963
3973
  </xsl:for-each>
3964
3974
  </xsl:when>
3965
3975
  <xsl:otherwise>
3966
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3967
- <xsl:choose>
3968
- <xsl:when test=". = 1 or . = 0">
3969
- <fo:table-column column-width="proportional-column-width(2)"/>
3970
- </xsl:when>
3971
- <xsl:otherwise>
3972
- <fo:table-column column-width="proportional-column-width({.})"/>
3973
- </xsl:otherwise>
3974
- </xsl:choose>
3975
- </xsl:for-each>
3976
+ <xsl:call-template name="insertTableColumnWidth">
3977
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3978
+ </xsl:call-template>
3976
3979
  </xsl:otherwise>
3977
3980
  </xsl:choose>
3978
3981
 
@@ -4692,9 +4695,17 @@
4692
4695
  <xsl:variable name="maxlength_dt">
4693
4696
  <xsl:call-template name="getMaxLength_dt"/>
4694
4697
  </xsl:variable>
4698
+ <xsl:variable name="isContainsExpressReference_">
4699
+
4700
+ <xsl:value-of select="count(.//*[local-name() = 'strong'][translate(., $express_reference_characters, '') = '']) &gt; 0"/>
4701
+
4702
+ </xsl:variable>
4703
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4704
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4695
4705
  <xsl:call-template name="setColumnWidth_dl">
4696
4706
  <xsl:with-param name="colwidths" select="$colwidths"/>
4697
4707
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4708
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4698
4709
  </xsl:call-template>
4699
4710
  <fo:table-body>
4700
4711
  <xsl:apply-templates>
@@ -4710,6 +4721,7 @@
4710
4721
  </xsl:template><xsl:template name="setColumnWidth_dl">
4711
4722
  <xsl:param name="colwidths"/>
4712
4723
  <xsl:param name="maxlength_dt"/>
4724
+ <xsl:param name="isContainsExpressReference"/>
4713
4725
  <xsl:choose>
4714
4726
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4715
4727
  <fo:table-column column-width="50%"/>
@@ -4717,6 +4729,11 @@
4717
4729
  </xsl:when>
4718
4730
  <xsl:otherwise>
4719
4731
  <xsl:choose>
4732
+ <xsl:when test="$isContainsExpressReference">
4733
+ <xsl:call-template name="insertTableColumnWidth">
4734
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4735
+ </xsl:call-template>
4736
+ </xsl:when>
4720
4737
  <!-- to set width check most wide chars like `W` -->
4721
4738
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4722
4739
  <fo:table-column column-width="7%"/>
@@ -4747,20 +4764,25 @@
4747
4764
  <fo:table-column column-width="60%"/>
4748
4765
  </xsl:when>
4749
4766
  <xsl:otherwise>
4750
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4751
- <xsl:choose>
4752
- <xsl:when test=". = 1 or . = 0">
4753
- <fo:table-column column-width="proportional-column-width(2)"/>
4754
- </xsl:when>
4755
- <xsl:otherwise>
4756
- <fo:table-column column-width="proportional-column-width({.})"/>
4757
- </xsl:otherwise>
4758
- </xsl:choose>
4759
- </xsl:for-each>
4767
+ <xsl:call-template name="insertTableColumnWidth">
4768
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4769
+ </xsl:call-template>
4760
4770
  </xsl:otherwise>
4761
4771
  </xsl:choose>
4762
4772
  </xsl:otherwise>
4763
4773
  </xsl:choose>
4774
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4775
+ <xsl:param name="colwidths"/>
4776
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4777
+ <xsl:choose>
4778
+ <xsl:when test=". = 1 or . = 0">
4779
+ <fo:table-column column-width="proportional-column-width(2)"/>
4780
+ </xsl:when>
4781
+ <xsl:otherwise>
4782
+ <fo:table-column column-width="proportional-column-width({.})"/>
4783
+ </xsl:otherwise>
4784
+ </xsl:choose>
4785
+ </xsl:for-each>
4764
4786
  </xsl:template><xsl:template name="getMaxLength_dt">
4765
4787
  <xsl:variable name="lengths">
4766
4788
  <xsl:for-each select="*[local-name()='dt']">
@@ -5368,6 +5390,9 @@
5368
5390
  <xsl:variable name="isDeleted" select="@deleted"/>
5369
5391
 
5370
5392
  <fo:inline xsl:use-attribute-sets="mathml-style">
5393
+
5394
+
5395
+
5371
5396
 
5372
5397
 
5373
5398
  <xsl:call-template name="setTrackChangesStyles">
@@ -5375,55 +5400,87 @@
5375
5400
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5376
5401
  </xsl:call-template>
5377
5402
 
5403
+ <xsl:if test="$add_math_as_text = 'true'">
5404
+ <!-- insert helper tag -->
5405
+ <!-- set unique font-size (fiction) -->
5406
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5407
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
5408
+ </xsl:if>
5378
5409
 
5379
-
5380
- <xsl:variable name="mathml">
5381
- <xsl:apply-templates select="." mode="mathml"/>
5410
+ <xsl:variable name="mathml_content">
5411
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
5382
5412
  </xsl:variable>
5383
- <fo:instream-foreign-object fox:alt-text="Math">
5384
5413
 
5414
+
5415
+ <xsl:call-template name="mathml_instream_object">
5416
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5417
+ </xsl:call-template>
5385
5418
 
5386
-
5387
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5388
- <xsl:variable name="comment_text_">
5389
- <xsl:choose>
5390
- <xsl:when test="normalize-space($comment_text_following) != ''">
5391
- <xsl:value-of select="$comment_text_following"/>
5392
- </xsl:when>
5393
- <xsl:otherwise>
5394
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5395
- </xsl:otherwise>
5396
- </xsl:choose>
5397
- </xsl:variable>
5398
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5399
-
5400
- <xsl:if test="normalize-space($comment_text) != ''">
5401
- <!-- put Mathin Alternate Text -->
5402
- <xsl:attribute name="fox:alt-text">
5403
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
5404
- </xsl:attribute>
5419
+
5420
+ </fo:inline>
5421
+ </xsl:template><xsl:template name="getMathml_comment_text">
5422
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5423
+ <xsl:variable name="comment_text_">
5424
+ <xsl:choose>
5425
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5426
+ <xsl:value-of select="$comment_text_following"/>
5427
+ </xsl:when>
5428
+ <xsl:otherwise>
5429
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5430
+ </xsl:otherwise>
5431
+ </xsl:choose>
5432
+ </xsl:variable>
5433
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5434
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5435
+ <xsl:value-of select="$comment_text"/>
5436
+ </xsl:template><xsl:template name="mathml_instream_object">
5437
+ <xsl:param name="comment_text"/>
5438
+ <xsl:param name="mathml_content"/>
5439
+
5440
+ <xsl:variable name="comment_text_">
5441
+ <xsl:choose>
5442
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5443
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5444
+ </xsl:choose>
5445
+ </xsl:variable>
5446
+
5447
+ <xsl:variable name="mathml">
5448
+ <xsl:apply-templates select="." mode="mathml"/>
5449
+ </xsl:variable>
5450
+
5451
+ <fo:instream-foreign-object fox:alt-text="Math">
5452
+
5453
+
5454
+
5455
+
5456
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5457
+ <xsl:attribute name="width">95%</xsl:attribute>
5458
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5459
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5460
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5405
5461
  </xsl:if>
5406
-
5407
- <xsl:variable name="mathml_content">
5408
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
5409
- </xsl:variable>
5410
- <!-- put MathML in Actual Text -->
5411
- <xsl:attribute name="fox:actual-text">
5412
- <xsl:value-of select="$mathml_content"/>
5462
+
5463
+
5464
+
5465
+
5466
+ <!-- put MathML in Actual Text -->
5467
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5468
+ <xsl:attribute name="fox:actual-text">
5469
+ <xsl:value-of select="$mathml_content"/>
5470
+ </xsl:attribute>
5471
+
5472
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5473
+ <xsl:if test="normalize-space($comment_text_) != ''">
5474
+ <!-- put Mathin Alternate Text -->
5475
+ <xsl:attribute name="fox:alt-text">
5476
+ <xsl:value-of select="$comment_text_"/>
5413
5477
  </xsl:attribute>
5414
-
5415
-
5416
- <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5417
- <xsl:attribute name="width">95%</xsl:attribute>
5418
- <xsl:attribute name="content-height">100%</xsl:attribute>
5419
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5420
- <xsl:attribute name="scaling">uniform</xsl:attribute>
5421
- </xsl:if>
5422
-
5423
-
5424
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
5425
- </fo:instream-foreign-object>
5426
- </fo:inline>
5478
+ </xsl:if>
5479
+ <!-- </xsl:if> -->
5480
+
5481
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5482
+
5483
+ </fo:instream-foreign-object>
5427
5484
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
5428
5485
  <!-- <xsl:text>a+b</xsl:text> -->
5429
5486
  <xsl:text>&lt;</xsl:text>
@@ -6049,18 +6106,33 @@
6049
6106
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
6050
6107
  <xsl:copy>
6051
6108
  <xsl:apply-templates select="@*" mode="svg_update"/>
6052
- <xsl:variable name="viewbox">
6109
+ <xsl:variable name="viewbox_">
6053
6110
  <xsl:call-template name="split">
6054
6111
  <xsl:with-param name="pText" select="@viewBox"/>
6055
6112
  <xsl:with-param name="sep" select="' '"/>
6056
6113
  </xsl:call-template>
6057
6114
  </xsl:variable>
6115
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
6116
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6117
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6118
+
6058
6119
  <xsl:attribute name="width">
6059
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
6120
+ <xsl:choose>
6121
+ <xsl:when test="$width != ''">
6122
+ <xsl:value-of select="round($width)"/>
6123
+ </xsl:when>
6124
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
6125
+ </xsl:choose>
6060
6126
  </xsl:attribute>
6061
6127
  <xsl:attribute name="height">
6062
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
6128
+ <xsl:choose>
6129
+ <xsl:when test="$height != ''">
6130
+ <xsl:value-of select="round($height)"/>
6131
+ </xsl:when>
6132
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
6133
+ </xsl:choose>
6063
6134
  </xsl:attribute>
6135
+
6064
6136
  <xsl:apply-templates mode="svg_update"/>
6065
6137
  </xsl:copy>
6066
6138
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -1973,7 +1973,7 @@
1973
1973
  </xsl:template>
1974
1974
 
1975
1975
 
1976
- <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:variable name="lang">
1976
+ <xsl:param name="svg_images"/><xsl:variable name="images" select="document($svg_images)"/><xsl:param name="basepath"/><xsl:param name="external_index"/><xsl:param name="syntax-highlight">false</xsl:param><xsl:param name="add_math_as_text">true</xsl:param><xsl:variable name="lang">
1977
1977
  <xsl:call-template name="getLang"/>
1978
1978
  </xsl:variable><xsl:variable name="pageWidth_">
1979
1979
  210
@@ -3506,9 +3506,19 @@
3506
3506
  <xsl:with-param name="margin" select="$margin"/>
3507
3507
  </xsl:call-template>
3508
3508
 
3509
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3510
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3511
- <xsl:call-template name="add-zero-spaces-java"/>
3509
+ </xsl:template><xsl:variable name="express_reference_separators">_.\</xsl:variable><xsl:variable name="express_reference_characters" select="concat($upper,$lower,'1234567890',$express_reference_separators)"/><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3510
+
3511
+ <xsl:choose>
3512
+ <!-- if EXPRESS reference -->
3513
+ <xsl:when test="parent::*[local-name()='strong'] and translate(., $express_reference_characters, '') = ''">
3514
+ <xsl:value-of select="."/>
3515
+ </xsl:when>
3516
+ <xsl:otherwise>
3517
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3518
+ <xsl:call-template name="add-zero-spaces-java"/>
3519
+ </xsl:otherwise>
3520
+ </xsl:choose>
3521
+
3512
3522
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3513
3523
 
3514
3524
  <xsl:variable name="table-preamble">
@@ -3630,16 +3640,9 @@
3630
3640
  </xsl:for-each>
3631
3641
  </xsl:when>
3632
3642
  <xsl:otherwise>
3633
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3634
- <xsl:choose>
3635
- <xsl:when test=". = 1 or . = 0">
3636
- <fo:table-column column-width="proportional-column-width(2)"/>
3637
- </xsl:when>
3638
- <xsl:otherwise>
3639
- <fo:table-column column-width="proportional-column-width({.})"/>
3640
- </xsl:otherwise>
3641
- </xsl:choose>
3642
- </xsl:for-each>
3643
+ <xsl:call-template name="insertTableColumnWidth">
3644
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3645
+ </xsl:call-template>
3643
3646
  </xsl:otherwise>
3644
3647
  </xsl:choose>
3645
3648
 
@@ -3849,6 +3852,13 @@
3849
3852
  <xsl:with-param name="table" select="$table"/>
3850
3853
  </xsl:call-template>
3851
3854
  </xsl:if>
3855
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3856
+ <xsl:apply-templates mode="td_text"/>
3857
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3858
+
3859
+ <!-- replace underscore, back slash, dot to 'x', just to skip further tokenization -->
3860
+ <xsl:value-of select="translate(., $express_reference_separators, 'xxx')"/>
3861
+
3852
3862
  </xsl:template><xsl:template match="text()" mode="td_text">
3853
3863
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3854
3864
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3963,16 +3973,9 @@
3963
3973
  </xsl:for-each>
3964
3974
  </xsl:when>
3965
3975
  <xsl:otherwise>
3966
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3967
- <xsl:choose>
3968
- <xsl:when test=". = 1 or . = 0">
3969
- <fo:table-column column-width="proportional-column-width(2)"/>
3970
- </xsl:when>
3971
- <xsl:otherwise>
3972
- <fo:table-column column-width="proportional-column-width({.})"/>
3973
- </xsl:otherwise>
3974
- </xsl:choose>
3975
- </xsl:for-each>
3976
+ <xsl:call-template name="insertTableColumnWidth">
3977
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3978
+ </xsl:call-template>
3976
3979
  </xsl:otherwise>
3977
3980
  </xsl:choose>
3978
3981
 
@@ -4692,9 +4695,17 @@
4692
4695
  <xsl:variable name="maxlength_dt">
4693
4696
  <xsl:call-template name="getMaxLength_dt"/>
4694
4697
  </xsl:variable>
4698
+ <xsl:variable name="isContainsExpressReference_">
4699
+
4700
+ <xsl:value-of select="count(.//*[local-name() = 'strong'][translate(., $express_reference_characters, '') = '']) &gt; 0"/>
4701
+
4702
+ </xsl:variable>
4703
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4704
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4695
4705
  <xsl:call-template name="setColumnWidth_dl">
4696
4706
  <xsl:with-param name="colwidths" select="$colwidths"/>
4697
4707
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4708
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4698
4709
  </xsl:call-template>
4699
4710
  <fo:table-body>
4700
4711
  <xsl:apply-templates>
@@ -4710,6 +4721,7 @@
4710
4721
  </xsl:template><xsl:template name="setColumnWidth_dl">
4711
4722
  <xsl:param name="colwidths"/>
4712
4723
  <xsl:param name="maxlength_dt"/>
4724
+ <xsl:param name="isContainsExpressReference"/>
4713
4725
  <xsl:choose>
4714
4726
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4715
4727
  <fo:table-column column-width="50%"/>
@@ -4717,6 +4729,11 @@
4717
4729
  </xsl:when>
4718
4730
  <xsl:otherwise>
4719
4731
  <xsl:choose>
4732
+ <xsl:when test="$isContainsExpressReference">
4733
+ <xsl:call-template name="insertTableColumnWidth">
4734
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4735
+ </xsl:call-template>
4736
+ </xsl:when>
4720
4737
  <!-- to set width check most wide chars like `W` -->
4721
4738
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4722
4739
  <fo:table-column column-width="7%"/>
@@ -4747,20 +4764,25 @@
4747
4764
  <fo:table-column column-width="60%"/>
4748
4765
  </xsl:when>
4749
4766
  <xsl:otherwise>
4750
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4751
- <xsl:choose>
4752
- <xsl:when test=". = 1 or . = 0">
4753
- <fo:table-column column-width="proportional-column-width(2)"/>
4754
- </xsl:when>
4755
- <xsl:otherwise>
4756
- <fo:table-column column-width="proportional-column-width({.})"/>
4757
- </xsl:otherwise>
4758
- </xsl:choose>
4759
- </xsl:for-each>
4767
+ <xsl:call-template name="insertTableColumnWidth">
4768
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4769
+ </xsl:call-template>
4760
4770
  </xsl:otherwise>
4761
4771
  </xsl:choose>
4762
4772
  </xsl:otherwise>
4763
4773
  </xsl:choose>
4774
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4775
+ <xsl:param name="colwidths"/>
4776
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4777
+ <xsl:choose>
4778
+ <xsl:when test=". = 1 or . = 0">
4779
+ <fo:table-column column-width="proportional-column-width(2)"/>
4780
+ </xsl:when>
4781
+ <xsl:otherwise>
4782
+ <fo:table-column column-width="proportional-column-width({.})"/>
4783
+ </xsl:otherwise>
4784
+ </xsl:choose>
4785
+ </xsl:for-each>
4764
4786
  </xsl:template><xsl:template name="getMaxLength_dt">
4765
4787
  <xsl:variable name="lengths">
4766
4788
  <xsl:for-each select="*[local-name()='dt']">
@@ -5368,6 +5390,9 @@
5368
5390
  <xsl:variable name="isDeleted" select="@deleted"/>
5369
5391
 
5370
5392
  <fo:inline xsl:use-attribute-sets="mathml-style">
5393
+
5394
+
5395
+
5371
5396
 
5372
5397
 
5373
5398
  <xsl:call-template name="setTrackChangesStyles">
@@ -5375,55 +5400,87 @@
5375
5400
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5376
5401
  </xsl:call-template>
5377
5402
 
5403
+ <xsl:if test="$add_math_as_text = 'true'">
5404
+ <!-- insert helper tag -->
5405
+ <!-- set unique font-size (fiction) -->
5406
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5407
+ <fo:inline color="white" font-size="1.{$font-size_sfx}pt" font-style="normal" font-weight="normal"><xsl:value-of select="$zero_width_space"/></fo:inline> <!-- zero width space -->
5408
+ </xsl:if>
5378
5409
 
5379
-
5380
- <xsl:variable name="mathml">
5381
- <xsl:apply-templates select="." mode="mathml"/>
5410
+ <xsl:variable name="mathml_content">
5411
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
5382
5412
  </xsl:variable>
5383
- <fo:instream-foreign-object fox:alt-text="Math">
5384
5413
 
5414
+
5415
+ <xsl:call-template name="mathml_instream_object">
5416
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5417
+ </xsl:call-template>
5385
5418
 
5386
-
5387
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5388
- <xsl:variable name="comment_text_">
5389
- <xsl:choose>
5390
- <xsl:when test="normalize-space($comment_text_following) != ''">
5391
- <xsl:value-of select="$comment_text_following"/>
5392
- </xsl:when>
5393
- <xsl:otherwise>
5394
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5395
- </xsl:otherwise>
5396
- </xsl:choose>
5397
- </xsl:variable>
5398
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5399
-
5400
- <xsl:if test="normalize-space($comment_text) != ''">
5401
- <!-- put Mathin Alternate Text -->
5402
- <xsl:attribute name="fox:alt-text">
5403
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
5404
- </xsl:attribute>
5419
+
5420
+ </fo:inline>
5421
+ </xsl:template><xsl:template name="getMathml_comment_text">
5422
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5423
+ <xsl:variable name="comment_text_">
5424
+ <xsl:choose>
5425
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5426
+ <xsl:value-of select="$comment_text_following"/>
5427
+ </xsl:when>
5428
+ <xsl:otherwise>
5429
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5430
+ </xsl:otherwise>
5431
+ </xsl:choose>
5432
+ </xsl:variable>
5433
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5434
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5435
+ <xsl:value-of select="$comment_text"/>
5436
+ </xsl:template><xsl:template name="mathml_instream_object">
5437
+ <xsl:param name="comment_text"/>
5438
+ <xsl:param name="mathml_content"/>
5439
+
5440
+ <xsl:variable name="comment_text_">
5441
+ <xsl:choose>
5442
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5443
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5444
+ </xsl:choose>
5445
+ </xsl:variable>
5446
+
5447
+ <xsl:variable name="mathml">
5448
+ <xsl:apply-templates select="." mode="mathml"/>
5449
+ </xsl:variable>
5450
+
5451
+ <fo:instream-foreign-object fox:alt-text="Math">
5452
+
5453
+
5454
+
5455
+
5456
+ <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5457
+ <xsl:attribute name="width">95%</xsl:attribute>
5458
+ <xsl:attribute name="content-height">100%</xsl:attribute>
5459
+ <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5460
+ <xsl:attribute name="scaling">uniform</xsl:attribute>
5405
5461
  </xsl:if>
5406
-
5407
- <xsl:variable name="mathml_content">
5408
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
5409
- </xsl:variable>
5410
- <!-- put MathML in Actual Text -->
5411
- <xsl:attribute name="fox:actual-text">
5412
- <xsl:value-of select="$mathml_content"/>
5462
+
5463
+
5464
+
5465
+
5466
+ <!-- put MathML in Actual Text -->
5467
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5468
+ <xsl:attribute name="fox:actual-text">
5469
+ <xsl:value-of select="$mathml_content"/>
5470
+ </xsl:attribute>
5471
+
5472
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5473
+ <xsl:if test="normalize-space($comment_text_) != ''">
5474
+ <!-- put Mathin Alternate Text -->
5475
+ <xsl:attribute name="fox:alt-text">
5476
+ <xsl:value-of select="$comment_text_"/>
5413
5477
  </xsl:attribute>
5414
-
5415
-
5416
- <xsl:if test="count(ancestor::*[local-name() = 'table']) &gt; 1">
5417
- <xsl:attribute name="width">95%</xsl:attribute>
5418
- <xsl:attribute name="content-height">100%</xsl:attribute>
5419
- <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
5420
- <xsl:attribute name="scaling">uniform</xsl:attribute>
5421
- </xsl:if>
5422
-
5423
-
5424
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
5425
- </fo:instream-foreign-object>
5426
- </fo:inline>
5478
+ </xsl:if>
5479
+ <!-- </xsl:if> -->
5480
+
5481
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5482
+
5483
+ </fo:instream-foreign-object>
5427
5484
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
5428
5485
  <!-- <xsl:text>a+b</xsl:text> -->
5429
5486
  <xsl:text>&lt;</xsl:text>
@@ -6049,18 +6106,33 @@
6049
6106
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
6050
6107
  <xsl:copy>
6051
6108
  <xsl:apply-templates select="@*" mode="svg_update"/>
6052
- <xsl:variable name="viewbox">
6109
+ <xsl:variable name="viewbox_">
6053
6110
  <xsl:call-template name="split">
6054
6111
  <xsl:with-param name="pText" select="@viewBox"/>
6055
6112
  <xsl:with-param name="sep" select="' '"/>
6056
6113
  </xsl:call-template>
6057
6114
  </xsl:variable>
6115
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
6116
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6117
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6118
+
6058
6119
  <xsl:attribute name="width">
6059
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
6120
+ <xsl:choose>
6121
+ <xsl:when test="$width != ''">
6122
+ <xsl:value-of select="round($width)"/>
6123
+ </xsl:when>
6124
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
6125
+ </xsl:choose>
6060
6126
  </xsl:attribute>
6061
6127
  <xsl:attribute name="height">
6062
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
6128
+ <xsl:choose>
6129
+ <xsl:when test="$height != ''">
6130
+ <xsl:value-of select="round($height)"/>
6131
+ </xsl:when>
6132
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
6133
+ </xsl:choose>
6063
6134
  </xsl:attribute>
6135
+
6064
6136
  <xsl:apply-templates mode="svg_update"/>
6065
6137
  </xsl:copy>
6066
6138
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -65,7 +65,7 @@ module IsoDoc
65
65
  insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
66
66
  auth = docxml&.at("//div[@class = 'boilerplate-license']")&.remove
67
67
  auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
68
- auth and insert.children = auth
68
+ auth and insert and insert.children = auth
69
69
  insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
70
70
  auth = docxml&.at("//div[@class = 'boilerplate-copyright']")&.remove
71
71
  auth&.xpath(".//p[not(@class)]")&.each do |p|
@@ -80,7 +80,7 @@ module IsoDoc
80
80
  auth&.xpath(".//p[@id = 'boilerplate-place']")&.each do |p|
81
81
  p["class"] = "zzCopyright1"
82
82
  end
83
- auth and insert.children = auth
83
+ auth and insert and insert.children = auth
84
84
  end
85
85
 
86
86
  def word_cleanup(docxml)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ISO
3
- VERSION = "2.0.8".freeze
3
+ VERSION = "2.0.8.1".freeze
4
4
  end
5
5
  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.0.8
4
+ version: 2.0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-18 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc