metanorma-itu 2.0.6 → 2.0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -114,21 +114,29 @@
114
114
 
115
115
  <xsl:template match="/">
116
116
  <xsl:call-template name="namespaceCheck"/>
117
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
118
- <!-- <xsl:if test="$lang != 'ar'">
119
- <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
120
- </xsl:if> -->
121
- <xsl:if test="$doctype = 'resolution'">
122
- <xsl:attribute name="font-size">11pt</xsl:attribute>
123
- </xsl:if>
124
- <xsl:if test="$doctype = 'service-publication'">
125
- <xsl:attribute name="font-size">11pt</xsl:attribute>
126
- <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
127
- </xsl:if>
128
- <xsl:call-template name="setWritingMode"/>
129
- <xsl:if test="$lang = 'ar'">
130
- <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
131
- </xsl:if>
117
+ <fo:root xml:lang="{$lang}">
118
+ <xsl:variable name="root-style">
119
+ <root-style xsl:use-attribute-sets="root-style">
120
+ <!-- <xsl:if test="$lang != 'ar'">
121
+ <xsl:attribute name="xml:lang"><xsl:value-of select="$lang"/></xsl:attribute>
122
+ </xsl:if> -->
123
+ <xsl:if test="$doctype = 'resolution'">
124
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
125
+ </xsl:if>
126
+ <xsl:if test="$doctype = 'service-publication'">
127
+ <xsl:attribute name="font-size">11pt</xsl:attribute>
128
+ <xsl:attribute name="font-family">Arial, STIX Two Math</xsl:attribute>
129
+ </xsl:if>
130
+ <xsl:call-template name="setWritingMode"/>
131
+ <xsl:if test="$lang = 'ar'">
132
+ <xsl:attribute name="font-family">Traditional Arabic, Times New Roman, STIX Two Math</xsl:attribute>
133
+ </xsl:if>
134
+ </root-style>
135
+ </xsl:variable>
136
+ <xsl:call-template name="insertRootStyle">
137
+ <xsl:with-param name="root-style" select="$root-style"/>
138
+ </xsl:call-template>
139
+
132
140
  <fo:layout-master-set>
133
141
 
134
142
  <!-- Technical Report first page -->
@@ -2060,7 +2068,7 @@
2060
2068
  </xsl:if>
2061
2069
  </xsl:template>
2062
2070
 
2063
- <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">
2071
+ <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">
2064
2072
  <xsl:call-template name="getLang"/>
2065
2073
  </xsl:variable><xsl:variable name="pageWidth_">
2066
2074
  210
@@ -2210,7 +2218,30 @@
2210
2218
 
2211
2219
 
2212
2220
 
2213
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
2221
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
2222
+ <xsl:param name="root-style"/>
2223
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
2224
+
2225
+ <xsl:variable name="additional_fonts_">
2226
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
2227
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
2228
+ </xsl:for-each>
2229
+ </xsl:variable>
2230
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
2231
+
2232
+ <xsl:for-each select="$root-style_/root-style/@*">
2233
+ <xsl:choose>
2234
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
2235
+ <xsl:attribute name="{local-name()}">
2236
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
2237
+ </xsl:attribute>
2238
+ </xsl:when>
2239
+ <xsl:otherwise>
2240
+ <xsl:copy-of select="."/>
2241
+ </xsl:otherwise>
2242
+ </xsl:choose>
2243
+ </xsl:for-each>
2244
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
2214
2245
 
2215
2246
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
2216
2247
 
@@ -2720,7 +2751,7 @@
2720
2751
 
2721
2752
 
2722
2753
 
2723
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2754
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
2724
2755
 
2725
2756
 
2726
2757
 
@@ -3423,8 +3454,27 @@
3423
3454
  <xsl:sort select="@displayorder" data-type="number"/>
3424
3455
  <xsl:apply-templates select="."/>
3425
3456
  </xsl:for-each>
