metanorma-bipm 2.5.8 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -360,7 +360,7 @@
360
360
 
361
361
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
362
362
 
363
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface']][normalize-space() != '' or .//image or .//svg]">
363
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface']][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
364
364
 
365
365
  <fo:page-sequence master-reference="document-jcgm" format="i">
366
366
 
@@ -392,7 +392,7 @@
392
392
 
393
393
  <xsl:for-each select="xalan:nodeset($updated_xml_with_pages)"> <!-- set context to preface -->
394
394
 
395
- <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface'])][normalize-space() != '' or .//image or .//svg]">
395
+ <xsl:for-each select=".//*[local-name() = 'page_sequence'][not(parent::*[local-name() = 'boilerplate'] or parent::*[local-name() = 'preface'])][normalize-space() != '' or .//*[local-name() = 'image'] or .//*[local-name() = 'svg']]">
396
396
 
397
397
  <!-- JCGM BODY -->
398
398
  <fo:page-sequence master-reference="document-jcgm" force-page-count="no-force">
@@ -5161,7 +5161,9 @@
5161
5161
  <fo:block role="SKIP">
5162
5162
 
5163
5163
  <xsl:if test="$isGenerateTableIF = 'true'">
5164
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5164
+
5165
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
5166
+
5165
5167
  </xsl:if>
5166
5168
 
5167
5169
  <xsl:apply-templates/>
@@ -6194,7 +6196,17 @@
6194
6196
  <xsl:call-template name="refine_dt-cell-style"/>
6195
6197
 
6196
6198
  <fo:block xsl:use-attribute-sets="dt-block-style" role="SKIP">
6197
- <xsl:copy-of select="@id"/>
6199
+
6200
+ <xsl:choose>
6201
+ <xsl:when test="$isGenerateTableIF = 'true'">
6202
+
6203
+ <xsl:copy-of select="@id"/>
6204
+
6205
+ </xsl:when>
6206
+ <xsl:otherwise>
6207
+ <xsl:copy-of select="@id"/>
6208
+ </xsl:otherwise>
6209
+ </xsl:choose>
6198
6210
 
6199
6211
  <xsl:if test="normalize-space($key_iso) = 'true'">
6200
6212
  <xsl:attribute name="margin-top">0</xsl:attribute>
@@ -6226,7 +6238,9 @@
6226
6238
  <fo:block role="SKIP">
6227
6239
 
6228
6240
  <xsl:if test="$isGenerateTableIF = 'true'">
6229
- <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6241
+
6242
+ <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
6243
+
6230
6244
  </xsl:if>
6231
6245
 
6232
6246
  <xsl:choose>
@@ -7467,6 +7481,14 @@
7467
7481
  </xsl:for-each>
7468
7482
  </xsl:variable>
7469
7483
 
7484
+ <!-- <xsl:if test="$debug = 'true'">
7485
+ <redirect:write file="{generate-id()}_words_with_width_sorted.xml">
7486
+ <td_text><xsl:copy-of select="$td_text"/></td_text>
7487
+ <words_with_width><xsl:copy-of select="$words_with_width"/></words_with_width>
7488
+ <xsl:copy-of select="$words_with_width_sorted"/>
7489
+ </redirect:write>
7490
+ </xsl:if> -->
7491
+
7470
7492
  <xsl:variable name="words">
7471
7493
  <xsl:for-each select=".//*[local-name() = 'image' or local-name() = 'stem']">
7472
7494
  <word>
@@ -7592,6 +7614,7 @@
7592
7614
  <xsl:if test="ancestor::*[local-name() = 'tt']"><tag>tt</tag></xsl:if>
7593
7615
  <xsl:if test="ancestor::*[local-name() = 'sourcecode']"><tag>sourcecode</tag></xsl:if>
7594
7616
  <xsl:if test="ancestor::*[local-name() = 'keep-together_within-line']"><tag>keep-together_within-line</tag></xsl:if>
7617
+ <xsl:if test="ancestor::*[local-name() = 'font_en_vertical']"><tag>font_en_vertical</tag></xsl:if>
7595
7618
  </tags>
7596
7619
  </xsl:template>
7597
7620
  <!-- =============================== -->
@@ -8139,7 +8162,16 @@
8139
8162
  </xsl:when>
8140
8163
  <xsl:otherwise>
8141
8164
  <!-- output text from <link>text</link> -->
