metanorma-ogc 2.5.5 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -660,17 +660,30 @@
660
660
  <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 -->
661
661
 
662
662
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
663
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
663
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
664
664
  <!-- Example: <tables>
665
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
666
- <tbody>
667
- <tr>
668
- <td id="tab-symdu_1_1">
669
- <p_len>6</p_len>
670
- <p_len>100</p_len> for 2nd paragraph
671
- <word_len>6</word_len>
672
- <word_len>20</word_len>
673
- ...
665
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
666
+ <column width_max="39354" width_min="39354"/>
667
+ <column width_max="75394" width_min="75394"/>
668
+ <column width_max="108813" width_min="108813"/>
669
+ <tbody>
670
+ <tr>
671
+ <td width_max="39354" width_min="39354">
672
+ <p_len>39354</p_len>
673
+ <word_len>39354</word_len>
674
+ </td>
675
+
676
+ OLD:
677
+ <tables>
678
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
679
+ <tbody>
680
+ <tr>
681
+ <td id="tab-symdu_1_1">
682
+ <p_len>6</p_len>
683
+ <p_len>100</p_len> for 2nd paragraph
684
+ <word_len>6</word_len>
685
+ <word_len>20</word_len>
686
+ ...
674
687
  -->
675
688
 
676
689
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -890,6 +903,9 @@
890
903
  <xsl:variable name="hair_space"> </xsl:variable>
891
904
  <xsl:variable name="en_dash">–</xsl:variable>
892
905
  <xsl:variable name="em_dash">—</xsl:variable>
906
+ <xsl:variable name="cr">&#13;</xsl:variable>
907
+ <xsl:variable name="lf">
908
+ </xsl:variable>
893
909
 
894
910
  <xsl:template name="getTitle">
895
911
  <xsl:param name="name"/>
@@ -2663,6 +2679,20 @@
2663
2679
  </xsl:for-each>
2664
2680
  </xsl:template>
2665
2681
 
2682
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
2683
+
2684
+ <xsl:template match="*[local-name()='table']" priority="2">
2685
+ <xsl:choose>
2686
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
2687
+ <xsl:call-template name="table"/>
2688
+ </xsl:when>
2689
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
2690
+ <xsl:otherwise>
2691
+ <xsl:call-template name="table"/>
2692
+ </xsl:otherwise>
2693
+ </xsl:choose>
2694
+ </xsl:template>
2695
+
2666
2696
  <xsl:template match="*[local-name()='table']" name="table">
2667
2697
 
2668
2698
  <xsl:variable name="table-preamble">
@@ -2672,9 +2702,11 @@
2672
2702
  <xsl:variable name="table">
2673
2703
 
2674
2704
  <xsl:variable name="simple-table">
2675
- <xsl:call-template name="getSimpleTable">
2676
- <xsl:with-param name="id" select="@id"/>
2677
- </xsl:call-template>
2705
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
2706
+ <xsl:call-template name="getSimpleTable">
2707
+ <xsl:with-param name="id" select="@id"/>
2708
+ </xsl:call-template>
2709
+ </xsl:if>
2678
2710
  </xsl:variable>
2679
2711
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
2680
2712
 
@@ -2774,9 +2806,9 @@
2774
2806
  </xsl:attribute>
2775
2807
  </xsl:for-each>
2776
2808
 
2777
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
2809
+ <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']"/>
2778
2810
  <xsl:if test="$isNoteOrFnExist = 'true'">
2779
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
2811
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
2780
2812
  </xsl:if>
2781
2813
 
2782
2814
  <xsl:choose>
@@ -2927,9 +2959,28 @@
2927
2959
 
2928
2960
  </fo:block>
2929
2961
 
2962
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
2963
+ <xsl:if test="$continued = 'true'">
2964
+ <fo:block text-align="right">
2965
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
2966
+ </fo:block>
2967
+ </xsl:if>
2968
+ <!-- </xsl:if> -->
2969
+
2930
2970
  </xsl:if>
2931
2971
  </xsl:template> <!-- table/name -->
2932
2972
 
