metanorma-un 0.8.7 → 0.8.8

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: ba4084264415215b21e84838b56d4b26a86a7fa0f8917f449f11b621eb2e8219
4
- data.tar.gz: 572850950b31f5ba76f88404b6af7ef79e40cda2b8056fd7da6eeb7fa8b18fa8
3
+ metadata.gz: c579d88ee27f6171c252864a7d48d06e0c4271e2b0810443b346cb09a0a6e218
4
+ data.tar.gz: 67b18b39fd7892605c545ae1c38d674f6934576b2b149dbd1402993b17309736
5
5
  SHA512:
6
- metadata.gz: e88c1ff785691b5c2d50f48d9a3ec160ded4f14f0c09df0d0a928fca37dc6522b1dbbdae6091b51985b8f0546ec0b9cb7a11a2c2469bdb4c7a0c42dabd12b739
7
- data.tar.gz: b49745dae7076fb8068a7a2c98dd9484bbb87bb4430951a3bab16eda2069a46c60c29cb33dc5df1be35bc566ce027279328e47dcae7ab74e5a6cc0223db7d28b
6
+ metadata.gz: ef33aafb8d235ac2940f2b277f9d1fb3449f04d945a0a08a172625908b03caf7f9f27a8f9610e6e867ab889e772af731d53efee129916a333df97ef4d0a917ad
7
+ data.tar.gz: 1086dc2dba39739b4e2d8d6f3c711cdd77e0e7dffe08d441081f58becff90ffb5a1c317f0d5177963208cbe89a2e145ce2983a011f41ca5097a26d73639c6430
@@ -32,7 +32,13 @@
32
32
 
33
33
  <xsl:template match="/">
34
34
  <xsl:call-template name="namespaceCheck"/>
35
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
35
+ <fo:root xml:lang="{$lang}">
36
+ <xsl:variable name="root-style">
37
+ <root-style xsl:use-attribute-sets="root-style"/>
38
+ </xsl:variable>
39
+ <xsl:call-template name="insertRootStyle">
40
+ <xsl:with-param name="root-style" select="$root-style"/>
41
+ </xsl:call-template>
36
42
  <fo:layout-master-set>
37
43
  <!-- Cover page -->
38
44
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -977,7 +983,30 @@
977
983
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
978
984
  <xsl:attribute name="font-size">10pt</xsl:attribute>
979
985
 
980
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
986
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
987
+ <xsl:param name="root-style"/>
988
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
989
+
990
+ <xsl:variable name="additional_fonts_">
991
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
992
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
993
+ </xsl:for-each>
994
+ </xsl:variable>
995
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
996
+
997
+ <xsl:for-each select="$root-style_/root-style/@*">
998
+ <xsl:choose>
999
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1000
+ <xsl:attribute name="{local-name()}">
1001
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1002
+ </xsl:attribute>
1003
+ </xsl:when>
1004
+ <xsl:otherwise>
1005
+ <xsl:copy-of select="."/>
1006
+ </xsl:otherwise>
1007
+ </xsl:choose>
1008
+ </xsl:for-each>
1009
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
981
1010
 
982
1011
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
983
1012
 
@@ -1493,7 +1522,7 @@
1493
1522
 
1494
1523
 
1495
1524
 
1496
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1525
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1497
1526
 
1498
1527
 
1499
1528
 
@@ -3864,24 +3893,28 @@
3864
3893
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3865
3894
  <xsl:param name="text" select="."/>
3866
3895
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3896
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3867
3897
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3898
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3868
3899
  <xsl:variable name="zero-space">​</xsl:variable>
3869
3900
  <xsl:choose>
3870
3901
  <xsl:when test="contains($text, $zero-space-after-equals)">
3871
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3902
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3872
3903
  <xsl:value-of select="$zero-space-after-equals"/>
3873
3904
  <xsl:value-of select="$zero-space"/>
3874
3905
  <xsl:call-template name="add-zero-spaces-equal">
3875
3906
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3876
- </xsl:call-template>
3907
+ </xsl:call-template> -->
3908
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3877
3909
  </xsl:when>
3878
3910
  <xsl:when test="contains($text, $zero-space-after-equal)">
3879
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3911
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3880
3912
  <xsl:value-of select="$zero-space-after-equal"/>
3881
3913
  <xsl:value-of select="$zero-space"/>
3882
3914
  <xsl:call-template name="add-zero-spaces-equal">
3883
3915
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3884
- </xsl:call-template>
3916
+ </xsl:call-template> -->
3917
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3885
3918
  </xsl:when>