3426
- </xsl:template><xsl:template match="text()">
3427
- <xsl:value-of select="."/>
3457
+ </xsl:template><xsl:variable name="tag_open">###fo:inline###</xsl:variable><xsl:variable name="tag_close">###/fo:inline###</xsl:variable><xsl:template match="text()" name="text">
3458
+ <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
3459
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new(.),$regex_standard_reference,concat($tag_open,'$1',$tag_close))"/>
3460
+ <xsl:call-template name="replace_fo_inline">
3461
+ <xsl:with-param name="text" select="$text"/>
3462
+ </xsl:call-template>
3463
+ </xsl:template><xsl:template name="replace_fo_inline">
3464
+ <xsl:param name="text"/>
3465
+ <xsl:choose>
3466
+ <xsl:when test="contains($text, $tag_open)">
3467
+ <xsl:value-of select="substring-before($text, $tag_open)"/>
3468
+ <xsl:text disable-output-escaping="yes">&lt;fo:inline keep-together.within-line="always"&gt;</xsl:text>
3469
+ <xsl:variable name="text_after" select="substring-after($text, $tag_open)"/>
3470
+ <xsl:value-of select="substring-before($text_after, $tag_close)"/>
3471
+ <xsl:text disable-output-escaping="yes">&lt;/fo:inline&gt;</xsl:text>
3472
+ <xsl:call-template name="replace_fo_inline">
3473
+ <xsl:with-param name="text" select="substring-after($text_after, $tag_close)"/>
3474
+ </xsl:call-template>
3475
+ </xsl:when>
3476
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
3477
+ </xsl:choose>
3428
3478
  </xsl:template><xsl:template match="*[local-name()='br']">
3429
3479
  <xsl:value-of select="$linebreak"/>
3430
3480
  </xsl:template><xsl:template match="*[local-name()='copyright-statement']">
@@ -3500,9 +3550,11 @@
3500
3550
  <xsl:with-param name="margin" select="$margin"/>
3501
3551
  </xsl:call-template>
3502
3552
 
3503
- </xsl:template><xsl:template match="*[local-name()='td']//text() | *[local-name()='th']//text() | *[local-name()='dt']//text() | *[local-name()='dd']//text()" priority="1">
3504
- <!-- <xsl:call-template name="add-zero-spaces"/> -->
3505
- <xsl:call-template name="add-zero-spaces-java"/>
3553
+ </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">
3554
+
3555
+ <!-- <xsl:call-template name="add-zero-spaces"/> -->
3556
+ <xsl:call-template name="add-zero-spaces-java"/>
3557
+
3506
3558
  </xsl:template><xsl:template match="*[local-name()='table']" name="table">
3507
3559
 
3508
3560
  <xsl:variable name="table-preamble">
@@ -3632,16 +3684,9 @@
3632
3684
  </xsl:for-each>
3633
3685
  </xsl:when>
3634
3686
  <xsl:otherwise>
3635
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3636
- <xsl:choose>
3637
- <xsl:when test=". = 1 or . = 0">
3638
- <fo:table-column column-width="proportional-column-width(2)"/>
3639
- </xsl:when>
3640
- <xsl:otherwise>
3641
- <fo:table-column column-width="proportional-column-width({.})"/>
3642
- </xsl:otherwise>
3643
- </xsl:choose>
3644
- </xsl:for-each>
3687
+ <xsl:call-template name="insertTableColumnWidth">
3688
+ <xsl:with-param name="colwidths" select="$colwidths"/>
3689
+ </xsl:call-template>
3645
3690
  </xsl:otherwise>
3646
3691
  </xsl:choose>
3647
3692
 
@@ -3849,6 +3894,12 @@
3849
3894
  <xsl:with-param name="table" select="$table"/>
3850
3895
  </xsl:call-template>
3851
3896
  </xsl:if>
3897
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]" mode="td_text">
3898
+ <xsl:apply-templates mode="td_text"/>
3899
+ </xsl:template><xsl:template match="*[(local-name()='strong' or (local-name()='inline' and @font-weight = 'bold'))]/text()[translate(., $express_reference_characters, '') = '']" mode="td_text">
3900
+
3901
+ <xsl:value-of select="."/>
3902
+
3852
3903
  </xsl:template><xsl:template match="text()" mode="td_text">
3853
3904
  <xsl:value-of select="translate(., $zero_width_space, ' ')"/><xsl:text> </xsl:text>
