metanorma-cc 2.4.5 → 2.4.6

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: cd1570c8a37a6ec0bcd7e15acd14836d3541d7688eef69fb191b9bc0deb3c8b5
4
- data.tar.gz: ffd05f720ddb23f881a45a42f8a61cf5ee1337e7d5025c10160adc4cf395b084
3
+ metadata.gz: 8ef050243a3a0899b2e8c49e156320fa698b24accdbcb338e24f699c02315003
4
+ data.tar.gz: c534fe646b808872dd71f9bebec16aa6107c649fa5fd56e6633915c9e0183625
5
5
  SHA512:
6
- metadata.gz: 12d79a97ae2a07b027eb5ad2c628676ca5fd6b652bea3dfe2bd7798d0b8fadece4b8e42a73a7c0ab6f915d2c894e16993547c949dbffee6b434cbc0e14ad01dd
7
- data.tar.gz: 42406628678a495a575224b602072bfa564325aeb3150241323f7d611690073c540f6a8b499e8a6e43693f792e69864128b17cdcf957cb17a99e311f945722fb
6
+ metadata.gz: 33e79e69d60d689509211a7899250bc46065677f9585377bd90ef5f0a4194badb3a1b7937b4945b2a8261a3de51d8567d61937dba806ed80e155815cbc2eeac7
7
+ data.tar.gz: 808f2f3e374606facb56c1d5cd19f0e81414a0a7fc05e1a971d396871fdbc58e65c11ef1732436e353ac1b26d23206bef0030093b2eaed8f95db762d8ed5355b
@@ -593,17 +593,30 @@
593
593
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
594
594
 
595
595
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
596
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
596
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
597
597
  <!-- Example: <tables>
598
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
599
- <tbody>
600
- <tr>
601
- <td id="tab-symdu_1_1">
602
- <p_len>6</p_len>
603
- <p_len>100</p_len> for 2nd paragraph
604
- <word_len>6</word_len>
605
- <word_len>20</word_len>
606
- ...
598
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
599
+ <column width_max="39354" width_min="39354"/>
600
+ <column width_max="75394" width_min="75394"/>
601
+ <column width_max="108813" width_min="108813"/>
602
+ <tbody>
603
+ <tr>
604
+ <td width_max="39354" width_min="39354">
605
+ <p_len>39354</p_len>
606
+ <word_len>39354</word_len>
607
+ </td>
608
+
609
+ OLD:
610
+ <tables>
611
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
612
+ <tbody>
613
+ <tr>
614
+ <td id="tab-symdu_1_1">
615
+ <p_len>6</p_len>
616
+ <p_len>100</p_len> for 2nd paragraph
617
+ <word_len>6</word_len>
618
+ <word_len>20</word_len>
619
+ ...
607
620
  -->
608
621
 
609
622
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -823,6 +836,9 @@
823
836
  <xsl:variable name="hair_space"> </xsl:variable>
824
837
  <xsl:variable name="en_dash">–</xsl:variable>
825
838
  <xsl:variable name="em_dash">—</xsl:variable>
839
+ <xsl:variable name="cr">&#13;</xsl:variable>
840
+ <xsl:variable name="lf">
841
+ </xsl:variable>
826
842
 
827
843
  <xsl:template name="getTitle">
828
844
  <xsl:param name="name"/>
@@ -2440,6 +2456,20 @@
2440
2456
  </xsl:for-each>
2441
2457
  </xsl:template>
2442
2458
 
2459
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2460
+
2461
+ <xsl:template match="*[local-name()='table']" priority="2">
2462
+ <xsl:choose>
2463
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2464
+ <xsl:call-template name="table"/>
2465
+ </xsl:when>
2466
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2467
+ <xsl:otherwise>
2468
+ <xsl:call-template name="table"/>
2469
+ </xsl:otherwise>
2470
+ </xsl:choose>
2471
+ </xsl:template>
2472
+
2443
2473
  <xsl:template match="*[local-name()='table']" name="table">
2444
2474
 
2445
2475
  <xsl:variable name="table-preamble">
@@ -2449,9 +2479,11 @@
2449
2479
  <xsl:variable name="table">
2450
2480
 
2451
2481
  <xsl:variable name="simple-table">
2452
- <xsl:call-template name="getSimpleTable">
2453
- <xsl:with-param name="id" select="@id"/>
2454
- </xsl:call-template>
2482
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2483
+ <xsl:call-template name="getSimpleTable">
2484
+ <xsl:with-param name="id" select="@id"/>
2485
+ </xsl:call-template>
2486
+ </xsl:if>
2455
2487
  </xsl:variable>
2456
2488
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2457
2489
 
@@ -2547,9 +2579,9 @@
2547
2579
  </xsl:attribute>
2548
2580
  </xsl:for-each>
2549
2581
 
