metanorma-iho 1.0.12 → 1.0.14

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: b56165b5e08727c7f6330a2735c03055bb1163ca9a430f9583ebe690c65b8937
4
- data.tar.gz: 5d05b8aa31ad47e8d1fe70e2a5cb0d77c115288f63082ce1e44309e2c17a2de6
3
+ metadata.gz: 7cdfebb993b782a2c17eaf34610fd07f8351425743814f3e57167d7991af5edf
4
+ data.tar.gz: cde48a080e752f287ce934c1fd8f9786b2cf03dc18e8083fcb310c9e5ca77945
5
5
  SHA512:
6
- metadata.gz: 70708bbb275aba3a1048b3fc4a5e9b10ef320e9e69f2918bc34ff18183ea8422ad820f95a1fa382daf49712dde8f955bfbff7c095c1ad379bdaad970a45c991c
7
- data.tar.gz: 1220d214df2aae98c3d037c327b433d109379954b7a9d9a838ee8c14fdc3c118a949fa3e69c451ecc11d54767bdb48dcc979718b8e6792cb6ed98597ca28d00d
6
+ metadata.gz: b9018d84334f416d6e26d10ee6b447c37758e401803f76499c1d337bf1e6b26b76a824aeab8854bc3708be49f7778df72ca37375a31e3305f08eb6d594a2df2f
7
+ data.tar.gz: 5be59f0634e3fbcd8abf2b31c114f47554e6a7a4889a7308510c4852ef903b5b833019f617f3209e3fa0ffaec765a40e45db604f5ae3ee9f135cd3bd7f13b045
@@ -227,7 +227,7 @@
227
227
 
228
228
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
229
229
 
230
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
230
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
231
231
 
232
232
  <!-- Preface Pages -->
233
233
  <fo:page-sequence master-reference="preface" format="i">
@@ -273,7 +273,7 @@
273
273
  <!-- =========================== -->
274
274
  </xsl:for-each>
275
275
 
276
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'])][normalize-space() != '' or .//image or .//svg]">
276
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'])][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
277
277
 
278
278
  <fo:page-sequence master-reference="document" format="1" force-page-count="no-force">
279
279
 
@@ -883,8 +883,21 @@
883
883
 
884
884
  <!-- <xsl:strip-space elements="iho:xref"/> -->
885
885
 
886
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
887
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
886
+ <xsl:variable name="namespace_full_">
887
+ <xsl:choose>
888
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
889
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
890
+ </xsl:choose>
891
+ </xsl:variable>
892
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
893
+
894
+ <xsl:variable name="root_element_">
895
+ <xsl:choose>
896
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
897
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
898
+ </xsl:choose>
899
+ </xsl:variable>
900
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
888
901
 
889
902
  <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
890
903
 
@@ -4167,7 +4180,9 @@
4167
4180
  <fo:block role="SKIP">
4168
4181
 
4169
4182
  <xsl:if test="$isGenerateTableIF = 'true'">
4170
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4183
+
4184
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4185
+
4171
4186
  </xsl:if>
4172
4187
 
4173
4188
  <xsl:apply-templates/>
@@ -5192,7 +5207,17 @@
5192
5207
  <xsl:call-template name="refine_dt-cell-style"/>
5193
5208
 
5194
5209
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
5195
- <xsl:copy-of select="@id"/>
5210
+
5211
+ <xsl:choose>
5212
+ <xsl:when test="$isGenerateTableIF = 'true'">
5213
+
5214
+ <xsl:copy-of select="@id"/>
5215
+
5216
+ </xsl:when>
5217
+ <xsl:otherwise>
5218
+ <xsl:copy-of select="@id"/>
5219
+ </xsl:otherwise>
5220
+ </xsl:choose>
5196
5221
 
5197
5222
  <xsl:if test="normalize-space($key_iso) = 'true'">
5198
5223
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -5224,7 +5249,9 @@
5224
5249
  <fo:block role="SKIP">
5225
5250
 
5226
5251
  <xsl:if test="$isGenerateTableIF = 'true'">
5227
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5252
+
5253
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5254
+
5228
5255
  </xsl:if>
5229
5256
 
5230
5257
  <xsl:choose>
@@ -5701,6 +5728,12 @@
5701
5728
  </xsl:if>
5702
5729
  </xsl:template>
5703
5730
 
5731
+ <xsl:template match="*[local-name()='strike']">
5732
+ <fo:inline text-decoration="line-through">
5733
+ <xsl:apply-templates/>
5734
+ </fo:inline>
5735
+ </xsl:template>
5736
+
5704
5737
  <xsl:template match="*[local-name() = 'pagebreak']">
