metanorma-ogc 2.5.12 → 2.5.14

Sign up to get free protection for your applications and to get access to all the features.
@@ -7978,18 +7978,33 @@
7978
7978
 
7979
7979
  <xsl:template match="*[local-name()='localityStack']"/>
7980
7980
 
7981
+ <xsl:variable name="pdfAttachmentsList_">
7982
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
7983
+ <attachment filename="{@name}"/>
7984
+ </xsl:for-each>
7985
+ </xsl:variable>
7986
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
7987
+
7981
7988
  <xsl:template match="*[local-name()='link']" name="link">
7989
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7990
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7982
7991
  <xsl:variable name="target">
7983
7992
  <xsl:choose>
7984
7993
  <xsl:when test="@updatetype = 'true'">
7985
7994
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7986
7995
  </xsl:when>
7996
+ <!-- link to the PDF attachment -->
7997
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
7998
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7999
+ </xsl:when>
8000
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8001
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
8002
+ </xsl:when>
7987
8003
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7988
- <!-- link to the PDF attachment -->
7989
8004
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7990
8005
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7991
8006
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7992
- </xsl:when>
8007
+ </xsl:when> -->
7993
8008
  <xsl:otherwise>
7994
8009
  <xsl:value-of select="normalize-space(@target)"/>
7995
8010
  </xsl:otherwise>
@@ -9666,8 +9681,11 @@
9666
9681
  </xsl:template>
9667
9682
 
9668
9683
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
9684
+ <xsl:param name="element"/>
9669
9685
  <xsl:copy>
9670
- <xsl:apply-templates mode="contents_item"/>
9686
+ <xsl:apply-templates mode="contents_item">
9687
+ <xsl:with-param name="element" select="$element"/>
9688
+ </xsl:apply-templates>
9671
9689
  </xsl:copy>
9672
9690
  </xsl:template>
9673
9691
 
@@ -9734,7 +9752,10 @@
9734
9752
 
9735
9753
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
9736
9754
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
9737
- <xsl:apply-templates mode="contents_item"/>
9755
+ <xsl:param name="element"/>
9756
+ <xsl:apply-templates mode="contents_item">
9757
+ <xsl:with-param name="element" select="$element"/>
9758
+ </xsl:apply-templates>
9738
9759
  </xsl:template>
9739
9760
 
9740
9761
  <!-- =============== -->
@@ -12630,6 +12651,17 @@
12630
12651
  <xsl:copy-of select="."/>
12631
12652
  </xsl:template>
12632
12653
 
12654
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12655
+ <xsl:copy>
12656
+ <xsl:copy-of select="@*"/>
12657
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12658
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12659
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12660
+ <xsl:value-of select="."/>
12661
+ </xsl:if>
12662
+ </xsl:copy>
12663
+ </xsl:template>
12664
+
12633
12665
  <!-- add @id, mandatory for table auto-layout algorithm -->
12634
12666
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
12635
12667
  <xsl:copy>
@@ -13504,7 +13536,8 @@
13504
13536
  </xsl:when>
13505
13537
  <xsl:otherwise>
13506
13538
  <!-- _{filename}_attachments -->
13507
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
13539
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
13540
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
13508
13541
  <pdf:embedded-file src="{$url}" filename="{@name}"/>
13509
13542
  </xsl:otherwise>
13510
13543
  </xsl:choose>
@@ -1062,7 +1062,7 @@
1062
1062
  <xsl:variable name="font_noto_serif">Noto Serif, Noto Serif HK, Noto Serif JP, Noto Serif KR, Noto Serif SC, Noto Serif TC</xsl:variable>
1063
1063
  <xsl:attribute-set name="root-style">
1064
1064
 
1065
- <xsl:attribute name="font-family">Arial, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
1065
+ <xsl:attribute name="font-family">Roboto, STIX Two Math, <xsl:value-of select="$font_noto_sans"/></xsl:attribute>
1066
1066
  <xsl:attribute name="font-family-generic">Sans</xsl:attribute>
1067
1067
  <xsl:attribute name="font-size">11pt</xsl:attribute>
1068
1068
 
@@ -6881,18 +6881,33 @@
6881
6881
 
6882
6882
  <xsl:template match="*[local-name()='localityStack']"/>
6883
6883
 
6884
+ <xsl:variable name="pdfAttachmentsList_">
6885
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
6886
+ <attachment filename="{@name}"/>
6887
+ </xsl:for-each>
6888
+ </xsl:variable>
6889
+ <xsl:variable name="pdfAttachmentsList" select="xalan:nodeset($pdfAttachmentsList_)"/>
6890
+
6884
6891
  <xsl:template match="*[local-name()='link']" name="link">
6892
+ <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6893
+ <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6885
6894
  <xsl:variable name="target">
6886
6895
  <xsl:choose>
6887
6896
  <xsl:when test="@updatetype = 'true'">
6888
6897
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6889
6898
  </xsl:when>
6899
+ <!-- link to the PDF attachment -->
6900
+ <xsl:when test="$pdfAttachmentsList//attachment[@filename = current()/@target]">
6901
+ <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6902
+ </xsl:when>
6903
+ <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6904
+ <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
6905
+ </xsl:when>
6890
6906
  <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6891