2550
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2582
+ <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'][not(@type = 'units')] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2551
2583
  <xsl:if test="$isNoteOrFnExist = 'true'">
2552
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2584
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2553
2585
  </xsl:if>
2554
2586
 
2555
2587
  <xsl:choose>
@@ -2702,9 +2734,28 @@
2702
2734
 
2703
2735
  </fo:block>
2704
2736
 
2737
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
2738
+ <xsl:if test="$continued = 'true'">
2739
+ <fo:block text-align="right">
2740
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
2741
+ </fo:block>
2742
+ </xsl:if>
2743
+ <!-- </xsl:if> -->
2744
+
2705
2745
  </xsl:if>
2706
2746
  </xsl:template> <!-- table/name -->
2707
2747
 
2748
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
2749
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
2750
+ <xsl:choose>
2751
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
2752
+ <!-- remove CR or LF at start -->
2753
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
2754
+ </xsl:when>
2755
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2756
+ </xsl:choose>
2757
+ </xsl:template>
2758
+
2708
2759
  <!-- SOURCE: ... -->
2709
2760
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2710
2761
  <xsl:call-template name="termsource"/>
@@ -3115,7 +3166,7 @@
3115
3166
  <xsl:param name="colwidths"/>
3116
3167
  <xsl:param name="colgroup"/>
3117
3168
 
3118
- <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3169
+ <xsl:variable name="isNoteOrFnExist" select="../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example'] or ../*[local-name()='dl'] or ..//*[local-name()='fn'][local-name(..) != 'name'] or ../*[local-name()='source'] or ../*[local-name()='p']"/>
3119
3170
 
3120
3171
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3121
3172
 
@@ -3187,7 +3238,7 @@
3187
3238
 
3188
3239
  <xsl:apply-templates select="../*[local-name()='p']"/>
3189
3240
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3190
- <xsl:apply-templates select="../*[local-name()='note']"/>
3241
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3191
3242
  <xsl:apply-templates select="../*[local-name()='example']"/>
3192
3243
  <xsl:apply-templates select="../*[local-name()='source']"/>
3193
3244
 
@@ -3197,7 +3248,7 @@
3197
3248
 
3198
3249
  <!-- horizontal row separator -->
3199
3250
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3200
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3251
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3201
3252
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3202
3253
 
3203
3254
  <xsl:call-template name="setBordersTableArray"/>
@@ -3862,7 +3913,20 @@
3862
3913
  <!-- Definition List -->
3863
3914
  <!-- ===================== -->
3864
3915
 
3865
- <xsl:template match="*[local-name()='dl']">
3916
+ <!-- for table auto-layout algorithm -->
3917
+ <xsl:template match="*[local-name()='dl']" priority="2">
3918
+ <xsl:choose>
3919
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
3920
+ <xsl:call-template name="dl"/>
3921
+ </xsl:when>
3922
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
3923
+ <xsl:otherwise>
3924
+ <xsl:call-template name="dl"/>
3925
+ </xsl:otherwise>
3926
+ </xsl:choose>
3927
+ </xsl:template>
3928
+
3929
+ <xsl:template match="*[local-name()='dl']" name="dl">
3866
3930
  <xsl:variable name="isAdded" select="@added"/>
3867
3931
  <xsl:variable name="isDeleted" select="@deleted"/>
3868
3932
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -5794,7 +5858,13 @@
5794
5858
  <xsl:value-of select="$language_current_2"/>
5795
5859
  </xsl:when>
5796
5860
  <xsl:otherwise>
5797
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
5861
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
5862
+ <xsl:choose>
5863
+ <xsl:when test="$language_current_3 != ''">
5864
+ <xsl:value-of select="$language_current_3"/>
5865
+ </xsl:when>
5866
+ <xsl:otherwise>en</xsl:otherwise>
5867
+ </xsl:choose>
5798
5868
  </xsl:otherwise>
5799
5869
  </xsl:choose>
5800
5870
  </xsl:otherwise>
@@ -6695,7 +6765,7 @@
6695
6765
  </xsl:when>
6696
6766
  <xsl:otherwise>
6697
6767
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6698
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
6768
+ <xsl:if test="not(@mimetype = 'image/svg+xml') and (../*[local-name() = 'name'] or parent::*[local-name() = 'figure'][@unnumbered = 'true']) and not(ancestor::*[local-name() = 'table'])">
6699
6769
 
6700
6770
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6701
6771
  <xsl:attribute name="width">
@@ -11728,6 +11798,4 @@
11728
11798
  </xsl:if>
11729
11799
  </xsl:template>
11730
11800
 
11731
- <!-- update -->
11732
-
11733
11801
  </xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.4.5".freeze
3
+ VERSION = "2.4.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-cc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5
4
+ version: 2.4.6
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-03-25 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic