metanorma-ribose 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: 69c928b3ec63a523f114024012f4b60f399be7308dbf4083f280fd24eca6c8d3
4
- data.tar.gz: 9999b24d08475a91bb43aad9f3fafc4f116f904eae713f50ea60e74c80eb6e67
3
+ metadata.gz: ead04a3f02a2de2f0d13bee5b3769b1bb3481b97168a7653d90296466f1bf39a
4
+ data.tar.gz: d56daa4297255da6ebcdb64ff0397ac22480d0802febab8e9824df81ecdfd29b
5
5
  SHA512:
6
- metadata.gz: 902f120894f623afdeae41eace5e5f765c85964fb97540b2ff8599797acf673dfad713ac4cccf59f9c4f7f450615a92a4df31ff73a1aa77dd2036905080acdb9
7
- data.tar.gz: b819165043dbd27e06e4f8838a663897150eaf060dbfc951125aaef113e2d84d9c9dd54350f3912d96f8c53d1e91573483340295824bc9f78f41eecc661d6079
6
+ metadata.gz: 779ef1ff124ce316f7684f47486d76f62b72f20c5aac64105f08e982f875cafa7b68af27e741a6b4947feb7cf0d03a3e2c53a1600162428385d0bdd52a6d4332
7
+ data.tar.gz: 37a61afdf7f21a230eacf50189f116f7f79c4ed2f0f11da550dbad05b307842fac68026ee88387345a4f24707a013497affda511080168784b23c91fe57eed4f
@@ -7419,18 +7419,33 @@
7419
7419
 
7420
7420
  <xsl:template match="*[local-name()='localityStack']"/>
7421
7421
 
7422
+ <xsl:variable name="pdfAttachmentsList_">
7423
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7424
+ <attachment filename="{@name}"/>
7425
+ </xsl:for-each>
7426
+ </xsl:variable>
7427
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7428
+
7422
7429
  <xsl:template match="*[local-name()='link']" name="link">
7430
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7431
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7423
7432
  <xsl:variable name="target">
7424
7433
  <xsl:choose>
7425
7434
  <xsl:when test="@updatetype = 'true'">
7426
7435
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7427
7436
  </xsl:when>
7437
+ <!-- link to the PDF attachment -->
7438
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7439
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7440
+ </xsl:when>
7441
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7442
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
7443
+ </xsl:when>
7428
7444
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7429
- <!-- link to the PDF attachment -->
7430
7445
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7431
7446
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7432
7447
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7433
- </xsl:when>
7448
+ </xsl:when> -->
7434
7449
  <xsl:otherwise>
7435
7450
  <xsl:value-of select="normalize-space(@target)"/>
7436
7451
  </xsl:otherwise>
@@ -12026,6 +12041,17 @@
12026
12041
  <xsl:copy-of select="."/>
12027
12042
  </xsl:template>
12028
12043
 
12044
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12045
+ <xsl:copy>
12046
+ <xsl:copy-of select="@*"/>
12047
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12048
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12049
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12050
+ <xsl:value-of select="."/>
12051
+ </xsl:if>
12052
+ </xsl:copy>
12053
+ </xsl:template>
12054
+
12029
12055
  <!-- add @id, mandatory for table auto-layout algorithm -->
12030
12056
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12031
12057
  <xsl:copy>
@@ -12900,7 +12926,8 @@
12900
12926
  </xsl:when>
12901
12927
  <xsl:otherwise>
12902
12928
  <!-- _{filename}_attachments -->
12903
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12929
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12930
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12904
12931
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12905
12932
  </xsl:otherwise>
12906
12933
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ribose
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-ribose
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-ribose lets you write Ribose standards in AsciiDoc syntax.
169
183