3854
3905
  </xsl:template><xsl:template match="*[local-name()='termsource']" mode="td_text">
@@ -3956,16 +4007,9 @@
3956
4007
  </xsl:for-each>
3957
4008
  </xsl:when>
3958
4009
  <xsl:otherwise>
3959
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
3960
- <xsl:choose>
3961
- <xsl:when test=". = 1 or . = 0">
3962
- <fo:table-column column-width="proportional-column-width(2)"/>
3963
- </xsl:when>
3964
- <xsl:otherwise>
3965
- <fo:table-column column-width="proportional-column-width({.})"/>
3966
- </xsl:otherwise>
3967
- </xsl:choose>
3968
- </xsl:for-each>
4010
+ <xsl:call-template name="insertTableColumnWidth">
4011
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4012
+ </xsl:call-template>
3969
4013
  </xsl:otherwise>
3970
4014
  </xsl:choose>
3971
4015
 
@@ -4660,9 +4704,15 @@
4660
4704
  <xsl:variable name="maxlength_dt">
4661
4705
  <xsl:call-template name="getMaxLength_dt"/>
4662
4706
  </xsl:variable>
4707
+ <xsl:variable name="isContainsExpressReference_">
4708
+ false
4709
+ </xsl:variable>
4710
+ <xsl:variable name="isContainsExpressReference" select="normalize-space($isContainsExpressReference_)"/>
4711
+ <!-- isContainsExpressReference=<xsl:value-of select="$isContainsExpressReference"/> -->
4663
4712
  <xsl:call-template name="setColumnWidth_dl">
4664
4713
  <xsl:with-param name="colwidths" select="$colwidths"/>
4665
4714
  <xsl:with-param name="maxlength_dt" select="$maxlength_dt"/>
4715
+ <xsl:with-param name="isContainsExpressReference" select="$isContainsExpressReference"/>
4666
4716
  </xsl:call-template>
4667
4717
  <fo:table-body>
4668
4718
  <xsl:apply-templates>
@@ -4678,6 +4728,7 @@
4678
4728
  </xsl:template><xsl:template name="setColumnWidth_dl">
4679
4729
  <xsl:param name="colwidths"/>
4680
4730
  <xsl:param name="maxlength_dt"/>
4731
+ <xsl:param name="isContainsExpressReference"/>
4681
4732
  <xsl:choose>
4682
4733
  <xsl:when test="ancestor::*[local-name()='dl']"><!-- second level, i.e. inlined table -->
4683
4734
  <fo:table-column column-width="50%"/>
@@ -4685,6 +4736,11 @@
4685
4736
  </xsl:when>
4686
4737
  <xsl:otherwise>
4687
4738
  <xsl:choose>
4739
+ <xsl:when test="$isContainsExpressReference">
4740
+ <xsl:call-template name="insertTableColumnWidth">
4741
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4742
+ </xsl:call-template>
4743
+ </xsl:when>
4688
4744
  <!-- to set width check most wide chars like `W` -->
4689
4745
  <xsl:when test="normalize-space($maxlength_dt) != '' and number($maxlength_dt) &lt;= 2"> <!-- if dt contains short text like t90, a, etc -->
4690
4746
  <fo:table-column column-width="7%"/>
@@ -4715,20 +4771,25 @@
4715
4771
  <fo:table-column column-width="60%"/>
4716
4772
  </xsl:when>
4717
4773
  <xsl:otherwise>
4718
- <xsl:for-each select="xalan:nodeset($colwidths)//column">
4719
- <xsl:choose>
4720
- <xsl:when test=". = 1 or . = 0">
4721
- <fo:table-column column-width="proportional-column-width(2)"/>
4722
- </xsl:when>
4723
- <xsl:otherwise>
4724
- <fo:table-column column-width="proportional-column-width({.})"/>
4725
- </xsl:otherwise>
4726
- </xsl:choose>
4727
- </xsl:for-each>
4774
+ <xsl:call-template name="insertTableColumnWidth">
4775
+ <xsl:with-param name="colwidths" select="$colwidths"/>
4776
+ </xsl:call-template>
4728
4777
  </xsl:otherwise>