8142
- <xsl:apply-templates/>
8165
+ <xsl:choose>
8166
+ <xsl:when test="starts-with(., 'http://') or starts-with(., 'https://') or starts-with(., 'www.')">
8167
+ <xsl:call-template name="add-zero-spaces-link-java">
8168
+ <xsl:with-param name="text" select="."/>
8169
+ </xsl:call-template>
8170
+ </xsl:when>
8171
+ <xsl:otherwise>
8172
+ <xsl:apply-templates/>
8173
+ </xsl:otherwise>
8174
+ </xsl:choose>
8143
8175
  </xsl:otherwise>
8144
8176
  </xsl:choose>
8145
8177
  </fo:basic-link>
@@ -8778,16 +8810,29 @@
8778
8810
  <xsl:template name="getImageSrc">
8779
8811
  <xsl:choose>
8780
8812
  <xsl:when test="not(starts-with(@src, 'data:'))">
8813
+ <xsl:call-template name="getImageSrcExternal"/>
8814
+ </xsl:when>
8815
+ <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8816
+ </xsl:choose>
8817
+ </xsl:template>
8818
+
8819
+ <xsl:template name="getImageSrcExternal">
8820
+ <xsl:choose>
8821
+ <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8822
+ <xsl:value-of select="@src"/>
8823
+ </xsl:when>
8824
+ <xsl:otherwise>
8825
+ <xsl:variable name="src_with_basepath" select="concat($basepath, @src)"/>
8826
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($src_with_basepath)))"/>
8781
8827
  <xsl:choose>
8782
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8783
- <xsl:value-of select="@src"/>
8828
+ <xsl:when test="$file_exists = 'true'">
8829
+ <xsl:value-of select="$src_with_basepath"/>
8784
8830
  </xsl:when>
8785
8831
  <xsl:otherwise>
8786
- <xsl:value-of select="concat($basepath, @src)"/>
8832
+ <xsl:value-of select="@src"/>
8787
8833
  </xsl:otherwise>
8788
8834
  </xsl:choose>
8789
- </xsl:when>
8790
- <xsl:otherwise><xsl:value-of select="@src"/></xsl:otherwise>
8835
+ </xsl:otherwise>
8791
8836
  </xsl:choose>
8792
8837
  </xsl:template>
8793
8838
 
@@ -8835,14 +8880,8 @@
8835
8880
  <xsl:value-of select="concat('url(file:///',$basepath, $src_png, ')')"/>
8836
8881
  </xsl:when>
8837
8882
  <xsl:when test="not(starts-with(@src, 'data:'))">
8838
- <xsl:choose>
8839
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8840
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8841
- </xsl:when>
8842
- <xsl:otherwise>
8843
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8844
- </xsl:otherwise>
8845
- </xsl:choose>
8883
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8884
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
8846
8885
  </xsl:when>
8847
8886
  <xsl:otherwise>
8848
8887
  <xsl:value-of select="@src"/>
@@ -8863,16 +8902,8 @@
8863
8902
  </svg>
8864
8903
  </xsl:when>
8865
8904
  <xsl:when test="not(starts-with(@src, 'data:'))">
8866
- <xsl:variable name="src">
8867
- <xsl:choose>
8868
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
8869
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
8870
- </xsl:when>
8871
- <xsl:otherwise>
8872
- <xsl:value-of select="concat('url(file:///',$basepath, @src, ')')"/>
8873
- </xsl:otherwise>
8874
- </xsl:choose>
8875
- </xsl:variable>
8905
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
8906
+ <xsl:variable name="src" select="concat('url(file:///', $src_external, ')')"/>
8876
8907
  <xsl:variable name="file" select="java:java.io.File.new(@src)"/>
8877
8908
  <xsl:variable name="bufferedImage" select="java:javax.imageio.ImageIO.read($file)"/>
8878
8909
  <xsl:variable name="width" select="java:getWidth($bufferedImage)"/>
@@ -13007,7 +13038,9 @@
13007
13038
  <xsl:template name="add_id">
13008
13039
  <xsl:if test="not(@id)">
13009
13040
  <!-- add @id - first element with @id plus '_element_name' -->
13010
- <xsl:attribute name="id"><xsl:value-of select="(.//*[@id])[1]/@id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13041
+ <xsl:variable name="prefix_id_" select="(.//*[@id])[1]/@id"/>
13042
+ <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>
13043
+ <xsl:attribute name="id"><xsl:value-of select="$prefix_id"/>_<xsl:value-of select="local-name()"/></xsl:attribute>
13011
13044
  </xsl:if>
13012
13045
  </xsl:template>
13013
13046
 
@@ -14310,6 +14343,7 @@
14310
14343
  <xsl:param name="formatted">false</xsl:param>
14311
14344
  <xsl:param name="lang"/>
14312
14345
  <xsl:param name="returnEmptyIfNotFound">false</xsl:param>
14346
+ <xsl:param name="bibdata_updated"/>
14313
14347
 
14314
14348
  <xsl:variable name="curr_lang">
14315
14349
  <xsl:choose>
@@ -14323,6 +14357,9 @@
14323
14357
 
14324
14358
  <xsl:variable name="data_value">
14325
14359
  <xsl:choose>
14360
+ <xsl:when test="$formatted = 'true' and string-length($bibdata_updated) != ''">
14361
+ <xsl:apply-templates select="xalan:nodeset($bibdata_updated)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14362
+ </xsl:when>
14326
14363
  <xsl:when test="$formatted = 'true'">
14327
14364
  <xsl:apply-templates select="xalan:nodeset($bibdata)//*[local-name() = 'localized-string'][@key = $key and @language = $curr_lang]"/>
14328
14365
  </xsl:when>
@@ -14494,14 +14531,8 @@
14494
14531
  <xsl:value-of select="$src"/>
14495
14532
  </xsl:when>
14496
14533
  <xsl:otherwise>
14497
- <xsl:choose>
14498
- <xsl:when test="@extracted = 'true'"> <!-- added in mn2pdf v1.97 -->
14499
- <xsl:value-of select="concat('url(file:///', @src, ')')"/>
14500
- </xsl:when>
14501
- <xsl:otherwise>
14502
- <xsl:value-of select="concat('url(file:///',$basepath, $src, ')')"/>
14503
- </xsl:otherwise>
14504
- </xsl:choose>
14534
+ <xsl:variable name="src_external"><xsl:call-template name="getImageSrcExternal"/></xsl:variable>
14535
+ <xsl:value-of select="concat('url(file:///', $src_external, ')')"/>
14505
14536
  </xsl:otherwise>
14506
14537
  </xsl:choose>
14507
14538
  </xsl:template>
@@ -14523,15 +14554,23 @@
14523
14554
  <!-- END: insert cover page image -->
14524
14555
 
14525
14556
  <!-- https://github.com/metanorma/docs/blob/main/109.adoc -->
