metanorma-un 0.12.14 → 0.12.15

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: 608ff96a451a25fcf3dbd20023d7c3ce1d5e68fa0a7f0d4950698879919525dd
4
- data.tar.gz: d37eb52c955f549428383103337e7ee8ed48c45ff540090225c1d0ce67b5c305
3
+ metadata.gz: 4cbf3fafbf48123286c81522fa8d05402997ee8ca2c7692ec60eed21f52294f6
4
+ data.tar.gz: 6d5e047ee2bc3c177988bb98da75f6078f3e9618ecfae279bbff1f84952ccb54
5
5
  SHA512:
6
- metadata.gz: 64f84bcabd48d7ca9c4d67d91158dc6ad66cd001df767e4e901207516a383e94ceee48be0ba65f9f786f65c1fe1d769e816d1f4e6713a32ad7bb3f927cdb3664
7
- data.tar.gz: ddccafd416bc040e09b637632247081fcadc9d19e8d2bb6fdc42f8b071d8342566700cbee0b6b985d5373a27a2427bcceee61707f0350a423b8cac9e245b8009
6
+ metadata.gz: a56663989b0eab35e2d88f4c8c60d12b8708ab36ee86bf78ae2ed5213723285769b496a332f393808a96571f2b9ae3b23af75d810fa70691f1ab2558537be0e1
7
+ data.tar.gz: 96ca6c2c8acec1a328116742a4bfedac887e0c0939ac4ed450160331779ab939d5a2e9fba164aeb8fb24329f7121f206f8913d68136ccd2ae3a8e41d77da9f81
@@ -6913,18 +6913,33 @@
6913
6913
 
6914
6914
  <xsl:template match="*[local-name()='localityStack']"/>
6915
6915
 
6916
+ <xsl:variable name="pdfAttachmentsList_">
6917
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6918
+ <attachment filename="{@name}"/>
6919
+ </xsl:for-each>
6920
+ </xsl:variable>
6921
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6922
+
6916
6923
  <xsl:template match="*[local-name()='link']" name="link">
6924
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6925
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6917
6926
  <xsl:variable name="target">
6918
6927
  <xsl:choose>
6919
6928
  <xsl:when test="@updatetype = 'true'">
6920
6929
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6921
6930
  </xsl:when>
6931
+ <!-- link to the PDF attachment -->
6932
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6933
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6934
+ </xsl:when>
6935
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6936
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6937
+ </xsl:when>
6922
6938
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6923
- <!-- link to the PDF attachment -->
6924
6939
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6925
6940
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6926
6941
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6927
- </xsl:when>
6942
+ </xsl:when> -->
6928
6943
  <xsl:otherwise>
6929
6944
  <xsl:value-of select="normalize-space(@target)"/>
6930
6945
  </xsl:otherwise>
@@ -11517,6 +11532,17 @@
11517
11532
  <xsl:copy-of select="."/>
11518
11533
  </xsl:template>
11519
11534
 
11535
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11536
+ <xsl:copy>
11537
+ <xsl:copy-of select="@*"/>
11538
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11539
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11540
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11541
+ <xsl:value-of select="."/>
11542
+ </xsl:if>
11543
+ </xsl:copy>
11544
+ </xsl:template>
11545
+
11520
11546
  <!-- add @id, mandatory for table auto-layout algorithm -->
11521
11547
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11522
11548
  <xsl:copy>
@@ -12391,7 +12417,8 @@
12391
12417
  </xsl:when>
12392
12418
  <xsl:otherwise>
12393
12419
  <!-- _{filename}_attachments -->
12394
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12420
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12421
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12395
12422
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12396
12423
  </xsl:otherwise>
12397
12424
  </xsl:choose>
@@ -6913,18 +6913,33 @@
6913
6913
 
6914
6914
  <xsl:template match="*[local-name()='localityStack']"/>
6915
6915
 
6916
+ <xsl:variable name="pdfAttachmentsList_">
6917
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6918
+ <attachment filename="{@name}"/>
6919
+ </xsl:for-each>
6920
+ </xsl:variable>
6921
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6922
+
6916
6923
  <xsl:template match="*[local-name()='link']" name="link">
6924
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6925
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6917
6926
  <xsl:variable name="target">
6918
6927
  <xsl:choose>
