metanorma-iec 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: a6c4d68dec6bd1dd70dda1e9bd2b4673166e30d104f3242c38e4e01a4b365be4
4
- data.tar.gz: 27ff7824fc1418e886e8ed9f5bfc3261e0e7ea6bc6ecd76dd09c7a992dd2b3ba
3
+ metadata.gz: f05fbbfe3bd0f60dd7207637f0df64d3ef07bc8b5adac8fb9594f594ff0034b2
4
+ data.tar.gz: 38d920ff2f0793ad5f2e5a7da698a41a4f53cf76c0afb71dfe9e850de5335b1a
5
5
  SHA512:
6
- metadata.gz: 97b54d568dac05605ff9a3f85dfdcbc98e9a1f10d5d548f8daa10f4eac08fcdec3243dc9af79aadedf4d4842aa4e500e9d6a5921649a5a7daf6db045af907946
7
- data.tar.gz: bcd122112fb9a50977e8828102a31bae0efe1f80bceab7b560beccd7a61ebb98803451105b7cc3d55d923096fd24f1596f848dca4aab9f0a69da09adc8db414d
6
+ metadata.gz: 442d16114c39c832a4ae7afeae6fa53d211eea474a99e80e8861604f6e3cb4185e3b7eee10bcb815fc20a5e7720f9e74afefd94ec27bc15b1ba60c26597de3d8
7
+ data.tar.gz: a3d068fd26a0a4207e8bd37c0f59bce555f9afe87aeebec4fc1d5a66a7cb84fefa12c9f38b80590f8559fc9b600950993363833d6b402d15c9963c94044dfa39
@@ -2123,17 +2123,30 @@
2123
2123
  <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 -->
2124
2124
 
2125
2125
  <xsl:param name="table_if">false</xsl:param> <!-- generate extended table in IF for autolayout-algorithm -->
2126
- <xsl:param name="table_widths"/> <!-- path to xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2126
+ <xsl:param name="table_widths"/> <!-- (debug: path to) xml with table's widths, generated on 1st pass, based on FOP Intermediate Format -->
2127
2127
  <!-- Example: <tables>
2128
- <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2129
- <tbody>
2130
- <tr>
2131
- <td id="tab-symdu_1_1">
2132
- <p_len>6</p_len>
2133
- <p_len>100</p_len> for 2nd paragraph
2134
- <word_len>6</word_len>
2135
- <word_len>20</word_len>
2136
- ...
2128
+ <table page-width="509103" id="table1" width_max="223561" width_min="223560">
2129
+ <column width_max="39354" width_min="39354"/>
2130
+ <column width_max="75394" width_min="75394"/>
2131
+ <column width_max="108813" width_min="108813"/>
2132
+ <tbody>
2133
+ <tr>
2134
+ <td width_max="39354" width_min="39354">
2135
+ <p_len>39354</p_len>
2136
+ <word_len>39354</word_len>
2137
+ </td>
2138
+
2139
+ OLD:
2140
+ <tables>
2141
+ <table id="table_if_tab-symdu" page-width="75"> - table id prefixed by 'table_if_' to simple search in IF
2142
+ <tbody>
2143
+ <tr>
2144
+ <td id="tab-symdu_1_1">
2145
+ <p_len>6</p_len>
2146
+ <p_len>100</p_len> for 2nd paragraph
2147
+ <word_len>6</word_len>
2148
+ <word_len>20</word_len>
2149
+ ...
2137
2150
  -->
2138
2151
 
2139
2152
  <!-- for command line debug: <xsl:variable name="table_widths_from_if" select="document($table_widths)"/> -->
@@ -2359,6 +2372,9 @@
2359
2372
  <xsl:variable name="hair_space"> </xsl:variable>
2360
2373
  <xsl:variable name="en_dash">–</xsl:variable>
2361
2374
  <xsl:variable name="em_dash">—</xsl:variable>
2375
+ <xsl:variable name="cr">&#13;</xsl:variable>
2376
+ <xsl:variable name="lf">
2377
+ </xsl:variable>
2362
2378
 
2363
2379
  <xsl:template name="getTitle">
2364
2380
  <xsl:param name="name"/>
@@ -4084,6 +4100,20 @@
4084
4100
  </xsl:for-each>
4085
4101
  </xsl:template>
4086
4102
 
4103
+ <xsl:param name="table_only_with_id"/><!-- Example: table1, for table auto-layout algorithm -->
4104
+
4105
+ <xsl:template match="*[local-name()='table']" priority="2">
4106
+ <xsl:choose>
4107
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
4108
+ <xsl:call-template name="table"/>
4109
+ </xsl:when>
4110
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
4111
+ <xsl:otherwise>
4112
+ <xsl:call-template name="table"/>
4113
+ </xsl:otherwise>
4114
+ </xsl:choose>
4115
+ </xsl:template>
4116
+
4087
4117
  <xsl:template match="*[local-name()='table']" name="table">
4088
4118
 
4089
4119
  <xsl:variable name="table-preamble">
@@ -4093,9 +4123,11 @@
4093
4123
  <xsl:variable name="table">
4094
4124
 
4095
4125
  <xsl:variable name="simple-table">
4096
- <xsl:call-template name="getSimpleTable">
4097
- <xsl:with-param name="id" select="@id"/>
4098
- </xsl:call-template>
4126
+ <xsl:if test="$isGenerateTableIF = 'true' and $isApplyAutolayoutAlgorithm = 'true'">
4127
+ <xsl:call-template name="getSimpleTable">
4128
+ <xsl:with-param name="id" select="@id"/>
4129
+ </xsl:call-template>
4130
+ </xsl:if>
4099
4131
  </xsl:variable>
4100
4132
  <!-- <xsl:variable name="simple-table" select="xalan:nodeset($simple-table_)"/> -->
4101
4133
 
@@ -4191,9 +4223,9 @@
4191
4223
  </xsl:attribute>
4192
4224
  </xsl:for-each>
4193
4225
 
4194
- <xsl:variable name="isNoteOrFnExist" select="./*[local-name()='note'] or ./*[local-name()='example'] or .//*[local-name()='fn'][local-name(..) != 'name'] or ./*[local-name()='source']"/>
4226
+ <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']"/>
4195
4227
  <xsl:if test="$isNoteOrFnExist = 'true'">
4196
- <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute> <!-- set 0pt border, because there is a separete table below for footer -->
4228
+ <xsl:attribute name="border-bottom">0pt solid black</xsl:attribute><!-- set 0pt border, because there is a separete table below for footer -->
4197
4229
  </xsl:if>
4198
4230
 
4199
4231
  <xsl:choose>
@@ -4361,9 +4393,28 @@
4361
4393
 
4362
4394
  </fo:block>
4363
4395
 
4396
+ <!-- <xsl:if test="$namespace = 'bsi' or $namespace = 'iec' or $namespace = 'iso'"> -->
4397
+ <xsl:if test="$continued = 'true'">
4398
+ <fo:block text-align="right">
4399
+ <xsl:apply-templates select="../*[local-name() = 'note'][@type = 'units']/node()"/>
4400
+ </fo:block>
4401
+ </xsl:if>
4402
+ <!-- </xsl:if> -->
4403
+
4364
4404
  </xsl:if>
4365
4405
  </xsl:template> <!-- table/name -->
4366
4406
 
4407
+ <!-- workaround solution for https://github.com/metanorma/metanorma-iso/issues/1151#issuecomment-2033087938 -->
4408
+ <xsl:template match="*[local-name()='table']/*[local-name() = 'note'][@type = 'units']/*[local-name() = 'p']/text()" priority="4">
4409
+ <xsl:choose>
4410
+ <xsl:when test="preceding-sibling::*[local-name() = 'br']">
4411
+ <!-- remove CR or LF at start -->
4412
+ <xsl:value-of select="java:replaceAll(java:java.lang.String.new(.),'^(&#13;&#10;|&#13;|&#10;)', '')"/>
4413
+ </xsl:when>
4414
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
4415
+ </xsl:choose>
4416
+ </xsl:template>
4417
+
4367
4418
  <!-- SOURCE: ... -->
4368
4419
  <xsl:template match="*[local-name()='table']/*[local-name() = 'source']" priority="2">
4369
4420
  <xsl:call-template name="termsource"/>
@@ -4783,7 +4834,7 @@
4783
4834
  <xsl:param name="colwidths"/>
4784
4835
  <xsl:param name="colgroup"/>
4785
4836
 
4786
- <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']"/>
4837
+ <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']"/>
4787
4838
 
4788
4839
  <xsl:variable name="isNoteOrFnExistShowAfterTable">
4789
4840
 
@@ -4849,7 +4900,7 @@
4849
4900
 
4850
4901
  <!-- fn will be processed inside 'note' processing -->
4851
4902
 
4852
- <xsl:if test="../*[local-name()='note']">
4903
+ <xsl:if test="../*[local-name()='note'][not(@type = 'units')]">
4853
4904
  <fo:block margin-bottom="6pt" role="SKIP"> </fo:block>
4854
4905
  </xsl:if>
4855
4906
 
@@ -4859,7 +4910,7 @@
4859
4910
 
4860
4911
  <xsl:apply-templates select="../*[local-name()='p']"/>
4861
4912
  <xsl:apply-templates select="../*[local-name()='dl']"/>