14557
+ <xsl:variable name="regex_ja_spec_half_width_">
14558
+ \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14559
+ \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14560
+ \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14561
+ \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14562
+ \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14563
+ \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14564
+ \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14565
+ \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14566
+ </xsl:variable>
14567
+ <xsl:variable name="regex_ja_spec_half_width" select="translate(normalize-space($regex_ja_spec_half_width_), ' ', '')"/>
14526
14568
  <xsl:variable name="regex_ja_spec_">[
14527
14569
  <!-- Rotate 90° clockwise -->
14528
- \u0028 <!-- U+0028 LEFT PARENTHESIS (() -->
14570
+ <xsl:value-of select="$regex_ja_spec_half_width"/>
14529
14571
  \uFF08 <!-- U+FF08 FULLWIDTH LEFT PARENTHESIS (() -->
14530
- \u0029 <!-- U+0029 RIGHT PARENTHESIS ()) -->
14531
14572
  \uFF09 <!-- U+FF09 FULLWIDTH RIGHT PARENTHESIS ()) -->
14532
- \u007B <!-- U+007B LEFT CURLY BRACKET ({) -->
14533
14573
  \uFF5B <!-- U+FF5B FULLWIDTH LEFT CURLY BRACKET ({) -->
14534
- \u007D <!-- U+007D RIGHT CURLY BRACKET (}) -->
14535
14574
  \uFF5D <!-- U+FF5D FULLWIDTH RIGHT CURLY BRACKET (}) -->
14536
14575
  \u3014 <!-- U+3014 LEFT TORTOISE SHELL BRACKET (〔) -->
14537
14576
  \u3015 <!-- U+3015 RIGHT TORTOISE SHELL BRACKET (〕) -->
@@ -14539,21 +14578,16 @@
14539
14578
  \u3011 <!-- U+3011 RIGHT BLACK LENTICULAR BRACKET (】) -->
14540
14579
  \u300A <!-- U+300A LEFT DOUBLE ANGLE BRACKET (《) -->
14541
14580
  \u300B <!-- U+300B RIGHT DOUBLE ANGLE BRACKET (》) -->
14542
- \uFF62 <!-- U+FF62 HALFWIDTH LEFT CORNER BRACKET (「) -->
14543
14581
  \u300C <!-- U+300C LEFT CORNER BRACKET (「) -->
14544
- \uFF63 <!-- U+FF63 HALFWIDTH RIGHT CORNER BRACKET (」) -->
14545
14582
  \u300D <!-- U+300D RIGHT CORNER BRACKET (」) -->
14546
14583
  \u300E <!-- U+300E LEFT WHITE CORNER BRACKET (『) -->
14547
14584
  \u300F <!-- U+300F RIGHT WHITE CORNER BRACKET (』) -->
14548
- \u005B <!-- U+005B LEFT SQUARE BRACKET ([) -->
14549
14585
  \uFF3B <!-- U+FF3B FULLWIDTH LEFT SQUARE BRACKET ([) -->
14550
- \u005D <!-- U+005D RIGHT SQUARE BRACKET (]) -->
14551
14586
  \uFF3D <!-- U+FF3D FULLWIDTH RIGHT SQUARE BRACKET (]) -->
14552
14587
  \u3008 <!-- U+3008 LEFT ANGLE BRACKET (〈) -->
14553
14588
  \u3009 <!-- U+3009 RIGHT ANGLE BRACKET (〉) -->
14554
14589
  \u3016 <!-- U+3016 LEFT WHITE LENTICULAR BRACKET (〖) -->
14555
14590
  \u3017 <!-- U+3017 RIGHT WHITE LENTICULAR BRACKET (〗) -->
14556
-
14557
14591
  \u301A <!-- U+301A LEFT WHITE SQUARE BRACKET (〚) -->
14558
14592
  \u301B <!-- U+301B RIGHT WHITE SQUARE BRACKET (〛) -->
14559
14593
  \u301C <!-- U+301C WAVE DASH (〜) -->
@@ -14585,6 +14619,7 @@
14585
14619
  <xsl:variable name="regex_ja_spec"><xsl:value-of select="translate(normalize-space($regex_ja_spec_), ' ', '')"/></xsl:variable>
14586
14620
  <xsl:template name="insertVerticalChar">
14587
14621
  <xsl:param name="str"/>
14622
+ <xsl:param name="char_prev"/>
14588
14623
  <xsl:param name="writing-mode">lr-tb</xsl:param>
14589
14624
  <xsl:param name="reference-orientation">90</xsl:param>
14590
14625
  <xsl:param name="add_zero_width_space">false</xsl:param>
@@ -14594,53 +14629,99 @@
14594
14629
  </xsl:when>
14595
14630
  <xsl:otherwise>
14596
14631
  <xsl:if test="string-length($str) &gt; 0">
14597
- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/>
14632
+
14633
+ <!-- <xsl:variable name="horizontal_mode" select="normalize-space(ancestor::*[local-name() = 'span'][@class = 'horizontal'] and 1 = 1)"/> -->
14598
14634
  <xsl:variable name="char" select="substring($str,1,1)"/>
14599
- <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">
14600
- <xsl:if test="normalize-space($writing-mode) != ''">
14601
- <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14602
- <xsl:attribute name="reference-orientation">90</xsl:attribute>
14603
- </xsl:if>
14604
- <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14605
- <xsl:attribute name="reference-orientation">0</xsl:attribute>
14606
- </xsl:if>
14607
- <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14608
- <!-- Rotate 180°:
14609
- U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14610
- U+3002 IDEOGRAPHIC FULL STOP (。)
14611
- U+FE52 SMALL FULL STOP (﹒)
14612
- U+FF0E FULLWIDTH FULL STOP ()
14613
- -->
14614
- <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14615
- </xsl:if>
14616
- <fo:block-container width="1em">
14617
- <fo:block line-height="1em">
14618
- <xsl:choose>
14619
- <xsl:when test="$horizontal_mode = 'true'">
14620
- <xsl:value-of select="$str"/>
14621
- </xsl:when>
14622
- <xsl:otherwise>
14635
+ <xsl:variable name="char_next" select="substring($str,2,1)"/>
14636
+
14637
+ <xsl:variable name="char_half_width" select="normalize-space(java:matches(java:java.lang.String.new($char), concat('([', $regex_ja_spec_half_width, ']{1,})')))"/>
14638
+
14639
+ <xsl:choose>
14640
+ <xsl:when test="$char_half_width = 'true'">
14641
+ <fo:inline>
14642
+ <xsl:attribute name="baseline-shift">7%</xsl:attribute>
14643
+ <xsl:value-of select="$char"/>
14644
+ </fo:inline>
14645
+ </xsl:when>
14646
+ <xsl:otherwise>
14647
+ <!-- namespace-uri(ancestor::*[local-name() = 'title']) != '' to skip title from $contents -->
14648
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_prev = '' and ../preceding-sibling::node())">
14649
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14650
+ </xsl:if>
14651
+ <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">
14652
+ <xsl:if test="normalize-space($writing-mode) != ''">
14653
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14654
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14655
+ </xsl:if>
14656
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14657
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14658
+ </xsl:if>
14659
+ <xsl:if test="$char = '゜' or $char = '。' or $char = '﹒' or $char = '.'">
14660
+ <!-- Rotate 180°:
14661
+ U+309C KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK (゜)
14662
+ U+3002 IDEOGRAPHIC FULL STOP (。)
14663
+ U+FE52 SMALL FULL STOP (﹒)
14664
+ U+FF0E FULLWIDTH FULL STOP (.)
14665
+ -->
14666
+ <xsl:attribute name="reference-orientation">-90</xsl:attribute>
14667
+ </xsl:if>
14668
+ <fo:block-container width="1em" role="SKIP"><!-- border="0.5pt solid blue" -->
14669
+ <fo:block line-height="1em" role="SKIP">
14670
+ <!-- <xsl:choose>
14671
+ <xsl:when test="$horizontal_mode = 'true'">
14672
+ <xsl:value-of select="$str"/>
14673
+ </xsl:when>
14674
+ <xsl:otherwise>
14675
+ <xsl:value-of select="$char"/>
14676
+ </xsl:otherwise>
14677
+ </xsl:choose> -->
14623
14678
  <xsl:value-of select="$char"/>