3886
3919
  <xsl:otherwise>
3887
3920
  <xsl:value-of select="$text"/>
@@ -4371,7 +4404,12 @@
4371
4404
 
4372
4405
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4373
4406
 
4407
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4408
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4409
+ </xsl:if>
4410
+
4374
4411
 
4412
+
4375
4413
 
4376
4414
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4377
4415
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5353,17 +5391,15 @@
5353
5391
 
5354
5392
  <!-- split text by zero-width space -->
5355
5393
  <xsl:variable name="text_step4">
5356
- <xsl:call-template name="split">
5394
+ <xsl:call-template name="split_for_interspers">
5357
5395
  <xsl:with-param name="pText" select="$text_step3"/>
5358
5396
  <xsl:with-param name="sep" select="$zero_width_space"/>
5359
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5360
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5361
5397
  </xsl:call-template>
5362
5398
  </xsl:variable>
5363
5399
 
5364
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5400
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5365
5401
  <xsl:choose>
5366
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5402
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5367
5403
  <xsl:call-template name="interspers">
5368
5404
  <xsl:with-param name="str" select="."/>
5369
5405
  </xsl:call-template>
@@ -5374,6 +5410,30 @@
5374
5410
  </xsl:choose>
5375
5411
  </xsl:for-each>
5376
5412
 
5413
+ </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">
5414
+ <xsl:param name="pText" select="."/>
5415
+ <xsl:param name="sep" select="','"/>
5416
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5417
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5418
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5419
+ <xsl:call-template name="replace_tag_interspers">
5420
+ <xsl:with-param name="text" select="$text"/>
5421
+ </xsl:call-template>
5422
+ </xsl:template><xsl:template name="replace_tag_interspers">
5423
+ <xsl:param name="text"/>
5424
+ <xsl:choose>
5425
+ <xsl:when test="contains($text, $interspers_tag_open)">
5426
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5427
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5428
+ <interspers>
5429
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5430
+ </interspers>
5431
+ <xsl:call-template name="replace_tag_interspers">
5432
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5433
+ </xsl:call-template>
5434
+ </xsl:when>
5435
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5436
+ </xsl:choose>
5377
5437
  </xsl:template><xsl:template name="interspers">
5378
5438
  <xsl:param name="str"/>
5379
5439
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5825,7 +5885,7 @@
5825
5885
  </xsl:otherwise>
5826
5886
  </xsl:choose> -->
5827
5887
  </fo:block>
5828
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5888
+ </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">
5829
5889
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5830
5890
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5831
5891
  <xsl:if test="normalize-space() != ''">
@@ -32,7 +32,13 @@
32
32
 
33
33
  <xsl:template match="/">
34
34
  <xsl:call-template name="namespaceCheck"/>
35
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
35
+ <fo:root xml:lang="{$lang}">
36
+ <xsl:variable name="root-style">
37
+ <root-style xsl:use-attribute-sets="root-style"/>
38
+ </xsl:variable>
39
+ <xsl:call-template name="insertRootStyle">
40
+ <xsl:with-param name="root-style" select="$root-style"/>
41
+ </xsl:call-template>
36
42
  <fo:layout-master-set>
37
43
  <!-- Cover page -->
38
44
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -977,7 +983,30 @@
977
983
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
978
984
  <xsl:attribute name="font-size">10pt</xsl:attribute>
979
985
 
980
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
986
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
987
+ <xsl:param name="root-style"/>
988
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
989
+
990
+ <xsl:variable name="additional_fonts_">
991
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
992
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
993
+ </xsl:for-each>
994
+ </xsl:variable>
995
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
996
+
997
+ <xsl:for-each select="$root-style_/root-style/@*">
998
+ <xsl:choose>
999
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1000
+ <xsl:attribute name="{local-name()}">
1001
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1002
+ </xsl:attribute>
1003
+ </xsl:when>
1004
+ <xsl:otherwise>
1005
+ <xsl:copy-of select="."/>
1006
+ </xsl:otherwise>
1007
+ </xsl:choose>
1008
+ </xsl:for-each>
1009
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
981
1010
 
982
1011
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
983
1012
 
@@ -1493,7 +1522,7 @@
1493
1522
 
1494
1523
 
1495
1524
 
1496
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1525
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1497
1526
 
1498
1527
 
1499
1528
 
@@ -3864,24 +3893,28 @@
3864
3893
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3865
3894
  <xsl:param name="text" select="."/>