4729
4778
  </xsl:choose>
4730
4779
  </xsl:otherwise>
4731
4780
  </xsl:choose>
4781
+ </xsl:template><xsl:template name="insertTableColumnWidth">
4782
+ <xsl:param name="colwidths"/>
4783
+ <xsl:for-each select="xalan:nodeset($colwidths)//column">
4784
+ <xsl:choose>
4785
+ <xsl:when test=". = 1 or . = 0">
4786
+ <fo:table-column column-width="proportional-column-width(2)"/>
4787
+ </xsl:when>
4788
+ <xsl:otherwise>
4789
+ <fo:table-column column-width="proportional-column-width({.})"/>
4790
+ </xsl:otherwise>
4791
+ </xsl:choose>
4792
+ </xsl:for-each>
4732
4793
  </xsl:template><xsl:template name="getMaxLength_dt">
4733
4794
  <xsl:variable name="lengths">
4734
4795
  <xsl:for-each select="*[local-name()='dt']">
@@ -5157,24 +5218,28 @@
5157
5218
  </xsl:template><xsl:template name="add-zero-spaces-equal">
5158
5219
  <xsl:param name="text" select="."/>
5159
5220
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
5221
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
5160
5222
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
5223
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
5161
5224
  <xsl:variable name="zero-space">​</xsl:variable>
5162
5225
  <xsl:choose>
5163
5226
  <xsl:when test="contains($text, $zero-space-after-equals)">
5164
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5227
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
5165
5228
  <xsl:value-of select="$zero-space-after-equals"/>
5166
5229
  <xsl:value-of select="$zero-space"/>
5167
5230
  <xsl:call-template name="add-zero-spaces-equal">
5168
5231
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
5169
- </xsl:call-template>
5232
+ </xsl:call-template> -->
5233
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
5170
5234
  </xsl:when>
5171
5235
  <xsl:when test="contains($text, $zero-space-after-equal)">
5172
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5236
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
5173
5237
  <xsl:value-of select="$zero-space-after-equal"/>
5174
5238
  <xsl:value-of select="$zero-space"/>
5175
5239
  <xsl:call-template name="add-zero-spaces-equal">
5176
5240
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
5177
- </xsl:call-template>
5241
+ </xsl:call-template> -->
5242
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
5178
5243
  </xsl:when>
5179
5244
  <xsl:otherwise>
5180
5245
  <xsl:value-of select="$text"/>
@@ -5342,6 +5407,9 @@
5342
5407
  <xsl:variable name="isDeleted" select="@deleted"/>
5343
5408
 
5344
5409
  <fo:inline xsl:use-attribute-sets="mathml-style">
5410
+
5411
+
5412
+
5345
5413
 
5346
5414
 
5347
5415
  <xsl:call-template name="setTrackChangesStyles">
@@ -5349,48 +5417,80 @@
5349
5417
  <xsl:with-param name="isDeleted" select="$isDeleted"/>
5350
5418
  </xsl:call-template>
5351
5419
 
5420
+ <xsl:if test="$add_math_as_text = 'true'">
5421
+ <!-- insert helper tag -->
5422
+ <!-- set unique font-size (fiction) -->
5423
+ <xsl:variable name="font-size_sfx"><xsl:number level="any"/></xsl:variable>
5424
+ <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 -->
5425
+ </xsl:if>
5352
5426
 
5353
-
5354
- <xsl:variable name="mathml">
5355
- <xsl:apply-templates select="." mode="mathml"/>
5427
+ <xsl:variable name="mathml_content">
5428
+ <xsl:apply-templates select="." mode="mathml_actual_text"/>
5356
5429
  </xsl:variable>
5357
- <fo:instream-foreign-object fox:alt-text="Math">
5358
5430
 
5431
+
5432
+ <xsl:call-template name="mathml_instream_object">
5433
+ <xsl:with-param name="mathml_content" select="$mathml_content"/>
5434
+ </xsl:call-template>
5359
5435
 
5360
-
5361
- <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5362
- <xsl:variable name="comment_text_">
5363
- <xsl:choose>
5364
- <xsl:when test="normalize-space($comment_text_following) != ''">
5365
- <xsl:value-of select="$comment_text_following"/>
5366
- </xsl:when>
5367
- <xsl:otherwise>
5368
- <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5369
- </xsl:otherwise>
5370
- </xsl:choose>
5371
- </xsl:variable>
5372
- <xsl:variable name="comment_text" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5373
-
5374
- <xsl:if test="normalize-space($comment_text) != ''">
5375
- <!-- put Mathin Alternate Text -->
5376
- <xsl:attribute name="fox:alt-text">
5377
- <xsl:value-of select="java:org.metanorma.fop.Util.unescape($comment_text)"/>
5378
- </xsl:attribute>
5379
- </xsl:if>
5380
-
5381
- <xsl:variable name="mathml_content">
5382
- <xsl:apply-templates select="." mode="mathml_actual_text"/>
5383
- </xsl:variable>
5384
- <!-- put MathML in Actual Text -->
5385
- <xsl:attribute name="fox:actual-text">
5386
- <xsl:value-of select="$mathml_content"/>
5387
- </xsl:attribute>
5388
-
5389
-
5390
-
5391
- <xsl:copy-of select="xalan:nodeset($mathml)"/>
5392
- </fo:instream-foreign-object>
5436
+
5393
5437
  </fo:inline>
5438
+ </xsl:template><xsl:template name="getMathml_comment_text">
5439
+ <xsl:variable name="comment_text_following" select="following-sibling::node()[1][self::comment()]"/>
5440
+ <xsl:variable name="comment_text_">
5441
+ <xsl:choose>
5442
+ <xsl:when test="normalize-space($comment_text_following) != ''">
5443
+ <xsl:value-of select="$comment_text_following"/>
5444
+ </xsl:when>
5445
+ <xsl:otherwise>
5446
+ <xsl:value-of select="normalize-space(translate(.,' ⁢',' '))"/>
5447
+ </xsl:otherwise>
5448
+ </xsl:choose>
5449
+ </xsl:variable>
5450
+ <xsl:variable name="comment_text_2" select="java:org.metanorma.fop.Util.unescape($comment_text_)"/>
5451
+ <xsl:variable name="comment_text" select="java:trim(java:java.lang.String.new($comment_text_2))"/>
5452
+ <xsl:value-of select="$comment_text"/>
5453
+ </xsl:template><xsl:template name="mathml_instream_object">
5454
+ <xsl:param name="comment_text"/>
5455
+ <xsl:param name="mathml_content"/>
5456
+
5457
+ <xsl:variable name="comment_text_">
5458
+ <xsl:choose>
5459
+ <xsl:when test="normalize-space($comment_text) != ''"><xsl:value-of select="$comment_text"/></xsl:when>
5460
+ <xsl:otherwise><xsl:call-template name="getMathml_comment_text"/></xsl:otherwise>
5461
+ </xsl:choose>
5462
+ </xsl:variable>
5463
+
5464
+ <xsl:variable name="mathml">
5465
+ <xsl:apply-templates select="." mode="mathml"/>
5466
+ </xsl:variable>
5467
+
5468
+ <fo:instream-foreign-object fox:alt-text="Math">
5469
+
5470
+
5471
+
5472
+
5473
+
5474
+
5475
+
5476
+ <!-- put MathML in Actual Text -->
5477
+ <!-- DEBUG: mathml_content=<xsl:value-of select="$mathml_content"/> -->
5478
+ <xsl:attribute name="fox:actual-text">
5479
+ <xsl:value-of select="$mathml_content"/>
5480
+ </xsl:attribute>
5481
+
5482
+ <!-- <xsl:if test="$add_math_as_text = 'true'"> -->
5483
+ <xsl:if test="normalize-space($comment_text_) != ''">
5484
+ <!-- put Mathin Alternate Text -->
5485
+ <xsl:attribute name="fox:alt-text">
5486
+ <xsl:value-of select="$comment_text_"/>
5487
+ </xsl:attribute>
5488
+ </xsl:if>
5489
+ <!-- </xsl:if> -->
5490
+
5491
+ <xsl:copy-of select="xalan:nodeset($mathml)"/>
5492
+
5493
+ </fo:instream-foreign-object>
5394
5494
  </xsl:template><xsl:template match="mathml:*" mode="mathml_actual_text">
