metanorma-iec 2.4.12 → 2.5.0

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: fea24aa64896b40fd0014ff6cac836db2f3b23ffb6b6c88311ad9d423118745a
4
- data.tar.gz: 30dd9c36bcb8ddb34c966fe5a8e4ce067dcc52ef0440f973d66af23f8c123490
3
+ metadata.gz: 40410d7fa9806e1e4636e6f6a050f50626aa1525a71ea850fbf5fb836b163b1b
4
+ data.tar.gz: 85252604e117c46b3b77e68ec347086469e41da551f379209234a2623fbf8c00
5
5
  SHA512:
6
- metadata.gz: 057cb330f644950cff7cd28d7bef0fe598f27c76131ca6e554a153347c1e4a795fc33e8a63e3a1aaecd45fbff6152ba9680b4f1e7e6439831fda734668f5efe0
7
- data.tar.gz: b47996f562e5447eaff43381bbae7f709d924e7d191112a1f091c409754729f76bc98c9f95e5179acb9dd4be0d9a9edeb2009ef162709ce7261bb0d55c44db62
6
+ metadata.gz: 58a25c0a0d7bf089387fb2cb05e9ee643dd5f30250fa4391e839972561fd4d2ff4e1652ba106477f2f4f605755ed96d6f90d7ab1a615910a188c9c9e90c2c0e9
7
+ data.tar.gz: b070955fa8f3aa30c592c290050191454444f8624d595369a252184c6f1ca6046b45b5951c6f43803916ffc4ddba594469b407e5002f4c0ceb56cd80be0448e1
@@ -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>
@@ -13017,6 +13032,17 @@
13017
13032
  <xsl:copy-of select="."/>
13018
13033
  </xsl:template>
13019
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
+
13020
13046
  <!-- add @id, mandatory for table auto-layout algorithm -->
13021
13047
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
13022
13048
  <xsl:copy>
@@ -13891,7 +13917,8 @@
13891
13917
  </xsl:when>
13892
13918
  <xsl:otherwise>
13893
13919
  <!-- _{filename}_attachments -->
13894
- <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, ')')"/>
13895
13922
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
13896
13923
  </xsl:otherwise>
13897
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("")
120
+ end
121
121
  else
122
122
  super
123
123
  end
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.12".freeze
3
+ VERSION = "2.5.0".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.12
4
+ version: 2.5.0
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-22 00:00:00.000000000 Z
11
+ date: 2024-08-06 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