metanorma-iho 0.9.11 → 1.0.0

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: d16b87b4a799b1e68df60702e316b4c58c34512d3a6c4e91c28f56c8c01b324a
4
- data.tar.gz: c029dbfaae5fc3ee697f7a8bddee327c47eb2b843cd16b4961d9e654a9cf691c
3
+ metadata.gz: eca7ce0b97986804a03d34b28a9340a1db8a67794682f3972ccef345177c551f
4
+ data.tar.gz: 857fc0984a08a2094e1c08b0fb945ee178f4eca3134173d50619758132e7213a
5
5
  SHA512:
6
- metadata.gz: ed12033c667766938f7d5045bb804ad8c1beed4528e8e920142b061fbb28b7fab33cefcd2da904f7e0e6442b089d0d5df3e082d29e094ec55ed23e25c97e17ef
7
- data.tar.gz: f413dca0ddf19e59d6e9e0fedb20a94627e6803548ec56005c72d2d9d9d7bd7b4f328628202918a07cd9e4a9e997affac7fe5b135758e587f94f26bd248ed513
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>
@@ -8631,8 +8646,11 @@
8631
8646
  </xsl:template>
8632
8647
 
8633
8648
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
8649
+ <xsl:param name="element"/>
8634
8650
  <xsl:copy>
8635
- <xsl:apply-templates mode="contents_item"/>
8651
+ <xsl:apply-templates mode="contents_item">
8652
+ <xsl:with-param name="element" select="$element"/>
8653
+ </xsl:apply-templates>
8636
8654
  </xsl:copy>
8637
8655
  </xsl:template>
8638
8656
 
@@ -8699,7 +8717,10 @@
8699
8717
 
8700
8718
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8701
8719
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8702
- <xsl:apply-templates mode="contents_item"/>
8720
+ <xsl:param name="element"/>
8721
+ <xsl:apply-templates mode="contents_item">
8722
+ <xsl:with-param name="element" select="$element"/>
8723
+ </xsl:apply-templates>
8703
8724
  </xsl:template>
8704
8725
 
8705
8726
  <!-- =============== -->
@@ -11564,6 +11585,17 @@
11564
11585
  <xsl:copy-of select="."/>
11565
11586
  </xsl:template>
11566
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
+
11567
11599
  <!-- add @id, mandatory for table auto-layout algorithm -->
11568
11600
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11569
11601
  <xsl:copy>
@@ -12438,7 +12470,8 @@
12438
12470
  </xsl:when>
12439
12471
  <xsl:otherwise>
12440
12472
  <!-- _{filename}_attachments -->
12441
- <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, ')')"/>
12442
12475
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12443
12476
  </xsl:otherwise>
12444
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>
@@ -8631,8 +8646,11 @@
8631
8646
  </xsl:template>
8632
8647
 
8633
8648
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
8649
+ <xsl:param name="element"/>
8634
8650
  <xsl:copy>
8635
- <xsl:apply-templates mode="contents_item"/>
8651
+ <xsl:apply-templates mode="contents_item">
8652
+ <xsl:with-param name="element" select="$element"/>
8653
+ </xsl:apply-templates>
8636
8654
  </xsl:copy>
8637
8655
  </xsl:template>
8638
8656
 
@@ -8699,7 +8717,10 @@
8699
8717
 
8700
8718
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8701
8719
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8702
- <xsl:apply-templates mode="contents_item"/>
8720
+ <xsl:param name="element"/>
8721
+ <xsl:apply-templates mode="contents_item">
8722
+ <xsl:with-param name="element" select="$element"/>
8723
+ </xsl:apply-templates>
8703
8724
  </xsl:template>
8704
8725
 
8705
8726
  <!-- =============== -->
@@ -11564,6 +11585,17 @@
11564
11585
  <xsl:copy-of select="."/>
11565
11586
  </xsl:template>
11566
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
+
11567
11599
  <!-- add @id, mandatory for table auto-layout algorithm -->
11568
11600
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11569
11601
  <xsl:copy>
@@ -12438,7 +12470,8 @@
12438
12470
  </xsl:when>
12439
12471
  <xsl:otherwise>
12440
12472
  <!-- _{filename}_attachments -->
12441
- <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, ')')"/>
12442
12475
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12443
12476
  </xsl:otherwise>
12444
12477
  </xsl:choose>
@@ -36,19 +36,21 @@ module IsoDoc
36
36
  end
37
37
 
38
38
  def clause_order_main(docxml)
39
- if docxml.at(ns("//sections/clause//references"))
39
+ if docxml.at(ns("//bibliography//references[@normative = 'true']")) ||
40
+ docxml.at(ns("//sections/references[@normative = 'true']"))
40
41
  [
41
42
  { path: "//sections/clause[@type = 'scope']" },
43
+ { path: "#{@klass.norm_ref_xpath} | //sections/references" },
42
44
  { path: "//sections/terms | //sections/definitions | " \
43
- "//sections/references | " \
44
45
  "//sections/clause[not(@type = 'scope')]", multi: true },
45
46
  ]
46
47
  else
47
48
  [
48
- { path: "//sections/clause[@type = 'scope']" },
49
- { path: @klass.norm_ref_xpath },
50
49
  { path: "//sections/terms | //sections/definitions | " \
51
- "//sections/clause[not(@type = 'scope')]", multi: true },
50
+ "//sections/references | " \
51
+ "//bibliography/references[@normative = 'true'] | " \
52
+ "//bibliography/clause[.//references[@normative = 'true']] | " \
53
+ "//sections/clause", multi: true },
52
54
  ]
53
55
  end
54
56
  end
@@ -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 IHO
3
- VERSION = "0.9.11".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.11
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-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-iho lets you write IHO in AsciiDoc syntax.
169
183