5395
5495
  <!-- <xsl:text>a+b</xsl:text> -->
5396
5496
  <xsl:text>&lt;</xsl:text>
@@ -5654,7 +5754,12 @@
5654
5754
 
5655
5755
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
5656
5756
 
5757
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
5758
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
5759
+ </xsl:if>
5760
+
5657
5761
 
5762
+
5658
5763
 
5659
5764
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
5660
5765
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -6015,18 +6120,33 @@
6015
6120
  </xsl:template><xsl:template match="*[local-name() = 'svg'][not(@width and @height)]" mode="svg_update">
6016
6121
  <xsl:copy>
6017
6122
  <xsl:apply-templates select="@*" mode="svg_update"/>
6018
- <xsl:variable name="viewbox">
6123
+ <xsl:variable name="viewbox_">
6019
6124
  <xsl:call-template name="split">
6020
6125
  <xsl:with-param name="pText" select="@viewBox"/>
6021
6126
  <xsl:with-param name="sep" select="' '"/>
6022
6127
  </xsl:call-template>
6023
6128
  </xsl:variable>
6129
+ <xsl:variable name="viewbox" select="xalan:nodeset($viewbox_)"/>
6130
+ <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
6131
+ <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
6132
+
6024
6133
  <xsl:attribute name="width">
6025
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[3])"/>
6134
+ <xsl:choose>
6135
+ <xsl:when test="$width != ''">
6136
+ <xsl:value-of select="round($width)"/>
6137
+ </xsl:when>
6138
+ <xsl:otherwise>400</xsl:otherwise> <!-- default width -->
6139
+ </xsl:choose>
6026
6140
  </xsl:attribute>
6027
6141
  <xsl:attribute name="height">
6028
- <xsl:value-of select="round(xalan:nodeset($viewbox)//item[4])"/>
6142
+ <xsl:choose>
6143
+ <xsl:when test="$height != ''">
6144
+ <xsl:value-of select="round($height)"/>
6145
+ </xsl:when>
6146
+ <xsl:otherwise>400</xsl:otherwise> <!-- default height -->
6147
+ </xsl:choose>
6029
6148
  </xsl:attribute>
6149
+
6030
6150
  <xsl:apply-templates mode="svg_update"/>
6031
6151
  </xsl:copy>
6032
6152
  </xsl:template><xsl:template match="*[local-name() = 'figure']/*[local-name() = 'image'][*[local-name() = 'svg']]" priority="3">
@@ -6636,17 +6756,15 @@
6636
6756
 
6637
6757
  <!-- split text by zero-width space -->
6638
6758
  <xsl:variable name="text_step4">
6639
- <xsl:call-template name="split">
6759
+ <xsl:call-template name="split_for_interspers">
6640
6760
  <xsl:with-param name="pText" select="$text_step3"/>
6641
6761
  <xsl:with-param name="sep" select="$zero_width_space"/>
6642
- <xsl:with-param name="normalize-space">false</xsl:with-param>
6643
- <xsl:with-param name="keep_sep">true</xsl:with-param>
6644
6762
  </xsl:call-template>
6645
6763
  </xsl:variable>
6646
6764
 
6647
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
6765
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
6648
6766
  <xsl:choose>
6649
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6767
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
6650
6768
  <xsl:call-template name="interspers">
6651
6769
  <xsl:with-param name="str" select="."/>
6652
6770
  </xsl:call-template>
@@ -6657,6 +6775,30 @@
6657
6775
  </xsl:choose>
6658
6776
  </xsl:for-each>
6659
6777
 