4862
- <xsl:apply-templates select="../*[local-name()='note']"/>
4913
+ <xsl:apply-templates select="../*[local-name()='note'][not(@type = 'units')]"/>
4863
4914
  <xsl:apply-templates select="../*[local-name()='example']"/>
4864
4915
  <xsl:apply-templates select="../*[local-name()='source']"/>
4865
4916
 
@@ -4870,7 +4921,7 @@
4870
4921
 
4871
4922
  <!-- horizontal row separator -->
4872
4923
  <xsl:if test="normalize-space($isDisplayRowSeparator) = 'true'">
4873
- <xsl:if test="(../*[local-name()='note'] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4924
+ <xsl:if test="(../*[local-name()='note'][not(@type = 'units')] or ../*[local-name()='example']) and normalize-space($table_fn_block) != ''">
4874
4925
  <fo:block-container border-top="0.5pt solid black" padding-left="1mm" padding-right="1mm">
4875
4926
 
4876
4927
  <xsl:call-template name="setBordersTableArray"/>
@@ -5579,7 +5630,20 @@
5579
5630
  <!-- Definition List -->
5580
5631
  <!-- ===================== -->
5581
5632
 
5582
- <xsl:template match="*[local-name()='dl']">
5633
+ <!-- for table auto-layout algorithm -->
5634
+ <xsl:template match="*[local-name()='dl']" priority="2">
5635
+ <xsl:choose>
5636
+ <xsl:when test="$table_only_with_id != '' and @id = $table_only_with_id">
5637
+ <xsl:call-template name="dl"/>
5638
+ </xsl:when>
5639
+ <xsl:when test="$table_only_with_id != ''"><fo:block/><!-- to prevent empty fo:block-container --></xsl:when>
5640
+ <xsl:otherwise>
5641
+ <xsl:call-template name="dl"/>
5642
+ </xsl:otherwise>
5643
+ </xsl:choose>
5644
+ </xsl:template>
5645
+
5646
+ <xsl:template match="*[local-name()='dl']" name="dl">
5583
5647
  <xsl:variable name="isAdded" select="@added"/>
5584
5648
  <xsl:variable name="isDeleted" select="@deleted"/>
5585
5649
  <!-- <dl><xsl:copy-of select="."/></dl> -->
@@ -7593,7 +7657,13 @@
7593
7657
  <xsl:value-of select="$language_current_2"/>
7594
7658
  </xsl:when>
7595
7659
  <xsl:otherwise>
7596
- <xsl:value-of select="//*[local-name()='bibdata']//*[local-name()='language']"/>
7660
+ <xsl:variable name="language_current_3" select="normalize-space(//*[local-name()='bibdata']//*[local-name()='language'])"/>
7661
+ <xsl:choose>
7662
+ <xsl:when test="$language_current_3 != ''">
7663
+ <xsl:value-of select="$language_current_3"/>
7664
+ </xsl:when>
7665
+ <xsl:otherwise>en</xsl:otherwise>
7666
+ </xsl:choose>
7597
7667
  </xsl:otherwise>
7598
7668
  </xsl:choose>
7599
7669
  </xsl:otherwise>
@@ -8498,7 +8568,7 @@
8498
8568
  </xsl:when>
8499
8569
  <xsl:otherwise>
8500
8570
  <fo:external-graphic src="{$src}" fox:alt-text="Image {@alt}" xsl:use-attribute-sets="image-graphic-style">
8501
- <xsl:if test="not(@mimetype = 'image/svg+xml') and ../*[local-name() = 'name'] and not(ancestor::*[local-name() = 'table'])">
8571
+ <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'])">
8502
8572
 
8503
8573
  <xsl:if test="@width != '' and @width != 'auto' and @width != 'text-width' and @width != 'full-page-width' and @width != 'narrow'">
8504
8574
  <xsl:attribute name="width">
@@ -13545,6 +13615,4 @@
13545
13615
  </xsl:if>
13546
13616
  </xsl:template>
13547
13617
 
13548
- <!-- update -->
13549
-
13550
13618
  </xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.5".freeze
3
+ VERSION = "2.4.6".freeze
4
4
  end
5
5
  end
6
6
 
@@ -31,8 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
33
  spec.add_dependency "metanorma-iso", "~> 2.7.3"
34
- spec.add_dependency "pubid-iec"
35
- spec.add_dependency "ruby-jing"
34
+ spec.add_dependency "pubid"
36
35
 
37
36
  spec.add_development_dependency "debug"
38
37
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
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: bin
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-iso
@@ -25,21 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.7.3
27
27
  - !ruby/object:Gem::Dependency
28
- name: pubid-iec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: ruby-jing
28
+ name: pubid
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - ">="