metanorma-csa 2.4.11 → 2.4.12

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: f65ffe8cca64a3c9362dd2384be6a3c3a8f46275060286d05b74fe4cba170617
4
- data.tar.gz: 78d0fd27b9e673aa43c584ca7a52bf4afde8b9e0aebe2144bd6e15da5f983060
3
+ metadata.gz: 16f333348982316e9e48357f5160eeeb6165df8d6a45c1cbe473e09545f831b8
4
+ data.tar.gz: 5e84c06e9cf1d6725b18b961575549fb6f8a0cbe6fc13d31876cfd70b1d7065e
5
5
  SHA512:
6
- metadata.gz: 7d5a77f726af19939704abcc9c361b6f33868cc5a29f644a871c7d2a262fbe2d5a9741f98f1ee095dbc2c6714014112a8f450f5327c977545b4982cd06b9c573
7
- data.tar.gz: 6a3a9b253e37dd8bc4c245d6ea42cebc7bbd6cff09f43867ab6f0a23c8c4e0b6d7db85df606600dc41ac09b5419e946b06582fecf9fa950ce064b043b63de137
6
+ metadata.gz: 704c0a9144835e2b2afeeec424a4cc9edac06dfefb3590bfdf2533051ee48a024064812209ad48869dd2995d0ba0bee134e9febecb90aee36ff7d6530d5e1977
7
+ data.tar.gz: d960839132b96fe45bba8e84c96897e0e10a07f6be954adf49719de64e947a71d5e1c3f4b6ec9183b00bddc2539d8151aecc4532b6bdb27b866bd40787987f8f
@@ -6647,18 +6647,33 @@
6647
6647
 
6648
6648
  <xsl:template match="*[local-name()='localityStack']"/>
6649
6649
 
6650
+ <xsl:variable name="pdfAttachmentsList_">
6651
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6652
+ <attachment filename="{@name}"/>
6653
+ </xsl:for-each>
6654
+ </xsl:variable>
6655
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6656
+
6650
6657
  <xsl:template match="*[local-name()='link']" name="link">
6658
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6659
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6651
6660
  <xsl:variable name="target">
6652
6661
  <xsl:choose>
6653
6662
  <xsl:when test="@updatetype = 'true'">
6654
6663
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6655
6664
  </xsl:when>
6665
+ <!-- link to the PDF attachment -->
6666
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6667
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6668
+ </xsl:when>
6669
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6670
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6671
+ </xsl:when>
6656
6672
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6657
- <!-- link to the PDF attachment -->
6658
6673
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6659
6674
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6660
6675
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6661
- </xsl:when>
6676
+ </xsl:when> -->
6662
6677
  <xsl:otherwise>
6663
6678
  <xsl:value-of select="normalize-space(@target)"/>
6664
6679
  </xsl:otherwise>
@@ -11231,6 +11246,17 @@
11231
11246
  <xsl:copy-of select="."/>
11232
11247
  </xsl:template>
11233
11248
 
11249
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11250
+ <xsl:copy>
11251
+ <xsl:copy-of select="@*"/>
11252
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11253
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11254
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11255
+ <xsl:value-of select="."/>
11256
+ </xsl:if>
11257
+ </xsl:copy>
11258
+ </xsl:template>
11259
+
11234
11260
  <!-- add @id, mandatory for table auto-layout algorithm -->
11235
11261
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11236
11262
  <xsl:copy>
@@ -12105,7 +12131,8 @@
12105
12131
  </xsl:when>
12106
12132
  <xsl:otherwise>
12107
12133
  <!-- _{filename}_attachments -->
12108
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12134
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12135
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12109
12136
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12110
12137
  </xsl:otherwise>
12111
12138
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.4.11".freeze
3
+ VERSION = "2.4.12".freeze
4
4
  end
5
5
  end
@@ -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-csa
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-csa lets you write CSA Normal Documents (CSAND) in AsciiDoc syntax.
169
183