metanorma-iec 2.4.11 → 2.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d035fb01f99b16382c8f525c7f37826457a8d9b0d522100d3fe4ca78fcde8ba
4
- data.tar.gz: 920902c575d57abb17cddf3d9060965e49f01cb8e6287f390ef7e39cd775c1a0
3
+ metadata.gz: e384597ebbeb4b89f3f0044425c79cbd11e5dc58929d345ccaedb23e44d39334
4
+ data.tar.gz: 1c0dbb430b823f80db5e84e6e258487e9a01f60dadd963bbb2a6a0991064de60
5
5
  SHA512:
6
- metadata.gz: 13bff08633f91d6a3a02e74f1e37f03211d4b2d89cc606b658da7211d12f54e328452d00f83b5eb6235a78ccc7bf065fddbcc53b38f25d5c7ea9eee74859e22e
7
- data.tar.gz: 4d94ec97ab713e3e74ed929491374225b3e473d40bcacfb22442942caa1e2ef954dcf9de4673f1e78e9fa8b3fa12cfa1f89284bd9fa73a3300cd0b37b98432e7
6
+ metadata.gz: 2a449caf7d8658172bdfcd6d391729555b56afb22d7523fbb73a1d03906de25d449c30449a99dae50148427eea7123ad098b273187331dbde0f78c8481e75ed0
7
+ data.tar.gz: f5a2455092890175c3b8f64550efd83e98a1786228c5c5bbd13788eb60835f92d2466bb501cc5739da862f92ceddbe09c13a4a51577fdd17581c5222ccef60cf
@@ -8387,18 +8387,33 @@
8387
8387
 
8388
8388
  <xsl:template match="*[local-name()='localityStack']"/>
8389
8389
 
8390
+ <xsl:variable name="pdfAttachmentsList_">
8391
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
8392
+ <attachment filename="{@name}"/>
8393
+ </xsl:for-each>
8394
+ </xsl:variable>
8395
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
8396
+
8390
8397
  <xsl:template match="*[local-name()='link']" name="link">
8398
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8399
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8391
8400
  <xsl:variable name="target">
8392
8401
  <xsl:choose>
8393
8402
  <xsl:when test="@updatetype = 'true'">
8394
8403
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8395
8404
  </xsl:when>
8405
+ <!-- link to the PDF attachment -->
8406
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
8407
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8408
+ </xsl:when>
8409
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8410
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8411
+ </xsl:when>
8396
8412
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
8397
- <!-- link to the PDF attachment -->
8398
8413
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
8399
8414
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
8400
8415
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
8401
- </xsl:when>
8416
+ </xsl:when> -->
8402
8417
  <xsl:otherwise>
8403
8418
  <xsl:value-of select="normalize-space(@target)"/>
8404
8419
  </xsl:otherwise>
@@ -10064,8 +10079,11 @@
10064
10079
  </xsl:template>
10065
10080
 
10066
10081
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
10082
+ <xsl:param name="element"/>
10067
10083
  <xsl:copy>
10068
- <xsl:apply-templates mode="contents_item"/>
10084
+ <xsl:apply-templates mode="contents_item">
10085
+ <xsl:with-param name="element" select="$element"/>
10086
+ </xsl:apply-templates>
10069
10087
  </xsl:copy>
10070
10088
  </xsl:template>
10071
10089
 
@@ -10132,7 +10150,10 @@
10132
10150
 
10133
10151
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
10134
10152
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
10135
- <xsl:apply-templates mode="contents_item"/>
10153
+ <xsl:param name="element"/>
10154
+ <xsl:apply-templates mode="contents_item">
10155
+ <xsl:with-param name="element" select="$element"/>
10156
+ </xsl:apply-templates>
10136
10157
  </xsl:template>
10137
10158
 
10138
10159
  <!-- =============== -->
@@ -13011,6 +13032,17 @@
13011
13032
  <xsl:copy-of select="."/>
13012
13033
  </xsl:template>
13013
13034
 
13035
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
13036
+ <xsl:copy>
13037
+ <xsl:copy-of select="@*"/>
13038
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
13039
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
13040
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
13041
+ <xsl:value-of select="."/>
13042
+ </xsl:if>
13043
+ </xsl:copy>
13044
+ </xsl:template>
13045
+
13014
13046
  <!-- add @id, mandatory for table auto-layout algorithm -->
13015
13047
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13016
13048
  <xsl:copy>
@@ -13885,7 +13917,8 @@
13885
13917
  </xsl:when>
13886
13918
  <xsl:otherwise>
13887
13919
  <!-- _{filename}_attachments -->
13888
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13920
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13921
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13889
13922
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
13890
13923
  </xsl:otherwise>
13891
13924
  </xsl:choose>
@@ -117,7 +117,7 @@ module Metanorma
117
117
  xml.tc_sc_officers_note do |c|
118
118
  wrap_in_para(note, c)
119
119
  end
120
- end.join("\n")
120
+ end.join("")
121
121
  else
122
122
  super
123
123
  end
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.3.2 -->
20
+ <!-- VERSION v1.3.3 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -331,9 +331,9 @@
331
331
  <zeroOrMore>
332
332
  <ref name="table-note"/>
333
333
  </zeroOrMore>
334
- <optional>
334
+ <zeroOrMore>
335
335
  <ref name="source"/>
336
- </optional>
336
+ </zeroOrMore>
337
337
  </define>
338
338
  <define name="FigureAttr">
339
339
  <optional>
@@ -380,9 +380,9 @@
380
380
  <zeroOrMore>
381
381
  <ref name="note"/>
382
382
  </zeroOrMore>
383
- <optional>
383
+ <zeroOrMore>
384
384
  <ref name="source"/>
385
- </optional>
385
+ </zeroOrMore>
386
386
  </define>
387
387
  <define name="source">
388
388
  <element name="source">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.11".freeze
3
+ VERSION = "2.4.13".freeze
4
4
  end
5
5
  end
6
6
 
@@ -44,5 +44,6 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency "sassc", "2.4.0"
45
45
  spec.add_development_dependency "simplecov", "~> 0.15"
46
46
  spec.add_development_dependency "timecop", "~> 0.9"
47
+ spec.add_development_dependency "xml-c14n"
47
48
  # spec.metadata["rubygems_mfa_required"] = "true"
48
49
  end
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.11
4
+ version: 2.4.13
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-07-08 00:00:00.000000000 Z
11
+ date: 2024-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0.9'
195
+ - !ruby/object:Gem::Dependency
196
+ name: xml-c14n
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
195
209
  description: |
196
210
  metanorma-iec lets you write IEC standards in AsciiDoc syntax.
197
211