3866
3895
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3896
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3867
3897
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3898
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3868
3899
  <xsl:variable name="zero-space">​</xsl:variable>
3869
3900
  <xsl:choose>
3870
3901
  <xsl:when test="contains($text, $zero-space-after-equals)">
3871
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3902
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3872
3903
  <xsl:value-of select="$zero-space-after-equals"/>
3873
3904
  <xsl:value-of select="$zero-space"/>
3874
3905
  <xsl:call-template name="add-zero-spaces-equal">
3875
3906
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3876
- </xsl:call-template>
3907
+ </xsl:call-template> -->
3908
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3877
3909
  </xsl:when>
3878
3910
  <xsl:when test="contains($text, $zero-space-after-equal)">
3879
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3911
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3880
3912
  <xsl:value-of select="$zero-space-after-equal"/>
3881
3913
  <xsl:value-of select="$zero-space"/>
3882
3914
  <xsl:call-template name="add-zero-spaces-equal">
3883
3915
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3884
- </xsl:call-template>
3916
+ </xsl:call-template> -->
3917
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3885
3918
  </xsl:when>
3886
3919
  <xsl:otherwise>
3887
3920
  <xsl:value-of select="$text"/>
@@ -4371,7 +4404,12 @@
4371
4404
 
4372
4405
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4373
4406
 
4407
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4408
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4409
+ </xsl:if>
4410
+
4374
4411
 
4412
+
4375
4413
 
4376
4414
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4377
4415
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5353,17 +5391,15 @@
5353
5391
 
5354
5392
  <!-- split text by zero-width space -->
5355
5393
  <xsl:variable name="text_step4">
5356
- <xsl:call-template name="split">
5394
+ <xsl:call-template name="split_for_interspers">
5357
5395
  <xsl:with-param name="pText" select="$text_step3"/>
5358
5396
  <xsl:with-param name="sep" select="$zero_width_space"/>
5359
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5360
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5361
5397
  </xsl:call-template>
5362
5398
  </xsl:variable>
5363
5399
 
5364
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5400
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5365
5401
  <xsl:choose>
5366
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5402
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5367
5403
  <xsl:call-template name="interspers">
5368
5404
  <xsl:with-param name="str" select="."/>
5369
5405
  </xsl:call-template>
@@ -5374,6 +5410,30 @@
5374
5410
  </xsl:choose>
5375
5411
  </xsl:for-each>
5376
5412
 
5413
+ </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">
5414
+ <xsl:param name="pText" select="."/>
5415
+ <xsl:param name="sep" select="','"/>
5416
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5417
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5418
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5419
+ <xsl:call-template name="replace_tag_interspers">
5420
+ <xsl:with-param name="text" select="$text"/>
5421
+ </xsl:call-template>
5422
+ </xsl:template><xsl:template name="replace_tag_interspers">
5423
+ <xsl:param name="text"/>
5424
+ <xsl:choose>
5425
+ <xsl:when test="contains($text, $interspers_tag_open)">
5426
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5427
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5428
+ <interspers>
5429
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5430
+ </interspers>
5431
+ <xsl:call-template name="replace_tag_interspers">
5432
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5433
+ </xsl:call-template>
5434
+ </xsl:when>
5435
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5436
+ </xsl:choose>
5377
5437
  </xsl:template><xsl:template name="interspers">
5378
5438
  <xsl:param name="str"/>
5379
5439
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5825,7 +5885,7 @@
5825
5885
  </xsl:otherwise>
5826
5886
  </xsl:choose> -->
5827
5887
  </fo:block>
5828
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5888
+ </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">
5829
5889
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5830
5890
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5831
5891
  <xsl:if test="normalize-space() != ''">
@@ -36,7 +36,13 @@
36
36
 
37
37
  <xsl:template match="/">
38
38
  <xsl:call-template name="namespaceCheck"/>
39
- <fo:root xsl:use-attribute-sets="root-style" xml:lang="{$lang}">
39
+ <fo:root xml:lang="{$lang}">
40
+ <xsl:variable name="root-style">
41
+ <root-style xsl:use-attribute-sets="root-style"/>
42
+ </xsl:variable>
43
+ <xsl:call-template name="insertRootStyle">
44
+ <xsl:with-param name="root-style" select="$root-style"/>
45
+ </xsl:call-template>
40
46
  <fo:layout-master-set>
41
47
  <!-- Cover page -->
42
48
  <fo:simple-page-master master-name="cover-page" page-width="{$pageWidth}mm" page-height="{$pageHeight}mm">
