metanorma-cc 2.4.11 → 2.4.12

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: c8f2b7e7fd63c5ab5ce4e695ade07ee618dbf8ee817022f1e3133a4411f723c3
4
- data.tar.gz: 67255d49fe2837da5e1ca60b6d0c49de67dd5ed02edb749010e01695c16eab5f
3
+ metadata.gz: facd0c9522de467534082219cf82fc6c1bcc871defebf31aaf01b6349d144097
4
+ data.tar.gz: c15ab9ee72453f2ae9ee1143f94c45d878a3758c581d268eabcc382d59eeb180
5
5
  SHA512:
6
- metadata.gz: 0e723d5fae4498fc8ec14a61a8ddf473e9b038fb2ef5ffb98a54ad7072dd2f9179f7e6b68a647fd84f562aab6d589674c8791b304cb8ba8397785cb4445522b2
7
- data.tar.gz: 99dd56b978048a49b52a8bd1b7cbda1fb9efab0d80606e06605fcf0a09b51e60e472c7f2e39fbbdad4c0e9afe86cfcb34fa18553a4d238ad3af8b5d88077388f
6
+ metadata.gz: 1fcc4a4554181abcabc75f6b4a1e7ef55507f199fc2ff7dc95bbcb04296300b9ddc931d2c84c493f923dd1e9772ede691a68ee829b679e3f947ae036897b945c
7
+ data.tar.gz: cfebbfd36efc24ca4ef056368bb96c08b5fe5beec55e4e8393891130a2585dd355b6d3455b229eff8a816ccb6fae65cf4fe11aea4edc10475df9d4d2aa403fe0
@@ -6635,18 +6635,33 @@
6635
6635
 
6636
6636
  <xsl:template match="*[local-name()='localityStack']"/>
6637
6637
 
6638
+ <xsl:variable name="pdfAttachmentsList_">
6639
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6640
+ <attachment filename="{@name}"/>
6641
+ </xsl:for-each>
6642
+ </xsl:variable>
6643
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6644
+
6638
6645
  <xsl:template match="*[local-name()='link']" name="link">
6646
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6647
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6639
6648
  <xsl:variable name="target">
6640
6649
  <xsl:choose>
6641
6650
  <xsl:when test="@updatetype = 'true'">
6642
6651
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6643
6652
  </xsl:when>
6653
+ <!-- link to the PDF attachment -->
6654
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6655
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6656
+ </xsl:when>
6657
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6658
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6659
+ </xsl:when>
6644
6660
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6645
- <!-- link to the PDF attachment -->
6646
6661
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6647
6662
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6648
6663
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6649
- </xsl:when>
6664
+ </xsl:when> -->
6650
6665
  <xsl:otherwise>
6651
6666
  <xsl:value-of select="normalize-space(@target)"/>
6652
6667
  </xsl:otherwise>
@@ -11247,6 +11262,17 @@
11247
11262
  <xsl:copy-of select="."/>
11248
11263
  </xsl:template>
11249
11264
 
11265
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11266
+ <xsl:copy>
11267
+ <xsl:copy-of select="@*"/>
11268
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11269
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11270
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11271
+ <xsl:value-of select="."/>
11272
+ </xsl:if>
11273
+ </xsl:copy>
11274
+ </xsl:template>
11275
+
11250
11276
  <!-- add @id, mandatory for table auto-layout algorithm -->
11251
11277
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11252
11278
  <xsl:copy>
@@ -12121,7 +12147,8 @@
12121
12147
  </xsl:when>
12122
12148
  <xsl:otherwise>
12123
12149
  <!-- _{filename}_attachments -->
12124
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12150
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12151
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12125
12152
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12126
12153
  </xsl:otherwise>
12127
12154
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.4.11".freeze
3
+ VERSION = "2.4.12".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -41,4 +41,5 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "sassc", "2.4.0"
42
42
  spec.add_development_dependency "simplecov", "~> 0.15"
43
43
  spec.add_development_dependency "timecop", "~> 0.9"
44
+ spec.add_development_dependency "xml-c14n"
44
45
  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.11
4
+ version: 2.4.12
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-07-22 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-generic
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.9'
167
+ - !ruby/object:Gem::Dependency
168
+ name: xml-c14n
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  description: |
168
182
  metanorma-cc lets you write CalConnect standards in AsciiDoc syntax.
169
183