6919
6928
  <xsl:when test="@updatetype = 'true'">
6920
6929
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6921
6930
  </xsl:when>
6931
+ <!-- link to the PDF attachment -->
6932
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6933
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6934
+ </xsl:when>
6935
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6936
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6937
+ </xsl:when>
6922
6938
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6923
- <!-- link to the PDF attachment -->
6924
6939
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6925
6940
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6926
6941
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6927
- </xsl:when>
6942
+ </xsl:when> -->
6928
6943
  <xsl:otherwise>
6929
6944
  <xsl:value-of select="normalize-space(@target)"/>
6930
6945
  </xsl:otherwise>
@@ -11517,6 +11532,17 @@
11517
11532
  <xsl:copy-of select="."/>
11518
11533
  </xsl:template>
11519
11534
 
11535
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11536
+ <xsl:copy>
11537
+ <xsl:copy-of select="@*"/>
11538
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11539
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11540
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11541
+ <xsl:value-of select="."/>
11542
+ </xsl:if>
11543
+ </xsl:copy>
11544
+ </xsl:template>
11545
+
11520
11546
  <!-- add @id, mandatory for table auto-layout algorithm -->
11521
11547
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11522
11548
  <xsl:copy>
@@ -12391,7 +12417,8 @@
12391
12417
  </xsl:when>
12392
12418
  <xsl:otherwise>
12393
12419
  <!-- _{filename}_attachments -->
12394
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12420
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12421
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12395
12422
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12396
12423
  </xsl:otherwise>
12397
12424
  </xsl:choose>
@@ -7012,18 +7012,33 @@
7012
7012
 
7013
7013
  <xsl:template match="*[local-name()='localityStack']"/>
7014
7014
 
7015
+ <xsl:variable name="pdfAttachmentsList_">
7016
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7017
+ <attachment filename="{@name}"/>
7018
+ </xsl:for-each>
7019
+ </xsl:variable>
7020
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7021
+
7015
7022
  <xsl:template match="*[local-name()='link']" name="link">
7023
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7024
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7016
7025
  <xsl:variable name="target">
7017
7026
  <xsl:choose>
7018
7027
  <xsl:when test="@updatetype = 'true'">
7019
7028
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7020
7029
  </xsl:when>
7030
+ <!-- link to the PDF attachment -->
7031
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7032
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7033
+ </xsl:when>
7034
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7035
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
7036
+ </xsl:when>
7021
7037
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7022
- <!-- link to the PDF attachment -->
7023
7038
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7024
7039
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7025
7040
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7026
- </xsl:when>
7041
+ </xsl:when> -->
7027
7042
  <xsl:otherwise>
7028
7043
  <xsl:value-of select="normalize-space(@target)"/>
7029
7044
  </xsl:otherwise>
@@ -11617,6 +11632,17 @@
11617
11632
  <xsl:copy-of select="."/>
11618
11633
  </xsl:template>
11619
11634
 
11635
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11636
+ <xsl:copy>
11637
+ <xsl:copy-of select="@*"/>
11638
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11639
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11640
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11641
+ <xsl:value-of select="."/>
11642
+ </xsl:if>
11643
+ </xsl:copy>
11644
+ </xsl:template>
11645
+
11620
11646
  <!-- add @id, mandatory for table auto-layout algorithm -->
11621
11647
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11622
11648
  <xsl:copy>
@@ -12491,7 +12517,8 @@
12491
12517
  </xsl:when>
12492
12518
  <xsl:otherwise>
12493
12519
  <!-- _{filename}_attachments -->
12494
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12520
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12521
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12495
12522
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12496
12523
  </xsl:otherwise>
12497
12524
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.12.14".freeze
3
+ VERSION = "0.12.15".freeze
4
4
  end
5
5
  end
data/metanorma-un.gemspec CHANGED
@@ -43,4 +43,5 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency "sassc", "2.4.0"
44
44
  spec.add_development_dependency "simplecov", "~> 0.15"
45
45
  spec.add_development_dependency "timecop", "~> 0.9"
46
+ spec.add_development_dependency "xml-c14n"
46
47
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.14
4
+ version: 0.12.15
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: iso-639
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0.9'
209
+ - !ruby/object:Gem::Dependency
210
+ name: xml-c14n
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
209
223
  description: |
210
224
  Metanorma for UN documents.
211
225