14624
- </xsl:otherwise>
14625
- </xsl:choose>
14626
- </fo:block>
14627
- </fo:block-container>
14628
- </fo:inline-container>
14629
- <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>
14630
-
14631
- <xsl:if test="$horizontal_mode = 'false'">
14632
- <xsl:call-template name="insertVerticalChar">
14633
- <xsl:with-param name="str" select="substring($str, 2)"/>
14634
- <xsl:with-param name="writing-mode" select="$writing-mode"/>
14635
- <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14636
- <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14637
- </xsl:call-template>
14638
- </xsl:if>
14679
+ </fo:block>
14680
+ </fo:block-container>
14681
+ </fo:inline-container>
14682
+ <xsl:if test="namespace-uri(ancestor::*[local-name() = 'title']) != '' and ($char_next != '' or ../following-sibling::node())">
14683
+ <fo:inline padding-left="1mm"><xsl:value-of select="$zero_width_space"/></fo:inline>
14684
+ </xsl:if>
14685
+ </xsl:otherwise>
14686
+ </xsl:choose>
14687
+
14688
+ <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>
14689
+ <!-- <xsl:if test="$horizontal_mode = 'false'"> -->
14690
+ <xsl:call-template name="insertVerticalChar">
14691
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14692
+ <xsl:with-param name="char_prev" select="$char"/>
14693
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14694
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14695
+ <xsl:with-param name="add_zero_width_space" select="$add_zero_width_space"/>
14696
+ </xsl:call-template>
14697
+ <!-- </xsl:if> -->
14639
14698
  </xsl:if>
14640
14699
  </xsl:otherwise>
14641
14700
  </xsl:choose>
14642
14701
  </xsl:template>
14643
14702
 