2973
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
2974
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
2975
+ <xsl:choose>
2976
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
2977
+ <!-- remove CR or LF at start -->
2978
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
2979
+ </xsl:when>
2980
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
2981
+ </xsl:choose>
2982
+ </xsl:template>
2983
+
2933
2984
  <!-- SOURCE: ... -->
2934
2985
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
2935
2986
  <xsl:call-template name="termsource"/>
@@ -3340,7 +3391,7 @@
3340
3391
  <xsl:param name="colwidths"/>
3341
3392
  <xsl:param name="colgroup"/>
3342
3393
 
3343
- <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']"/>
3394
+ <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']"/>
3344
3395
 
3345
3396
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
3346
3397
 
@@ -3412,7 +3463,7 @@
3412
3463
 
3413
3464
  <xsl:apply-templates select="../*[local-name()='p']"/>
3414
3465
  <xsl:apply-templates select="../*[local-name()='dl']"/>
3415
- <xsl:apply-templates select="../*[local-name()='note']"/>
3466
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
3416
3467
  <xsl:apply-templates select="../*[local-name()='example']"/>
3417
3468
  <xsl:apply-templates select="../*[local-name()='source']"/>
3418
3469
 
@@ -3422,7 +3473,7 @@
3422
3473
 
3423
3474
  <!-- horizontal row separator -->
3424
3475
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
3425
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3476
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
3426
3477
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
3427
3478
 
3428
3479
  <xsl:call-template name="setBordersTableArray"/>
@@ -4098,7 +4149,20 @@
4098
4149
  <!-- Definition List -->
4099
4150
  <!-- ===================== -->
4100
4151
 
4101
- <xsl:template match="*[local-name()='dl']">
4152
+ <!-- for table auto-layout algorithm -->
4153
+ <xsl:template match="*[local-name()='dl']" priority="2">
4154
+ <xsl:choose>
4155
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4156
+ <xsl:call-template name="dl"/>
4157
+ </xsl:when>
4158
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4159
+ <xsl:otherwise>
4160
+ <xsl:call-template name="dl"/>
4161
+ </xsl:otherwise>
4162
+ </xsl:choose>
4163
+ </xsl:template>
4164
+
4165
+ <xsl:template match="*[local-name()='dl']" name="dl">
4102
4166
  <xsl:variable name="isAdded" select="@added"/>
4103
4167
  <xsl:variable name="isDeleted" select="@deleted"/>
4104
4168
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -6032,7 +6096,13 @@
6032
6096
  <xsl:value-of select="$language_current_2"/>
6033
6097
  </xsl:when>
6034
6098
  <xsl:otherwise>
6035
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
6099
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
6100
+ <xsl:choose>
6101
+ <xsl:when test="$language_current_3 != ''">
6102
+ <xsl:value-of select="$language_current_3"/>
6103
+ </xsl:when>
6104
+ <xsl:otherwise>en</xsl:otherwise>
6105
+ </xsl:choose>
6036
6106
  </xsl:otherwise>
6037
6107
  </xsl:choose>
6038
6108
  </xsl:otherwise>
@@ -6935,7 +7005,7 @@
6935
7005
  </xsl:when>
6936
7006
  <xsl:otherwise>
6937
7007
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
6938
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
7008
+ <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'])">
6939
7009
 
6940
7010
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
6941
7011
  <xsl:attribute name="width">
@@ -11987,6 +12057,4 @@
11987
12057
  </xsl:if>
11988
12058
  </xsl:template>
11989
12059
 
11990
- <!-- update -->
11991
-
11992
12060
  </xsl:stylesheet>
@@ -139,9 +139,6 @@ module IsoDoc
139
139
  end
140
140
 
141
141
  def toWord(result, filename, dir, header)
142
- result = from_xhtml(word_cleanup(to_xhtml(result)))
143
- .gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
144
- @wordstylesheet = wordstylesheet_update
145
142
  Html2Doc.new(
146
143
  filename: filename, imagedir: @localdir,
147
144
  stylesheet: @wordstylesheet&.path,
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.5.5".freeze
3
+ VERSION = "2.5.6".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.5
4
+ version: 2.5.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: iso-639