5705
5738
  <fo:block break-after="page"/>
5706
5739
  <fo:block> </fo:block>
@@ -6534,6 +6567,14 @@
6534
6567
  </xsl:for-each>
6535
6568
  </xsl:variable>
6536
6569
 
6570
+ <!-- <xsl:if test="$debug = 'true'">
6571
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
6572
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
6573
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
6574
+ <xsl:copy-of select="$words_with_width_sorted"/>
6575
+ </redirect:write>
6576
+ </xsl:if> -->
6577
+
6537
6578
  <xsl:variable name="words">
6538
6579
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
6539
6580
  <word>
@@ -6659,6 +6700,7 @@
6659
6700
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6660
6701
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
6661
6702
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6703
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
6662
6704
  </tags>
6663
6705
  </xsl:template>
6664
6706
  <!-- =============================== -->
@@ -7199,7 +7241,16 @@
7199
7241
  </xsl:when>
7200
7242
  <xsl:otherwise>
7201
7243
  <!-- output text from <link>text</link> -->
7202
- <xsl:apply-templates/>
7244
+ <xsl:choose>
7245
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
7246
+ <xsl:call-template name="add-zero-spaces-link-java">
7247
+ <xsl:with-param name="text" select="."/>
7248
+ </xsl:call-template>
7249
+ </xsl:when>
7250
+ <xsl:otherwise>
7251
+ <xsl:apply-templates/>
7252
+ </xsl:otherwise>
7253
+ </xsl:choose>
7203
7254
  </xsl:otherwise>
7204
7255
  </xsl:choose>
7205
7256
  </fo:basic-link>
@@ -7838,16 +7889,29 @@
7838
7889
  <xsl:template name="getImageSrc">
7839
7890
  <xsl:choose>
7840
7891
  <xsl:when test="not(starts-with(@src, 'data:'))">
7892
+ <xsl:call-template name="getImageSrcExternal"/>
7893
+ </xsl:when>
7894
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7895
+ </xsl:choose>
7896
+ </xsl:template>
7897
+
7898
+ <xsl:template name="getImageSrcExternal">
7899
+ <xsl:choose>
7900
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7901
+ <xsl:value-of select="@src"/>
7902
+ </xsl:when>
7903
+ <xsl:otherwise>
7904
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
7905
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
7841
7906
  <xsl:choose>
7842
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7843
- <xsl:value-of select="@src"/>
7907
+ <xsl:when test="$file_exists = 'true'">
7908
+ <xsl:value-of select="$src_with_basepath"/>
7844
7909
  </xsl:when>
7845
7910
  <xsl:otherwise>
7846
- <xsl:value-of select="concat($basepath, @src)"/>
7911
+ <xsl:value-of select="@src"/>
7847
7912
  </xsl:otherwise>
7848
7913
  </xsl:choose>
7849
- </xsl:when>
7850
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7914
+ </xsl:otherwise>
7851
7915
  </xsl:choose>
7852
7916
  </xsl:template>
7853
7917
 
@@ -7895,14 +7959,8 @@
7895
7959
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7896
7960
  </xsl:when>
7897
7961
  <xsl:when test="not(starts-with(@src, 'data:'))">
7898
- <xsl:choose>
7899
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7900
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7901
- </xsl:when>
7902
- <xsl:otherwise>
7903
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7904
- </xsl:otherwise>
7905
- </xsl:choose>
7962
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
7963
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
7906
7964
  </xsl:when>
7907
7965
  <xsl:otherwise>
7908
7966
  <xsl:value-of select="@src"/>
@@ -7923,16 +7981,8 @@
7923
7981
  </svg>
7924
7982
  </xsl:when>
7925
7983
  <xsl:when test="not(starts-with(@src, 'data:'))">
7926
- <xsl:variable name="src">
7927
- <xsl:choose>
7928
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7929
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7930
- </xsl:when>
7931
- <xsl:otherwise>
7932
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7933
- </xsl:otherwise>
7934
- </xsl:choose>
7935
- </xsl:variable>
7984
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
7985
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
7936
7986
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7937
7987
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
7938
7988
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -12049,7 +12099,9 @@
12049
12099
  <xsl:template name="add_id">
12050
12100
  <xsl:if test="not(@id)">
12051
12101
  <!-- add @id - first element with @id plus '_element_name' -->
12052
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12102
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
12103
+ <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
12104
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12053
12105
  </xsl:if>
12054
12106
  </xsl:template>
12055
12107
 