6778
+ </xsl:template><xsl:variable name="interspers_tag_open">###interspers123###</xsl:variable><xsl:variable name="interspers_tag_close">###/interspers123###</xsl:variable><xsl:template name="split_for_interspers">
6779
+ <xsl:param name="pText" select="."/>
6780
+ <xsl:param name="sep" select="','"/>
6781
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
6782
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
6783
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
6784
+ <xsl:call-template name="replace_tag_interspers">
6785
+ <xsl:with-param name="text" select="$text"/>
6786
+ </xsl:call-template>
6787
+ </xsl:template><xsl:template name="replace_tag_interspers">
6788
+ <xsl:param name="text"/>
6789
+ <xsl:choose>
6790
+ <xsl:when test="contains($text, $interspers_tag_open)">
6791
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
6792
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
6793
+ <interspers>
6794
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
6795
+ </interspers>
6796
+ <xsl:call-template name="replace_tag_interspers">
6797
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
6798
+ </xsl:call-template>
6799
+ </xsl:when>
6800
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
6801
+ </xsl:choose>
6660
6802
  </xsl:template><xsl:template name="interspers">
6661
6803
  <xsl:param name="str"/>
6662
6804
  <xsl:param name="char" select="$zero_width_space"/>
@@ -7104,7 +7246,7 @@
7104
7246
  </xsl:otherwise>
7105
7247
  </xsl:choose> -->
7106
7248
  </fo:block>
7107
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
7249
+ </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ') or starts-with(., '[SOURCE: Quoted from: ') or starts-with(., '[SOURCE: Modified from: ')]" priority="2">
7108
7250
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
7109
7251
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
7110
7252
  <xsl:if test="normalize-space() != ''">
@@ -7140,7 +7282,8 @@
7140
7282
  <fo:inline><xsl:apply-templates/></fo:inline>
7141
7283
  </xsl:template><xsl:template match="*[local-name() = 'modification']/text()">
7142
7284
  <xsl:if test="normalize-space() != ''">
7143
- <xsl:value-of select="."/>
7285
+ <!-- <xsl:value-of select="."/> -->
7286
+ <xsl:call-template name="text"/>
7144
7287
  </xsl:if>
7145
7288
  </xsl:template><xsl:template match="*[local-name() = 'quote']">
7146
7289
  <fo:block-container margin-left="0mm">
@@ -70,6 +70,7 @@ module IsoDoc
70
70
  def toWord(result, filename, dir, header)
71
71
  result = populate_template(result, :word)
72
72
  result = from_xhtml(word_cleanup(to_xhtml(result)))
73
+ .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
73
74
  unless @landscapestyle.nil? || @landscapestyle.empty?
74
75
  @wordstylesheet&.open
75
76
  @wordstylesheet&.write(@landscapestyle)
@@ -527,7 +527,7 @@
527
527
  </define>
528
528
  <define name="LocalityType">
529
529
  <data type="string">
530
- <param name="pattern">section|clause|part|paragraph|chapter|page|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
530
+ <param name="pattern">section|clause|part|paragraph|chapter|page|title|line|whole|table|annex|figure|note|list|example|volume|issue|time|anchor|locality:[a-zA-Z0-9_]+</param>
531
531
  </data>
532
532
  </define>
533
533
  <define name="referenceFrom">
@@ -677,6 +677,9 @@
677
677
  <zeroOrMore>
678
678
  <ref name="extent"/>
679
679
  </zeroOrMore>
680
+ <optional>
681
+ <ref name="bibliographic_size"/>
682
+ </optional>
680
683
  <zeroOrMore>
681
684
  <ref name="accesslocation"/>
682
685
  </zeroOrMore>
@@ -922,9 +925,29 @@
922
925
  <text/>
923
926
  </element>
924
927
  </define>
928
+ <define name="sizevalue">
929
+ <element name="value">
930
+ <attribute name="type"/>
931
+ <text/>
932
+ </element>
933
+ </define>
934
+ <define name="bibliographic_size">
935
+ <element name="size">
936
+ <oneOrMore>
937
+ <ref name="sizevalue"/>
938
+ </oneOrMore>
939
+ </element>
940
+ </define>
925
941
  <define name="extent">
926
942
  <element name="extent">
927
- <ref name="BibItemLocality"/>
943
+ <choice>
944
+ <zeroOrMore>
945
+ <ref name="locality"/>
946
+ </zeroOrMore>
947
+ <zeroOrMore>
948
+ <ref name="localityStack"/>
949
+ </zeroOrMore>
950
+ </choice>
928
951
  </element>
929
952
  </define>
930
953
  <define name="series">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.0.6".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-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-21 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: htmlentities