metanorma-iho 0.9.12 → 1.0.0

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: 10e7fda9671060c0bff15d92399bb2eb91951998baef2f6a96c09aa1b3e3618b
4
- data.tar.gz: 9f8650fbf420bfdd70cf749afac75383d73f07671f8e0bb064682e2d8dcc61ec
3
+ metadata.gz: eca7ce0b97986804a03d34b28a9340a1db8a67794682f3972ccef345177c551f
4
+ data.tar.gz: 857fc0984a08a2094e1c08b0fb945ee178f4eca3134173d50619758132e7213a
5
5
  SHA512:
6
- metadata.gz: 197d5801f77e89ff9f9fca0844d343dffb8466e8b99c23dbd028a3991351b1110b929ac624420909d7fc4c3cc12f3244dcc21ac0afdd4a287fc83ca98c7de37e
7
- data.tar.gz: 925f2686aa860ce400f13a27da02b55a4b79e2719c2a0713a3b55dced7fee03d225fc387ad52fcf580749113c80084a94ed6f0a274797a3b2c865691bf50b9cd
6
+ metadata.gz: daa2911323774f07433c7a4a88557465288b5be28fe246b32acb6b84b86db6da39b2c2ccac193a4d1de12127438eee0186e6c0fb8c482517e5addf8a61b4e997
7
+ data.tar.gz: 06b59c30143f00c3c651615af2e3070e481338a146cb77d3d08d88044631f396c9546c9ad5c70ea186b5b4ac455e6456b6e61662e8ee5e0b7d1c7069db80781d
@@ -6967,18 +6967,33 @@
6967
6967
 
6968
6968
  <xsl:template match="*[local-name()='localityStack']"/>
6969
6969
 
6970
+ <xsl:variable name="pdfAttachmentsList_">
6971
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6972
+ <attachment filename="{@name}"/>
6973
+ </xsl:for-each>
6974
+ </xsl:variable>
6975
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6976
+
6970
6977
  <xsl:template match="*[local-name()='link']" name="link">
6978
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6979
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6971
6980
  <xsl:variable name="target">
6972
6981
  <xsl:choose>
6973
6982
  <xsl:when test="@updatetype = 'true'">
6974
6983
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6975
6984
  </xsl:when>
6985
+ <!-- link to the PDF attachment -->
6986
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6987
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6988
+ </xsl:when>
6989
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6990
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6991
+ </xsl:when>
6976
6992
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6977
- <!-- link to the PDF attachment -->
6978
6993
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6979
6994
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6980
6995
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6981
- </xsl:when>
6996
+ </xsl:when> -->
6982
6997
  <xsl:otherwise>
6983
6998
  <xsl:value-of select="normalize-space(@target)"/>
6984
6999
  </xsl:otherwise>
@@ -11570,6 +11585,17 @@
11570
11585
  <xsl:copy-of select="."/>
11571
11586
  </xsl:template>
11572
11587
 
11588
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11589
+ <xsl:copy>
11590
+ <xsl:copy-of select="@*"/>
11591
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11592
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11593
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11594
+ <xsl:value-of select="."/>
11595
+ </xsl:if>
11596
+ </xsl:copy>
11597
+ </xsl:template>
11598
+
11573
11599
  <!-- add @id, mandatory for table auto-layout algorithm -->
11574
11600
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11575
11601
  <xsl:copy>
@@ -12444,7 +12470,8 @@
12444
12470
  </xsl:when>
12445
12471
  <xsl:otherwise>
12446
12472
  <!-- _{filename}_attachments -->
12447
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12473
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12474
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12448
12475
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12449
12476
  </xsl:otherwise>
12450
12477
  </xsl:choose>
@@ -6967,18 +6967,33 @@
6967
6967
 
6968
6968
  <xsl:template match="*[local-name()='localityStack']"/>
6969
6969
 
6970
+ <xsl:variable name="pdfAttachmentsList_">
6971
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6972
+ <attachment filename="{@name}"/>
6973
+ </xsl:for-each>
6974
+ </xsl:variable>
6975
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6976
+
6970
6977
  <xsl:template match="*[local-name()='link']" name="link">
6978
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6979
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6971
6980
  <xsl:variable name="target">
6972
6981
  <xsl:choose>
6973
6982
  <xsl:when test="@updatetype = 'true'">
6974
6983
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6975
6984
  </xsl:when>
6985
+ <!-- link to the PDF attachment -->
6986
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6987
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6988
+ </xsl:when>
6989
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6990
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6991
+ </xsl:when>
6976
6992
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6977
- <!-- link to the PDF attachment -->
6978
6993
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6979
6994
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6980
6995
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6981
- </xsl:when>
6996
+ </xsl:when> -->
6982
6997
  <xsl:otherwise>
6983
6998
  <xsl:value-of select="normalize-space(@target)"/>
6984
6999
  </xsl:otherwise>
@@ -11570,6 +11585,17 @@
11570
11585
  <xsl:copy-of select="."/>
11571
11586
  </xsl:template>
11572
11587
 
11588
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11589
+ <xsl:copy>
11590
+ <xsl:copy-of select="@*"/>
11591
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11592
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11593
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11594
+ <xsl:value-of select="."/>
11595
+ </xsl:if>
11596
+ </xsl:copy>
11597
+ </xsl:template>
11598
+
11573
11599
  <!-- add @id, mandatory for table auto-layout algorithm -->
11574
11600
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11575
11601
  <xsl:copy>
@@ -12444,7 +12470,8 @@
12444
12470
  </xsl:when>
12445
12471
  <xsl:otherwise>
12446
12472
  <!-- _{filename}_attachments -->
12447
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12473
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12474
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12448
12475
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12449
12476
  </xsl:otherwise>
12450
12477
  </xsl:choose>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module IHO
3
- VERSION = "0.9.12".freeze
3
+ VERSION = "1.0.0".freeze
4
4
  end
5
5
  end
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "sassc", "2.4.0"
40
40
  spec.add_development_dependency "simplecov", "~> 0.15"
41
41
  spec.add_development_dependency "timecop", "~> 0.9"
42
+ spec.add_development_dependency "xml-c14n"
42
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iho
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.12
4
+ version: 1.0.0
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-iho lets you write IHO in AsciiDoc syntax.
169
183