@@ -1048,7 +1054,30 @@
1048
1054
  <xsl:attribute name="font-family">Times New Roman, STIX Two Math, Source Han Sans</xsl:attribute>
1049
1055
  <xsl:attribute name="font-size">10pt</xsl:attribute>
1050
1056
 
1051
- </xsl:attribute-set><xsl:attribute-set name="copyright-statement-style">
1057
+ </xsl:attribute-set><xsl:template name="insertRootStyle">
1058
+ <xsl:param name="root-style"/>
1059
+ <xsl:variable name="root-style_" select="xalan:nodeset($root-style)"/>
1060
+
1061
+ <xsl:variable name="additional_fonts_">
1062
+ <xsl:for-each select="//*[local-name() = 'misc-container'][1]/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'fonts']/*[local-name() = 'value']">
1063
+ <xsl:value-of select="."/><xsl:if test="position() != last()">, </xsl:if>
1064
+ </xsl:for-each>
1065
+ </xsl:variable>
1066
+ <xsl:variable name="additional_fonts" select="normalize-space($additional_fonts_)"/>
1067
+
1068
+ <xsl:for-each select="$root-style_/root-style/@*">
1069
+ <xsl:choose>
1070
+ <xsl:when test="local-name() = 'font-family' and $additional_fonts != ''">
1071
+ <xsl:attribute name="{local-name()}">
1072
+ <xsl:value-of select="."/>, <xsl:value-of select="$additional_fonts"/>
1073
+ </xsl:attribute>
1074
+ </xsl:when>
1075
+ <xsl:otherwise>
1076
+ <xsl:copy-of select="."/>
1077
+ </xsl:otherwise>
1078
+ </xsl:choose>
1079
+ </xsl:for-each>
1080
+ </xsl:template><xsl:attribute-set name="copyright-statement-style">
1052
1081
 
1053
1082
  </xsl:attribute-set><xsl:attribute-set name="copyright-statement-title-style">
1054
1083
 
@@ -1549,7 +1578,7 @@
1549
1578
 
1550
1579
 
1551
1580
 
1552
- </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1581
+ </xsl:attribute-set><xsl:attribute-set name="termnote-name-style">
1553
1582
 
1554
1583
 
1555
1584
 
@@ -3948,24 +3977,28 @@
3948
3977
  </xsl:template><xsl:template name="add-zero-spaces-equal">
3949
3978
  <xsl:param name="text" select="."/>
3950
3979
  <xsl:variable name="zero-space-after-equals">==========</xsl:variable>
3980
+ <xsl:variable name="regex_zero-space-after-equals">(==========)</xsl:variable>
3951
3981
  <xsl:variable name="zero-space-after-equal">=</xsl:variable>
3982
+ <xsl:variable name="regex_zero-space-after-equal">(=)</xsl:variable>
3952
3983
  <xsl:variable name="zero-space">​</xsl:variable>
3953
3984
  <xsl:choose>
3954
3985
  <xsl:when test="contains($text, $zero-space-after-equals)">
3955
- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3986
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equals)"/>
3956
3987
  <xsl:value-of select="$zero-space-after-equals"/>
3957
3988
  <xsl:value-of select="$zero-space"/>
3958
3989
  <xsl:call-template name="add-zero-spaces-equal">
3959
3990
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equals)"/>
3960
- </xsl:call-template>
3991
+ </xsl:call-template> -->
3992
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equals,concat('$1',$zero_width_space))"/>
3961
3993
  </xsl:when>
3962
3994
  <xsl:when test="contains($text, $zero-space-after-equal)">
3963
- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3995
+ <!-- <xsl:value-of select="substring-before($text, $zero-space-after-equal)"/>
3964
3996
  <xsl:value-of select="$zero-space-after-equal"/>
3965
3997
  <xsl:value-of select="$zero-space"/>
3966
3998
  <xsl:call-template name="add-zero-spaces-equal">
3967
3999
  <xsl:with-param name="text" select="substring-after($text, $zero-space-after-equal)"/>
3968
- </xsl:call-template>
4000
+ </xsl:call-template> -->
4001
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),$regex_zero-space-after-equal,concat('$1',$zero_width_space))"/>
3969
4002
  </xsl:when>
3970
4003
  <xsl:otherwise>
3971
4004
  <xsl:value-of select="$text"/>
@@ -4459,7 +4492,12 @@
4459
4492
 
4460
4493
  <fo:inline xsl:use-attribute-sets="termnote-name-style">