@@ -13354,6 +13406,7 @@
13354
13406
  <xsl:param name="formatted">false</xsl:param>
13355
13407
  <xsl:param name="lang"/>
13356
13408
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
13409
+ <xsl:param name="bibdata_updated"/>
13357
13410
 
13358
13411
  <xsl:variable name="curr_lang">
13359
13412
  <xsl:choose>
@@ -13367,6 +13420,9 @@
13367
13420
 
13368
13421
  <xsl:variable name="data_value">
13369
13422
  <xsl:choose>
13423
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
13424
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13425
+ </xsl:when>
13370
13426
  <xsl:when test="$formatted = 'true'">
13371
13427
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13372
13428
  </xsl:when>
@@ -13538,14 +13594,8 @@
13538
13594
  <xsl:value-of select="$src"/>
13539
13595
  </xsl:when>
13540
13596
  <xsl:otherwise>
13541
- <xsl:choose>
13542
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
13543
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
13544
- </xsl:when>
13545
- <xsl:otherwise>
13546
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13547
- </xsl:otherwise>
13548
- </xsl:choose>
13597
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
13598
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
13549
13599
  </xsl:otherwise>
13550
13600
  </xsl:choose>
13551
13601
  </xsl:template>
@@ -13567,15 +13617,23 @@
13567
13617
  <!-- END: insert cover page image -->
13568
13618
 
13569
13619
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
13620
+ <xsl:variable name="regex_ja_spec_half_width_">
13621
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
13622
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
13623
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
13624
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
13625
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
13626
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
13627
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
13628
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
13629
+ </xsl:variable>
13630
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
13570
13631
  <xsl:variable name="regex_ja_spec_">[
13571
13632
  <!-- Rotate 90° clockwise -->
13572
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
13633
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
13573
13634
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
13574
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
13575
13635
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
13576
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
13577
13636
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
13578
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
13579
13637
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
13580
13638
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
13581
13639
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -13583,21 +13641,16 @@
13583
13641
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
13584
13642
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
13585
13643
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
13586
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
13587
13644
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
13588
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
13589
13645
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
13590
13646
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
13591
13647
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
13592
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
13593
13648
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
13594
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
13595
13649
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
13596
13650
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
13597
13651
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
13598
13652
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
13599
13653
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
13600
-
13601
13654
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
13602
13655
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
13603
13656
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -13629,6 +13682,7 @@
13629
13682
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
13630
13683
  <xsl:template name="insertVerticalChar">
13631
13684
  <xsl:param name="str"/>
13685
+ <xsl:param name="char_prev"/>
13632
13686
  <xsl:param name="writing-mode">lr-tb</xsl:param>
13633
13687
  <xsl:param name="reference-orientation">90</xsl:param>
13634
13688
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -13638,53 +13692,99 @@
13638
13692
  </xsl:when>
13639
13693
  <xsl:otherwise>
13640
13694
  <xsl:if test="string-length($str) &gt; 0">
13641
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
13695
+
13696
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
13642
13697
  <xsl:variable name="char" select="substring($str,1,1)"/>
13643
- <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
13644
- <xsl:if test="normalize-space($writing-mode) != ''">
13645
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13646
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
13647
- </xsl:if>
13648
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13649
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
13650
- </xsl:if>
13651
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
13652
- <!-- Rotate 180°:
13653
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
13654
- U+3002 IDEOGRAPHIC FULL STOP (。)
13655
- U+FE52 SMALL FULL STOP (﹒)
13656
- U+FF0E FULLWIDTH FULL STOP ()
13657
- -->
13658
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
13659
- </xsl:if>
13660
- <fo:block-container width="1em">
13661
- <fo:block line-height="1em">
13662
- <xsl:choose>
13663
- <xsl:when test="$horizontal_mode = 'true'">
13664
- <xsl:value-of select="$str"/>
13665
- </xsl:when>
13666
- <xsl:otherwise>
13698
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
13699
+
13700
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
13701
+
13702
+ <xsl:choose>
13703
+ <xsl:when test="$char_half_width = 'true'">
13704
+ <fo:inline>
13705
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
13706
+ <xsl:value-of select="$char"/>
13707
+ </fo:inline>
13708
+ </xsl:when>
13709
+ <xsl:otherwise>
13710
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
13711
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
13712
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13713
+ </xsl:if>
13714
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP" text-align-last="center">
13715
+ <xsl:if test="normalize-space($writing-mode) != ''">
13716
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13717
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
13718
+ </xsl:if>
13719
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13720
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
13721
+ </xsl:if>
13722
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
13723
+ <!-- Rotate 180°:
13724
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
13725
+ U+3002 IDEOGRAPHIC FULL STOP (。)
13726
+ U+FE52 SMALL FULL STOP (﹒)
13727
+ U+FF0E FULLWIDTH FULL STOP (.)
13728
+ -->
13729
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
13730
+ </xsl:if>
13731
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
13732
+ <fo:block line-height="1em" role="SKIP">
13733
+ <!-- <xsl:choose>
13734
+ <xsl:when test="$horizontal_mode = 'true'">
13735
+ <xsl:value-of select="$str"/>
13736
+ </xsl:when>
13737
+ <xsl:otherwise>
13738
+ <xsl:value-of select="$char"/>
13739
+ </xsl:otherwise>
13740
+ </xsl:choose> -->
13667
13741
  <xsl:value-of select="$char"/>
13668
- </xsl:otherwise>
13669
- </xsl:choose>
13670
- </fo:block>
13671
- </fo:block-container>
13672
- </fo:inline-container>
13673
- <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}')"><xsl:value-of select="$zero_width_space"/></xsl:if>
13674
-
13675
- <xsl:if test="$horizontal_mode = 'false'">
13676
- <xsl:call-template name="insertVerticalChar">
13677
- <xsl:with-param name="str" select="substring($str, 2)"/>
13678
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
13679
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13680
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
13681
- </xsl:call-template>
13682
- </xsl:if>
13742
+ </fo:block>
13743
+ </fo:block-container>
13744
+ </fo:inline-container>
13745
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
13746
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13747
+ </xsl:if>
13748
+ </xsl:otherwise>
13749
+ </xsl:choose>
13750
+
13751
+ <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}' or $char = '/')"><xsl:value-of select="$zero_width_space"/></xsl:if>
13752
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
13753
+ <xsl:call-template name="insertVerticalChar">
13754
+ <xsl:with-param name="str" select="substring($str, 2)"/>
13755
+ <xsl:with-param name="char_prev" select="$char"/>
13756
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
13757
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13758
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
13759
+ </xsl:call-template>
13760
+ <!-- </xsl:if> -->
13683
13761
  </xsl:if>
13684
13762
  </xsl:otherwise>
13685
13763
  </xsl:choose>
13686
13764
  </xsl:template>
13687
13765
 
13766
+ <xsl:template name="insertHorizontalChars">
13767
+ <xsl:param name="str"/>
13768
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
13769
+ <xsl:param name="reference-orientation">90</xsl:param>
13770
+ <xsl:param name="add_zero_width_space">false</xsl:param>
13771
+ <xsl:choose>
13772
+ <xsl:otherwise>
13773
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP">
13774
+ <xsl:if test="normalize-space($writing-mode) != ''">
13775
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13776
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
13777
+ </xsl:if>
13778
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
13779
+ <fo:block line-height="1em" role="SKIP">
13780
+ <xsl:value-of select="$str"/>
13781
+ </fo:block>
13782
+ </fo:block-container>
13783
+ </fo:inline-container>
13784
+ </xsl:otherwise>
13785
+ </xsl:choose>
13786
+ </xsl:template>
13787
+
13688
13788
  <xsl:template name="number-to-words">
13689
13789
  <xsl:param name="number"/>
13690
13790
  <xsl:param name="first"/>
@@ -227,7 +227,7 @@
227
227
 
228
228
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface/sections -->
229
229
 
230
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
230
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
231
231
 
232
232
  <!-- Preface Pages -->
233
233
  <fo:page-sequence master-reference="preface" format="i">
@@ -273,7 +273,7 @@
273
273
  <!-- =========================== -->
274
274
  </xsl:for-each>
275
275
 