14703
+ <xsl:template name="insertHorizontalChars">
14704
+ <xsl:param name="str"/>
14705
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
14706
+ <xsl:param name="reference-orientation">90</xsl:param>
14707
+ <xsl:param name="add_zero_width_space">false</xsl:param>
14708
+ <xsl:choose>
14709
+ <xsl:otherwise>
14710
+ <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">
14711
+ <xsl:if test="normalize-space($writing-mode) != ''">
14712
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14713
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14714
+ </xsl:if>
14715
+ <fo:block-container width="1em" role="SKIP"> <!-- border="0.5pt solid green" -->
14716
+ <fo:block line-height="1em" role="SKIP">
14717
+ <xsl:value-of select="$str"/>
14718
+ </fo:block>
14719
+ </fo:block-container>
14720
+ </fo:inline-container>
14721
+ </xsl:otherwise>
14722
+ </xsl:choose>
14723
+ </xsl:template>
14724
+
14644
14725
  <xsl:template name="number-to-words">
14645
14726
  <xsl:param name="number"/>
14646
14727
  <xsl:param name="first"/>
@@ -2,7 +2,6 @@ require "isodoc"
2
2
  require "metanorma-generic"
3
3
  require "metanorma-iso"
4
4
  require_relative "init"
5
- require_relative "index"
6
5
  require_relative "doccontrol"
7
6
  require_relative "../../relaton/render/general"
8
7
  require_relative "presentation_blocks"
@@ -33,16 +32,6 @@ module IsoDoc
33
32
  super
34
33
  end
35
34
 
36
- # KILL
37
- def annex1x(elem)
38
- @jcgm and return super
39
- elem["unnumbered"] == "true" and return
40
- lbl = @xrefs.anchor(elem["id"], :label)
41
- t = elem.at(ns("./title")) and
42
- t.children = "<strong>#{to_xml(t.children)}</strong>"
43
- prefix_name(elem, ".<tab/>", lbl, "title")
44
- end
45
-
46
35
  def annex_delim(elem)
47
36
  @jcgm and return super
48
37
  ".<tab/>"
@@ -63,19 +52,6 @@ module IsoDoc
63
52
  super
64
53
  end
65
54
 
66
- # KILL
67
- def prefix_namex(node, delims, number, elem)
68
- number.nil? || number.empty? and return
69
- unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
70
- node.at(ns("./#{elem}[@type = 'quoted']")) and return
71
- node.add_first_child "<#{elem}></#{elem}>"
72
- name = node.children.first
73
- end
74
- if name.children.empty? then name.add_child(cleanup_entities(number))
75
- else (name.children.first.previous = "#{number}#{delim}")
76
- end
77
- end
78
-
79
55
  def prefix_name(node, delims, number, elem)
80
56
  if n = node.at(ns("./#{elem}[@type = 'quoted']"))
81
57
  n1 = n.dup
@@ -204,6 +180,24 @@ module IsoDoc
204
180
  termsource_add_modification_text(elem.at(ns("./modification")))
205
181
  end
206
182
 
183
+ def enable_indexsect
184
+ true
185
+ end
186
+
187
+ def index1(docxml, indexsect, index)
188
+ index.keys.sort.each do |k|
189
+ c = indexsect.add_child "<clause #{add_id}><title>#{k}</title><ul></ul></clause>"
190
+ words = index[k].keys.each_with_object({}) do |w, v|
191
+ v[sortable(w).downcase] = w
192
+ end
193
+ words.keys.localize(@lang.to_sym).sort.to_a.each do |w|
194
+ c.first.at(ns("./ul")).add_child index_entries(words, index[k], w)
195
+ end
196
+ end
197
+ docxml.xpath(ns("//indexsect//xref")).each { |x| x.children.remove }
198
+ @xrefs.bookmark_anchor_names(docxml)
199
+ end
200
+
207
201
  include Init
208
202
  end
209
203
  end
@@ -59,14 +59,6 @@ module IsoDoc
59
59
  "./term[#{UNNUM}] | ./terms[#{UNNUM}] | " \
60
60
  "./definitions[#{UNNUM}]".freeze
61
61
 
62
- # KILL
63
- def section_name_anchors(clause, num, lvl)
64
- lbl = @jcgm ? "clause_jcgm" : "clause"
65
- @anchors[clause["id"]] =
66
- { label: num.print, xref: l10n("#{@labels[lbl]} #{num.print}"),
67
- level: lvl, type: "clause", elem: @labels[lbl] }
68
- end
69
-
70
62
  def section_name_anchors(clause, num, level)
71
63
  lbl = @jcgm ? "clause_jcgm" : "clause"
72
64
  xref = labelled_autonum(@labels[lbl], num)