- <!-- link to the PDF attachment -->
6892
6907
  <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6893
6908
  <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6894
6909
  <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6895
- </xsl:when>
6910
+ </xsl:when> -->
6896
6911
  <xsl:otherwise>
6897
6912
  <xsl:value-of select="normalize-space(@target)"/>
6898
6913
  </xsl:otherwise>
@@ -8540,8 +8555,11 @@
8540
8555
  </xsl:template>
8541
8556
 
8542
8557
  <xsl:template match="*[local-name() = 'strong']" mode="contents_item">
8558
+ <xsl:param name="element"/>
8543
8559
  <xsl:copy>
8544
- <xsl:apply-templates mode="contents_item"/>
8560
+ <xsl:apply-templates mode="contents_item">
8561
+ <xsl:with-param name="element" select="$element"/>
8562
+ </xsl:apply-templates>
8545
8563
  </xsl:copy>
8546
8564
  </xsl:template>
8547
8565
 
@@ -8608,7 +8626,10 @@
8608
8626
 
8609
8627
  <!-- Note: to enable the addition of character span markup with semantic styling for DIS Word output -->
8610
8628
  <xsl:template match="*[local-name() = 'span']" mode="contents_item">
8611
- <xsl:apply-templates mode="contents_item"/>
8629
+ <xsl:param name="element"/>
8630
+ <xsl:apply-templates mode="contents_item">
8631
+ <xsl:with-param name="element" select="$element"/>
8632
+ </xsl:apply-templates>
8612
8633
  </xsl:template>
8613
8634
 
8614
8635
  <!-- =============== -->
@@ -11508,6 +11529,17 @@
11508
11529
  <xsl:copy-of select="."/>
11509
11530
  </xsl:template>
11510
11531
 
11532
+ <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
11533
+ <xsl:copy>
11534
+ <xsl:copy-of select="@*"/>
11535
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
11536
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
11537
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
11538
+ <xsl:value-of select="."/>
11539
+ </xsl:if>
11540
+ </xsl:copy>
11541
+ </xsl:template>
11542
+
11511
11543
  <!-- add @id, mandatory for table auto-layout algorithm -->
11512
11544
  <xsl:template match="*[local-name() = 'dl' or local-name() = 'table'][not(@id)]" mode="update_xml_step1">
11513
11545
  <xsl:copy>
@@ -12382,7 +12414,8 @@
12382
12414
  </xsl:when>
12383
12415
  <xsl:otherwise>
12384
12416
  <!-- _{filename}_attachments -->
12385
- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12417
+ <!-- <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/> -->
12418
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath , @name, ')')"/>
12386
12419
  <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12387
12420
  </xsl:otherwise>
12388
12421
  </xsl:choose>
@@ -17,9 +17,9 @@ module IsoDoc
17
17
 
18
18
  def default_fonts(_options)
19
19
  {
20
- bodyfont: '"Times New Roman",serif',
21
- headerfont: '"Times New Roman",serif',
22
- monospacefont: '"Courier New",monospace',
20
+ bodyfont: '"EB Garamond",serif',
21
+ headerfont: '"EB Garamond",serif',
22
+ monospacefont: '"Courier Prime",monospace',
23
23
  normalfontsize: "10.5pt",
24
24
  monospacefontsize: "10.0pt",
25
25
  footnotefontsize: "10.0pt",
@@ -46,7 +46,7 @@ module IsoDoc
46
46
  @wordcoverpage = html_doc_path("word_ogc_titlepage_wp.html")
47
47
  @wordintropage = html_doc_path("word_ogc_intro_wp.html")
48
48
  @header = html_doc_path("header_wp.html")
49
- options[:bodyfont] = '"Arial",sans-serif'
49
+ options[:bodyfont] = '"Roboto",sans-serif'
50
50
  options[:headerfont] = '"Lato",sans-serif'
51
51
  options[:normalfontsize] = "11.0pt"
52
52
  options[:footnotefontsize] = "11.0pt"
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.5.12".freeze
3
+ VERSION = "2.5.14".freeze
4
4
  end
5
5
  end
data/lib/metanorma/ogc.rb CHANGED
@@ -7,8 +7,8 @@ module Metanorma
7
7
  def self.fonts_used
8
8
  {
9
9
  html: ["Overpass", "SpaceMono"],
10
- doc: ["Times New Roman", "Cambria Math", "HanSans", "Courier New"],
11
- pdf: ["Lato", "Arial"],
10
+ doc: ["EB Garamond", "STIX Two Math", "HanSans", "Courier Prime"],
11
+ pdf: ["Lato", "Roboto"],
12
12
  }
13
13
  end
14
14
 
@@ -40,4 +40,5 @@ Gem::Specification.new do |spec|
40
40
  spec.add_development_dependency "timecop", "~> 0.9"
41
41
  spec.add_development_dependency "vcr", "~> 6.1.0"
42
42
  spec.add_development_dependency "webmock"
43
+ spec.add_development_dependency "xml-c14n"
43
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-ogc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.12
4
+ version: 2.5.14
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: iso-639
@@ -206,6 +206,20 @@ dependencies:
206
206
  - - ">="
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
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: 'Metanorma for the Open Geospatial Consortium.
210
224
 
211
225
  '