metanorma-cc 2.4.10 → 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: 369f0cb4d15f98e57d42473f3c1ff7f7633bde5811ee4741129f268704c99926
4
- data.tar.gz: b37de0d2a0e4df0c83113b50a7bd155fd5722eb58327f0c5420f53b69c0aa16f
3
+ metadata.gz: facd0c9522de467534082219cf82fc6c1bcc871defebf31aaf01b6349d144097
4
+ data.tar.gz: c15ab9ee72453f2ae9ee1143f94c45d878a3758c581d268eabcc382d59eeb180
5
5
  SHA512:
6
- metadata.gz: 96586da98fa88864917ed8484e7356fcd7680e932be88e69cc7c262fb516df3f888748e0f5161b3990e8bf46fea7293b6699e2c3d9db6bc5e93355f01ca9c33c
7
- data.tar.gz: 3970a5a194e635a2dce4e70cf7bcba6dabb1b4f323f61fa2c65f143d51a2241e59b0b3e6173202d4c008a33e52245988c9016ff6930c81e6347688b1f1ccc1ca
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>
@@ -8297,8 +8312,11 @@
8297
8312
  </xsl:template>
8298
8313
 
8299
8314
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
8315
+ <xsl:param name="element"/>
8300
8316
  <xsl:copy>
8301
- <xsl:apply-templates mode="contents_item"/>
8317
+ <xsl:apply-templates mode="contents_item">
8318
+ <xsl:with-param name="element" select="$element"/>
8319
+ </xsl:apply-templates>
8302
8320
  </xsl:copy>
8303
8321
  </xsl:template>
8304
8322
 
@@ -8365,7 +8383,10 @@
8365
8383
 
8366
8384
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8367
8385
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8368
- <xsl:apply-templates mode="contents_item"/>
8386
+ <xsl:param name="element"/>
8387
+ <xsl:apply-templates mode="contents_item">
8388
+ <xsl:with-param name="element" select="$element"/>
8389
+ </xsl:apply-templates>
8369
8390
  </xsl:template>
8370
8391
 
8371
8392
  <!-- =============== -->
@@ -11241,6 +11262,17 @@
11241
11262
  <xsl:copy-of select="."/>
11242
11263
  </xsl:template>
11243
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
+
11244
11276
  <!-- add @id, mandatory for table auto-layout algorithm -->
11245
11277
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11246
11278
  <xsl:copy>
@@ -12115,7 +12147,8 @@
12115
12147
  </xsl:when>
12116
12148
  <xsl:otherwise>
12117
12149
  <!-- _{filename}_attachments -->
12118
- <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, ')')"/>
12119
12152
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12120
12153
  </xsl:otherwise>
12121
12154
  </xsl:choose>
@@ -13,9 +13,9 @@
13
13
  <ref name="csd-standard"/>
14
14
  </start>
15
15
  <define name="FigureBody">
16
- <optional>
16
+ <zeroOrMore>
17
17
  <ref name="source"/>
18
- </optional>
18
+ </zeroOrMore>
19
19
  <optional>
20
20
  <ref name="tname"/>
21
21
  </optional>
@@ -17,7 +17,7 @@
17
17
  these elements; we just want one namespace for any child grammars
18
18
  of this.
19
19
  -->
20
- <!-- VERSION v1.3.2 -->
20
+ <!-- VERSION v1.3.3 -->
21
21
  <grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
22
22
  <include href="reqt.rng"/>
23
23
  <include href="basicdoc.rng">
@@ -331,9 +331,9 @@
331
331
  <zeroOrMore>
332
332
  <ref name="table-note"/>
333
333
  </zeroOrMore>
334
- <optional>
334
+ <zeroOrMore>
335
335
  <ref name="source"/>
336
- </optional>
336
+ </zeroOrMore>
337
337
  </define>
338
338
  <define name="FigureAttr">
339
339
  <optional>
@@ -380,9 +380,9 @@
380
380
  <zeroOrMore>
381
381
  <ref name="note"/>
382
382
  </zeroOrMore>
383
- <optional>
383
+ <zeroOrMore>
384
384
  <ref name="source"/>
385
- </optional>
385
+ </zeroOrMore>
386
386
  </define>
387
387
  <define name="source">
388
388
  <element name="source">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module CC
3
- VERSION = "2.4.10".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.10
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-08 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