4461
4494
 
4495
+ <xsl:if test="not(*[local-name() = 'name']/following-sibling::node()[1][self::text()][normalize-space()=''])">
4496
+ <xsl:attribute name="padding-right">1mm</xsl:attribute>
4497
+ </xsl:if>
4498
+
4462
4499
 
4500
+
4463
4501
 
4464
4502
  <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
4465
4503
  <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
@@ -5446,17 +5484,15 @@
5446
5484
 
5447
5485
  <!-- split text by zero-width space -->
5448
5486
  <xsl:variable name="text_step4">
5449
- <xsl:call-template name="split">
5487
+ <xsl:call-template name="split_for_interspers">
5450
5488
  <xsl:with-param name="pText" select="$text_step3"/>
5451
5489
  <xsl:with-param name="sep" select="$zero_width_space"/>
5452
- <xsl:with-param name="normalize-space">false</xsl:with-param>
5453
- <xsl:with-param name="keep_sep">true</xsl:with-param>
5454
5490
  </xsl:call-template>
5455
5491
  </xsl:variable>
5456
5492
 
5457
- <xsl:for-each select="xalan:nodeset($text_step4)/item">
5493
+ <xsl:for-each select="xalan:nodeset($text_step4)/node()">
5458
5494
  <xsl:choose>
5459
- <xsl:when test="string-length() &gt; 30"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5495
+ <xsl:when test="local-name() = 'interspers'"> <!-- word with length more than 30 will be interspersed with zero-width space -->
5460
5496
  <xsl:call-template name="interspers">
5461
5497
  <xsl:with-param name="str" select="."/>
5462
5498
  </xsl:call-template>
@@ -5467,6 +5503,30 @@
5467
5503
  </xsl:choose>
5468
5504
  </xsl:for-each>
5469
5505
 
5506
+ </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">
5507
+ <xsl:param name="pText" select="."/>
5508
+ <xsl:param name="sep" select="','"/>
5509
+ <!-- word with length more than 30 will be interspersed with zero-width space -->
5510
+ <xsl:variable name="regex" select="concat('([^', $zero_width_space, ']{31,})')"/> <!-- sequence of characters (more 31), that doesn't contains zero-width space -->
5511
+ <xsl:variable name="text" select="java:replaceAll(java:java.lang.String.new($pText),$regex,concat($interspers_tag_open,'$1',$interspers_tag_close))"/>
5512
+ <xsl:call-template name="replace_tag_interspers">
5513
+ <xsl:with-param name="text" select="$text"/>
5514
+ </xsl:call-template>
5515
+ </xsl:template><xsl:template name="replace_tag_interspers">
5516
+ <xsl:param name="text"/>
5517
+ <xsl:choose>
5518
+ <xsl:when test="contains($text, $interspers_tag_open)">
5519
+ <xsl:value-of select="substring-before($text, $interspers_tag_open)"/>
5520
+ <xsl:variable name="text_after" select="substring-after($text, $interspers_tag_open)"/>
5521
+ <interspers>
5522
+ <xsl:value-of select="substring-before($text_after, $interspers_tag_close)"/>
5523
+ </interspers>
5524
+ <xsl:call-template name="replace_tag_interspers">
5525
+ <xsl:with-param name="text" select="substring-after($text_after, $interspers_tag_close)"/>
5526
+ </xsl:call-template>
5527
+ </xsl:when>
5528
+ <xsl:otherwise><xsl:value-of select="$text"/></xsl:otherwise>
5529
+ </xsl:choose>
5470
5530
  </xsl:template><xsl:template name="interspers">
5471
5531
  <xsl:param name="str"/>
5472
5532
  <xsl:param name="char" select="$zero_width_space"/>
@@ -5918,7 +5978,7 @@
5918
5978
  </xsl:otherwise>
5919
5979
  </xsl:choose> -->
5920
5980
  </fo:block>
5921
- </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()[starts-with(., '[SOURCE: Adapted from: ')]" priority="2">
5981
+ </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">
5922
5982
  <xsl:text>[</xsl:text><xsl:value-of select="substring-after(., '[SOURCE: ')"/>
5923
5983
  </xsl:template><xsl:template match="*[local-name() = 'termsource']/text()">
5924
5984
  <xsl:if test="normalize-space() != ''">
@@ -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 UN
3
- VERSION = "0.8.7".freeze
3
+ VERSION = "0.8.8".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.7
4
+ version: 0.8.8
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-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639