276
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'])][normalize-space() != '' or .//image or .//svg]">
276
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'preface'])][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
277
277
 
278
278
  <fo:page-sequence master-reference="document" format="1" force-page-count="no-force">
279
279
 
@@ -883,8 +883,21 @@
883
883
 
884
884
  <!-- <xsl:strip-space elements="iho:xref"/> -->
885
885
 
886
- <xsl:variable name="namespace_full" select="namespace-uri(/*)"/> <!-- example: https://www.metanorma.org/ns/iso -->
887
- <xsl:variable name="root_element" select="local-name(/*)"/> <!-- example: iso-standard -->
886
+ <xsl:variable name="namespace_full_">
887
+ <xsl:choose>
888
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="namespace-uri(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
889
+ <xsl:otherwise><xsl:value-of select="namespace-uri(/*)"/></xsl:otherwise><!-- example: https://www.metanorma.org/ns/iso -->
890
+ </xsl:choose>
891
+ </xsl:variable>
892
+ <xsl:variable name="namespace_full" select="normalize-space($namespace_full_)"/>
893
+
894
+ <xsl:variable name="root_element_">
895
+ <xsl:choose>
896
+ <xsl:when test="local-name(/*) = 'metanorma-collection'"><xsl:value-of select="local-name(//*[contains(local-name(), '-standard')][1])"/></xsl:when>
897
+ <xsl:otherwise><xsl:value-of select="local-name(/*)"/></xsl:otherwise><!-- example: iso-standard -->
898
+ </xsl:choose>
899
+ </xsl:variable>
900
+ <xsl:variable name="root_element" select="normalize-space($root_element_)"/>
888
901
 
889
902
  <xsl:variable name="document_scheme" select="normalize-space(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = 'document-scheme']/*[local-name() = 'value'])"/>
890
903
 
@@ -4167,7 +4180,9 @@
4167
4180
  <fo:block role="SKIP">
4168
4181
 
4169
4182
  <xsl:if test="$isGenerateTableIF = 'true'">
4170
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4183
+
4184
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
4185
+
4171
4186
  </xsl:if>
4172
4187
 
4173
4188
  <xsl:apply-templates/>
@@ -5192,7 +5207,17 @@
5192
5207
  <xsl:call-template name="refine_dt-cell-style"/>
5193
5208
 
5194
5209
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
5195
- <xsl:copy-of select="@id"/>
5210
+
5211
+ <xsl:choose>
5212
+ <xsl:when test="$isGenerateTableIF = 'true'">
5213
+
5214
+ <xsl:copy-of select="@id"/>
5215
+
5216
+ </xsl:when>
5217
+ <xsl:otherwise>
5218
+ <xsl:copy-of select="@id"/>
5219
+ </xsl:otherwise>
5220
+ </xsl:choose>
5196
5221
 
5197
5222
  <xsl:if test="normalize-space($key_iso) = 'true'">
5198
5223
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -5224,7 +5249,9 @@
5224
5249
  <fo:block role="SKIP">
5225
5250
 
5226
5251
  <xsl:if test="$isGenerateTableIF = 'true'">
5227
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5252
+
5253
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5254
+
5228
5255
  </xsl:if>
5229
5256
 
5230
5257
  <xsl:choose>
@@ -5701,6 +5728,12 @@
5701
5728
  </xsl:if>
5702
5729
  </xsl:template>
5703
5730
 
5731
+ <xsl:template match="*[local-name()='strike']">
5732
+ <fo:inline text-decoration="line-through">
5733
+ <xsl:apply-templates/>
5734
+ </fo:inline>
5735
+ </xsl:template>
5736
+
5704
5737
  <xsl:template match="*[local-name() = 'pagebreak']">
5705
5738
  <fo:block break-after="page"/>
5706
5739
  <fo:block> </fo:block>
@@ -6534,6 +6567,14 @@
6534
6567
  </xsl:for-each>
6535
6568
  </xsl:variable>
6536
6569
 
6570
+ <!-- <xsl:if test="$debug = 'true'">
6571
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
6572
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
6573
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
6574
+ <xsl:copy-of select="$words_with_width_sorted"/>
6575
+ </redirect:write>
6576
+ </xsl:if> -->
6577
+
6537
6578
  <xsl:variable name="words">
6538
6579
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
6539
6580
  <word>
@@ -6659,6 +6700,7 @@
6659
6700
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
6660
6701
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
6661
6702
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
6703
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
6662
6704
  </tags>
6663
6705
  </xsl:template>
6664
6706
  <!-- =============================== -->
@@ -7199,7 +7241,16 @@
7199
7241
  </xsl:when>
7200
7242
  <xsl:otherwise>
7201
7243
  <!-- output text from <link>text</link> -->
7202
- <xsl:apply-templates/>
7244
+ <xsl:choose>
7245
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
7246
+ <xsl:call-template name="add-zero-spaces-link-java">
7247
+ <xsl:with-param name="text" select="."/>
7248
+ </xsl:call-template>
7249
+ </xsl:when>
7250
+ <xsl:otherwise>
7251
+ <xsl:apply-templates/>
7252
+ </xsl:otherwise>
7253
+ </xsl:choose>
7203
7254
  </xsl:otherwise>
7204
7255
  </xsl:choose>
7205
7256
  </fo:basic-link>
@@ -7838,16 +7889,29 @@
7838
7889
  <xsl:template name="getImageSrc">
7839
7890
  <xsl:choose>
7840
7891
  <xsl:when test="not(starts-with(@src, 'data:'))">
7892
+ <xsl:call-template name="getImageSrcExternal"/>
7893
+ </xsl:when>
7894
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7895
+ </xsl:choose>
7896
+ </xsl:template>
7897
+
7898
+ <xsl:template name="getImageSrcExternal">
7899
+ <xsl:choose>
7900
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7901
+ <xsl:value-of select="@src"/>
7902
+ </xsl:when>
7903
+ <xsl:otherwise>
7904
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
7905
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
7841
7906
  <xsl:choose>
7842
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7843
- <xsl:value-of select="@src"/>
7907
+ <xsl:when test="$file_exists = 'true'">
7908
+ <xsl:value-of select="$src_with_basepath"/>
7844
7909
  </xsl:when>
7845
7910
  <xsl:otherwise>
7846
- <xsl:value-of select="concat($basepath, @src)"/>
7911
+ <xsl:value-of select="@src"/>
7847
7912
  </xsl:otherwise>
7848
7913
  </xsl:choose>
7849
- </xsl:when>
7850
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
7914
+ </xsl:otherwise>
7851
7915
  </xsl:choose>
7852
7916
  </xsl:template>
7853
7917
 
@@ -7895,14 +7959,8 @@
7895
7959
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
7896
7960
  </xsl:when>
7897
7961
  <xsl:when test="not(starts-with(@src, 'data:'))">
7898
- <xsl:choose>
7899
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7900
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7901
- </xsl:when>
7902
- <xsl:otherwise>
7903
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7904
- </xsl:otherwise>
7905
- </xsl:choose>
7962
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
7963
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
7906
7964
  </xsl:when>
7907
7965
  <xsl:otherwise>
7908
7966
  <xsl:value-of select="@src"/>
@@ -7923,16 +7981,8 @@
7923
7981
  </svg>
7924
7982
  </xsl:when>
7925
7983
  <xsl:when test="not(starts-with(@src, 'data:'))">
7926
- <xsl:variable name="src">
7927
- <xsl:choose>
7928
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
7929
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
7930
- </xsl:when>
7931
- <xsl:otherwise>
7932
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
7933
- </xsl:otherwise>
7934
- </xsl:choose>
7935
- </xsl:variable>
7984
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
7985
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
7936
7986
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
7937
7987
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
7938
7988
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -12049,7 +12099,9 @@
12049
12099
  <xsl:template name="add_id">
12050
12100
  <xsl:if test="not(@id)">
12051
12101
  <!-- add @id - first element with @id plus '_element_name' -->
12052
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12102
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
12103
+ <xsl:variable name="prefix_id"><xsl:value-of select="$prefix_id_"/><xsl:if test="normalize-space($prefix_id_) = ''"><xsl:value-of select="generate-id()"/></xsl:if></xsl:variable>
12104
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
12053
12105
  </xsl:if>
12054
12106
  </xsl:template>
12055
12107
 
@@ -13354,6 +13406,7 @@
13354
13406
  <xsl:param name="formatted">false</xsl:param>
13355
13407
  <xsl:param name="lang"/>
13356
13408
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
13409
+ <xsl:param name="bibdata_updated"/>
13357
13410
 
13358
13411
  <xsl:variable name="curr_lang">
13359
13412
  <xsl:choose>
@@ -13367,6 +13420,9 @@
13367
13420
 
13368
13421
  <xsl:variable name="data_value">
13369
13422
  <xsl:choose>
13423
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
13424
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13425
+ </xsl:when>
13370
13426
  <xsl:when test="$formatted = 'true'">
13371
13427
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
13372
13428
  </xsl:when>
@@ -13538,14 +13594,8 @@
13538
13594
  <xsl:value-of select="$src"/>
13539
13595
  </xsl:when>
13540
13596
  <xsl:otherwise>
13541
- <xsl:choose>
13542
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
13543
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
13544
- </xsl:when>
13545
- <xsl:otherwise>
13546
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
13547
- </xsl:otherwise>
13548
- </xsl:choose>
13597
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
13598
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
13549
13599
  </xsl:otherwise>
13550
13600
  </xsl:choose>
13551
13601
  </xsl:template>
@@ -13567,15 +13617,23 @@
13567
13617
  <!-- END: insert cover page image -->
13568
13618
 
13569
13619
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
13620
+ <xsl:variable name="regex_ja_spec_half_width_">
13621
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
13622
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
13623
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
13624
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
13625
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
13626
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
13627
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
13628
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
13629
+ </xsl:variable>
13630
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
13570
13631
  <xsl:variable name="regex_ja_spec_">[
13571
13632
  <!-- Rotate 90° clockwise -->
13572
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
13633
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
13573
13634
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
13574
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
13575
13635
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
13576
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
13577
13636
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
13578
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
13579
13637
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
13580
13638
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
13581
13639
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -13583,21 +13641,16 @@
13583
13641
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
13584
13642
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
13585
13643
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
13586
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
13587
13644
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
13588
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
13589
13645
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
13590
13646
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
13591
13647
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
13592
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
13593
13648
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
13594
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
13595
13649
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
13596
13650
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
13597
13651
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
13598
13652
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
13599
13653
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
13600
-
13601
13654
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
13602
13655
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
13603
13656
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -13629,6 +13682,7 @@
13629
13682
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
13630
13683
  <xsl:template name="insertVerticalChar">
13631
13684
  <xsl:param name="str"/>
13685
+ <xsl:param name="char_prev"/>
13632
13686
  <xsl:param name="writing-mode">lr-tb</xsl:param>
13633
13687
  <xsl:param name="reference-orientation">90</xsl:param>
13634
13688
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -13638,53 +13692,99 @@
13638
13692
  </xsl:when>
13639
13693
  <xsl:otherwise>
13640
13694
  <xsl:if test="string-length($str) &gt; 0">
13641
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
13695
+
13696
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
13642
13697
  <xsl:variable name="char" select="substring($str,1,1)"/>
13643
- <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
13644
- <xsl:if test="normalize-space($writing-mode) != ''">
13645
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13646
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
13647
- </xsl:if>
13648
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13649
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
13650
- </xsl:if>
13651
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
13652
- <!-- Rotate 180°:
13653
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
13654
- U+3002 IDEOGRAPHIC FULL STOP (。)
13655
- U+FE52 SMALL FULL STOP (﹒)
13656
- U+FF0E FULLWIDTH FULL STOP ()
13657
- -->
13658
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
13659
- </xsl:if>
13660
- <fo:block-container width="1em">
13661
- <fo:block line-height="1em">
13662
- <xsl:choose>
13663
- <xsl:when test="$horizontal_mode = 'true'">
13664
- <xsl:value-of select="$str"/>
13665
- </xsl:when>
13666
- <xsl:otherwise>
13698
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
13699
+
13700
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
13701
+
13702
+ <xsl:choose>
13703
+ <xsl:when test="$char_half_width = 'true'">
13704
+ <fo:inline>
13705
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
13706
+ <xsl:value-of select="$char"/>
13707
+ </fo:inline>
13708
+ </xsl:when>
13709
+ <xsl:otherwise>
13710
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
13711
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
13712
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13713
+ </xsl:if>
13714
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP" text-align-last="center">
13715
+ <xsl:if test="normalize-space($writing-mode) != ''">
13716
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13717
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
13718
+ </xsl:if>
13719
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
13720
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
13721
+ </xsl:if>
13722
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
13723
+ <!-- Rotate 180°:
13724
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
13725
+ U+3002 IDEOGRAPHIC FULL STOP (。)
13726
+ U+FE52 SMALL FULL STOP (﹒)
13727
+ U+FF0E FULLWIDTH FULL STOP (.)
13728
+ -->
13729
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
13730
+ </xsl:if>
13731
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
13732
+ <fo:block line-height="1em" role="SKIP">
13733
+ <!-- <xsl:choose>
13734
+ <xsl:when test="$horizontal_mode = 'true'">
13735
+ <xsl:value-of select="$str"/>
13736
+ </xsl:when>
13737
+ <xsl:otherwise>
13738
+ <xsl:value-of select="$char"/>
13739
+ </xsl:otherwise>
13740
+ </xsl:choose> -->
13667
13741
  <xsl:value-of select="$char"/>
13668
- </xsl:otherwise>
13669
- </xsl:choose>
13670
- </fo:block>
13671
- </fo:block-container>
13672
- </fo:inline-container>
13673
- <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}')"><xsl:value-of select="$zero_width_space"/></xsl:if>
13674
-
13675
- <xsl:if test="$horizontal_mode = 'false'">
13676
- <xsl:call-template name="insertVerticalChar">
13677
- <xsl:with-param name="str" select="substring($str, 2)"/>
13678
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
13679
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13680
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
13681
- </xsl:call-template>
13682
- </xsl:if>
13742
+ </fo:block>
13743
+ </fo:block-container>
13744
+ </fo:inline-container>
13745
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
13746
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
13747
+ </xsl:if>
13748
+ </xsl:otherwise>
13749
+ </xsl:choose>
13750
+
13751
+ <xsl:if test="$add_zero_width_space = 'true' and ($char = ',' or $char = '.' or $char = ' ' or $char = '·' or $char = ')' or $char = ']' or $char = '}' or $char = '/')"><xsl:value-of select="$zero_width_space"/></xsl:if>
13752
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
13753
+ <xsl:call-template name="insertVerticalChar">
13754
+ <xsl:with-param name="str" select="substring($str, 2)"/>
13755
+ <xsl:with-param name="char_prev" select="$char"/>
13756
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
13757
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
13758
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
13759
+ </xsl:call-template>
13760
+ <!-- </xsl:if> -->
13683
13761
  </xsl:if>
13684
13762
  </xsl:otherwise>
13685
13763
  </xsl:choose>
13686
13764
  </xsl:template>
13687
13765
 
13766
+ <xsl:template name="insertHorizontalChars">
13767
+ <xsl:param name="str"/>
13768
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
13769
+ <xsl:param name="reference-orientation">90</xsl:param>
13770
+ <xsl:param name="add_zero_width_space">false</xsl:param>
13771
+ <xsl:choose>
13772
+ <xsl:otherwise>
13773
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm" role="SKIP">
13774
+ <xsl:if test="normalize-space($writing-mode) != ''">
13775
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
13776
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
13777
+ </xsl:if>
13778
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
13779
+ <fo:block line-height="1em" role="SKIP">
13780
+ <xsl:value-of select="$str"/>
13781
+ </fo:block>
13782
+ </fo:block-container>
13783
+ </fo:inline-container>
13784
+ </xsl:otherwise>
13785
+ </xsl:choose>
13786
+ </xsl:template>
13787
+
13688
13788
  <xsl:template name="number-to-words">
13689
13789
  <xsl:param name="number"/>
13690
13790
  <xsl:param name="first"/>
@@ -267,11 +267,11 @@ Detailed in https://www.relaton.org/model/creator/</a:documentation>
267
267
  <a:documentation>An identifier of the person according to an international identifier scheme</a:documentation>
268
268
  </ref>
269
269
  </zeroOrMore>
270
- <zeroOrMore>
270
+ <optional>
271
271
  <ref name="contact">
272
272
  <a:documentation>Contact information for the person, including URI, address, phone number, and email</a:documentation>
273
273
  </ref>
274
- </zeroOrMore>
274
+ </optional>
275
275
  </element>
276
276
  </define>
277
277
  <define name="fullname">
@@ -454,11 +454,11 @@ real names (if the person is named with a pseudonym or user name); previous lega
454
454
  <a:documentation>An identifier of the organization according to an international identifier scheme</a:documentation>
455
455
  </ref>
456
456
  </zeroOrMore>
457
- <zeroOrMore>
457
+ <optional>
458
458
  <ref name="contact">
459
459
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
460
460
  </ref>
461
- </zeroOrMore>
461
+ </optional>
462
462
  <optional>
463
463
  <ref name="logo">
464
464
  <a:documentation>A logo for the organization</a:documentation>
@@ -540,12 +540,18 @@ real names (if the person is named with a pseudonym or user name); previous lega
540
540
  <!-- TODO may change -->
541
541
  <define name="contact">
542
542
  <a:documentation>Contact information for a person or organization</a:documentation>
543
- <choice>
543
+ <zeroOrMore>
544
544
  <ref name="address"/>
545
+ </zeroOrMore>
546
+ <zeroOrMore>
545
547
  <ref name="phone"/>
548
+ </zeroOrMore>
549
+ <zeroOrMore>
546
550
  <ref name="email"/>
551
+ </zeroOrMore>
552
+ <zeroOrMore>
547
553
  <ref name="uri"/>
548
- </choice>
554
+ </zeroOrMore>
549
555
  </define>
550
556
  <define name="phone">
551
557
  <a:documentation>The phone number associated with a person or organization</a:documentation>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iho
3
- VERSION = "1.0.12".freeze
3
+ VERSION = "1.0.14".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -245,7 +245,7 @@ homepage: https://github.com/metanorma/metanorma-iho
245
245
  licenses:
246
246
  - BSD-2-Clause
247
247
  metadata: {}
248
- post_install_message:
248
+ post_install_message:
249
249
  rdoc_options: []
250
250
  require_paths:
251
251
  - lib
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  requirements: []
263
263
  rubygems_version: 3.3.27
264
- signing_key:
264
+ signing_key:
265
265
  specification_version: 4
266
266
  summary: metanorma-iho lets you write IHO in AsciiDoc.
267
267
  test_files: []