@@ -77,21 +69,6 @@ module IsoDoc
77
69
  elem: @labels[lbl] }
78
70
  end
79
71
 
80
- # KILL
81
- def section_names(clause, num, lvl)
82
- clause.nil? and return num
83
- num.increment(clause)
84
- @anchors[clause["id"]] = section_name_anchors(clause, num, lvl)
85
- i = Counter.new(0, prefix: num.print)
86
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
87
- section_names1(c, i.increment(c).print, lvl + 1)
88
- end
89
- clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
90
- unnumbered_section_names1(c, lvl + 1)
91
- end
92
- num
93
- end
94
-
95
72
  def section_names(clause, num, lvl)
96
73
  unnumbered_section_name?(clause) and return num
97
74
  num.increment(clause)
@@ -135,7 +112,7 @@ module IsoDoc
135
112
  section_names1(c, lbl, i.increment(c).print, level + 1)
136
113
  end
137
114
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
138
- unnumbered_section_names1(c, lvl + 1)
115
+ unnumbered_section_names1(c, level + 1)
139
116
  end
140
117
  end
141
118
 
@@ -180,7 +157,7 @@ module IsoDoc
180
157
  @anchors[clause["id"]] = annex_name_anchors(clause, lbl)
181
158
  if @klass.single_term_clause?(clause)
182
159
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
183
- lbl, 1)
160
+ nil, "#{prefix}#{num}", 1)
184
161
  else
185
162
  i = Counter.new(0)
186
163
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
@@ -202,8 +179,8 @@ module IsoDoc
202
179
  lbl = semx(clause, lbl, "title")
203
180
  @anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
204
181
  if @klass.single_term_clause?(clause)
205
- annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
206
- num.to_s, 1)
182
+ unnumbered_annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
183
+ 1)
207
184
  else
208
185
  clause.xpath(ns(SUBCLAUSES))
209
186
  .each { |c| unnumbered_annex_names1(c, 2) }
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Bipm
3
- VERSION = "2.5.8".freeze
3
+ VERSION = "2.5.9".freeze
4
4
  end
5
5
  end
@@ -25,14 +25,14 @@ template:
25
25
  # TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
26
26
  journal: "<em>{{ title}}</em> [{{medium}}] . ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). ({{date}}). {{size}}. {{extent}}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
27
27
  # TODO subsidiary titles, rights metadata, item attributes, relationships
28
- article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ series }}. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
28
+ article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ title }}. <em>{{ series }}</em>. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
29
29
  # TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
30
30
  software: "{{ creatornames }} ({{ role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} {{draft}} . [{{medium | capitalize}}]. ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
31
31
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
32
32
  electronic resource: software
33
- standard: "{% if home_standard %}<em>{{title}}</em>, _{{extent}}{%else%}{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} {{ series }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}].{%endif%}"
33
+ standard: "{% if home_standard %}<em>{{title}}</em>, _{{extent}}{%else%}{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}].{%endif%}"
34
34
  # TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, persistent identifier, item attributes, relationships
35
- techreport: "{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} {{ series }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
35
+ techreport: "{% if creatornames %}{{ creatornames }} ({{ role | capitalize}}){%else%}{{ publisher}}{%endif%} . ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> ({{nistpublisher}}), {{draft }} . [{{ medium | capitalize }}]. {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
36
36
  dataset: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} [{{medium }}]. {{ labels['in'] | capitalize }}:_{{series}}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ size }}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
37
37
  # TODO: omitted: author ids, system requirements, host archive, copyright, license, data source, distributor, usage instructions, relationships, provenance
38
38
  website: "{{ creatornames }} ({{ role | capitalize }}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} [{{medium }}] ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}) {{ draft }} . {{ authoritative_identifier | join: '. ' }}. {{ uri }}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.8
4
+ version: 2.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-12-10 00:00:00.000000000 Z
11
+ date: 2024-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -266,7 +266,6 @@ files:
266
266
  - lib/isodoc/bipm/i18n-en.yaml
267
267
  - lib/isodoc/bipm/i18n-fr.yaml
268
268
  - lib/isodoc/bipm/i18n.rb
269
- - lib/isodoc/bipm/index.rb
270
269
  - lib/isodoc/bipm/init.rb
271
270
  - lib/isodoc/bipm/jcgm.standard.xsl
272
271
  - lib/isodoc/bipm/metadata.rb