metanorma-ogc 2.5.2 → 2.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -164,7 +164,12 @@
164
164
  </xsl:for-each>
165
165
  </xsl:variable>
166
166
  <xsl:if test="normalize-space($editors) != ''">
167
- <fo:block margin-top="6pt">Editor: <xsl:value-of select="$editors"/></fo:block>
167
+ <fo:block margin-top="6pt">
168
+ <!-- Editor: -->
169
+ <xsl:call-template name="getLocalizedString">
170
+ <xsl:with-param name="key">editor_full</xsl:with-param>
171
+ </xsl:call-template><xsl:text>: </xsl:text><xsl:value-of select="$editors"/>
172
+ </fo:block>
168
173
  </xsl:if>
169
174
  </fo:block>
170
175
 
@@ -648,6 +653,8 @@
648
653
  <xsl:param name="svg_images"/> <!-- svg images array -->
649
654
  <xsl:variable name="images" select="document($svg_images)"/>
650
655
  <xsl:param name="basepath"/> <!-- base path for images -->
656
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
657
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
651
658
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
652
659
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
653
660
  <xsl:param name="add_math_as_text">true</xsl:param> <!-- add math in text behind svg formula, to copy-paste formula from PDF as text -->
@@ -700,6 +707,20 @@
700
707
  <xsl:call-template name="getLang"/>
701
708
  </xsl:variable>
702
709
 
710
+ <xsl:variable name="inputxml_filename_prefix">
711
+ <xsl:choose>
712
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
713
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
714
+ </xsl:when>
715
+ <xsl:when test="contains($inputxml_filename, '.xml')">
716
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
717
+ </xsl:when>
718
+ <xsl:otherwise>
719
+ <xsl:value-of select="$inputxml_filename"/>
720
+ </xsl:otherwise>
721
+ </xsl:choose>
722
+ </xsl:variable>
723
+
703
724
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
704
725
  You can put such conditions by using xslt construction `xsl:if test="..."` or <xsl:choose><xsl:when test=""></xsl:when><xsl:otherwiste></xsl:otherwiste></xsl:choose>,
705
726
  BUT DON'T put any another conditions together with $namespace = '...' (such conditions will be ignored). For another conditions, please use nested xsl:if or xsl:choose -->
@@ -1686,6 +1707,10 @@
1686
1707
 
1687
1708
  </xsl:attribute-set>
1688
1709
 
1710
+ <xsl:template name="refine_figure-block-style">
1711
+
1712
+ </xsl:template>
1713
+
1689
1714
  <xsl:attribute-set name="figure-style">
1690
1715
 
1691
1716
  </xsl:attribute-set>
@@ -2646,7 +2671,7 @@
2646
2671
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2647
2672
 
2648
2673
  <xsl:variable name="colwidths">
2649
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2674
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2650
2675
  <xsl:call-template name="calculate-column-widths">
2651
2676
  <xsl:with-param name="cols-count" select="$cols-count"/>
2652
2677
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2764,6 +2789,11 @@
2764
2789
  <fo:table-column column-width="{@width}"/>
2765
2790
  </xsl:for-each>
2766
2791
  </xsl:when>
2792
+ <xsl:when test="@class = 'dl'">
2793
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2794
+ <fo:table-column column-width="{@width}"/>
2795
+ </xsl:for-each>
2796
+ </xsl:when>
2767
2797
  <xsl:otherwise>
2768
2798
  <xsl:call-template name="insertTableColumnWidth">
2769
2799
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4049,6 +4079,7 @@
4049
4079
  <!-- ===================== -->
4050
4080
  <!-- Definition List -->
4051
4081
  <!-- ===================== -->
4082
+
4052
4083
  <xsl:template match="*[local-name()='dl']">
4053
4084
  <xsl:variable name="isAdded" select="@added"/>
4054
4085
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4261,10 +4292,21 @@
4261
4292
  </xsl:variable>
4262
4293
 
4263
4294
  <xsl:variable name="colwidths">
4264
- <xsl:call-template name="calculate-column-widths">
4265
- <xsl:with-param name="cols-count" select="2"/>
4266
- <xsl:with-param name="table" select="$simple-table"/>
4267
- </xsl:call-template>
4295
+ <xsl:choose>
4296
+ <!-- dl from table[@class='dl'] -->
4297
+ <xsl:when test="*[local-name() = 'colgroup']">
4298
+ <autolayout/>
4299
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4300
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4301
+ </xsl:for-each>
4302
+ </xsl:when>
4303
+ <xsl:otherwise>
4304
+ <xsl:call-template name="calculate-column-widths">
4305
+ <xsl:with-param name="cols-count" select="2"/>
4306
+ <xsl:with-param name="table" select="$simple-table"/>
4307
+ </xsl:call-template>
4308
+ </xsl:otherwise>
4309
+ </xsl:choose>
4268
4310
  </xsl:variable>
4269
4311
 
4270
4312
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -6363,6 +6405,12 @@
6363
6405
  <xsl:when test="@updatetype = 'true'">
6364
6406
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6365
6407
  </xsl:when>
6408
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6409
+ <!-- link to the PDF attachment -->
6410
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6411
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6412
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6413
+ </xsl:when>
6366
6414
  <xsl:otherwise>
6367
6415
  <xsl:value-of select="normalize-space(@target)"/>
6368
6416
  </xsl:otherwise>
@@ -6770,6 +6818,7 @@
6770
6818
  <xsl:variable name="isAdded" select="@added"/>
6771
6819
  <xsl:variable name="isDeleted" select="@deleted"/>
6772
6820
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6821
+ <xsl:call-template name="refine_figure-block-style"/>
6773
6822
 
6774
6823
  <xsl:call-template name="setTrackChangesStyles">
6775
6824
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -11157,10 +11206,10 @@
11157
11206
 
11158
11207
  <xsl:template name="addPDFUAmeta">
11159
11208
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
11160
- <pdf:dictionary type="normal" key="ViewerPreferences">
11161
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11162
- </pdf:dictionary>
11163
- </pdf:catalog>
11209
+ <pdf:dictionary type="normal" key="ViewerPreferences">
11210
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11211
+ </pdf:dictionary>
11212
+ </pdf:catalog>
11164
11213
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
11165
11214
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
11166
11215
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -11212,6 +11261,19 @@
11212
11261
  </rdf:Description>
11213
11262
  </rdf:RDF>
11214
11263
  </x:xmpmeta>
11264
+ <!-- add attachments -->
11265
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11266
+ <xsl:choose>
11267
+ <xsl:when test="normalize-space() != ''">
11268
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11269
+ </xsl:when>
11270
+ <xsl:otherwise>
11271
+ <!-- _{filename}_attachments -->
11272
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11273
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11274
+ </xsl:otherwise>
11275
+ </xsl:choose>
11276
+ </xsl:for-each>
11215
11277
  </xsl:template> <!-- addPDFUAmeta -->
11216
11278
 
11217
11279
  <xsl:template name="getId">
@@ -157,10 +157,6 @@ module IsoDoc
157
157
  bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
158
158
  end
159
159
 
160
- def bibrenderer
161
- ::Relaton::Render::Ogc::General.new(language: @lang)
162
- end
163
-
164
160
  def bibrender_formattedref(formattedref, xml); end
165
161
 
166
162
  def bibrender_relaton(xml, renderings)
@@ -338,29 +338,32 @@
338
338
  </define>
339
339
  <define name="organization">
340
340
  <element name="organization">
341
- <oneOrMore>
342
- <ref name="orgname"/>
343
- </oneOrMore>
344
- <zeroOrMore>
345
- <ref name="subdivision"/>
346
- </zeroOrMore>
347
- <optional>
348
- <ref name="abbreviation"/>
349
- </optional>
350
- <zeroOrMore>
351
- <ref name="uri"/>
352
- </zeroOrMore>
353
- <zeroOrMore>
354
- <ref name="org-identifier"/>
355
- </zeroOrMore>
356
- <zeroOrMore>
357
- <ref name="contact"/>
358
- </zeroOrMore>
359
- <optional>
360
- <ref name="logo"/>
361
- </optional>
341
+ <ref name="OrganizationType"/>
362
342
  </element>
363
343
  </define>
344
+ <define name="OrganizationType">
345
+ <oneOrMore>
346
+ <ref name="orgname"/>
347
+ </oneOrMore>
348
+ <zeroOrMore>
349
+ <ref name="subdivision"/>
350
+ </zeroOrMore>
351
+ <optional>
352
+ <ref name="abbreviation"/>
353
+ </optional>
354
+ <zeroOrMore>
355
+ <ref name="uri"/>
356
+ </zeroOrMore>
357
+ <zeroOrMore>
358
+ <ref name="org-identifier"/>
359
+ </zeroOrMore>
360
+ <zeroOrMore>
361
+ <ref name="contact"/>
362
+ </zeroOrMore>
363
+ <optional>
364
+ <ref name="logo"/>
365
+ </optional>
366
+ </define>
364
367
  <define name="orgname">
365
368
  <element name="name">
366
369
  <choice>
@@ -371,10 +374,10 @@
371
374
  </define>
372
375
  <define name="subdivision">
373
376
  <element name="subdivision">
374
- <choice>
375
- <ref name="LocalizedString"/>
376
- <ref name="NameWithVariants"/>
377
- </choice>
377
+ <optional>
378
+ <attribute name="type"/>
379
+ </optional>
380
+ <ref name="OrganizationType"/>
378
381
  </element>
379
382
  </define>
380
383
  <define name="logo">
@@ -10,14 +10,20 @@ module Metanorma
10
10
  personal_author(node, xml)
11
11
  end
12
12
 
13
+ def safe_xml_string(node, key, value)
14
+ node.send key do |n|
15
+ n << value
16
+ end
17
+ end
18
+
13
19
  def corporate_author(node, xml)
14
20
  node.attr("submitting-organizations") or return
15
- csv_split(HTMLEntities.new
16
- .decode(node.attr("submitting-organizations")), ";")&.each do |org|
21
+ csv_split(@c.decode(node.attr("submitting-organizations")),
22
+ ";")&.each do |org|
17
23
  xml.contributor do |c|
18
24
  c.role type: "author"
19
25
  c.organization do |a|
20
- a.name org
26
+ safe_xml_string(a, "name", org)
21
27
  end
22
28
  end
23
29
  end
@@ -39,9 +45,7 @@ module Metanorma
39
45
  type = node.attr("role#{suffix}")&.downcase || "editor"
40
46
  if type == "contributor"
41
47
  contrib.role type: "author" do |r|
42
- r.description do |d|
43
- d << type
44
- end
48
+ safe_xml_string(r, "description", type)
45
49
  end
46
50
  else contrib.role type: type
47
51
  end
@@ -64,17 +68,21 @@ module Metanorma
64
68
  personal_role(node, c, suffix)
65
69
  c.person do |p|
66
70
  p.name do |n|
67
- if node.attr("fullname#{suffix}")
68
- n.completename node.attr("fullname#{suffix}")
69
- else
70
- n.forename node.attr("givenname#{suffix}")
71
- n.surname node.attr("surname#{suffix}")
72
- end
71
+ personal_author_name(node, n, suffix)
73
72
  end
74
73
  end
75
74
  end
76
75
  end
77
76
 
77
+ def personal_author_name(node, xml, suffix)
78
+ if node.attr("fullname#{suffix}")
79
+ safe_xml_string(xml, "completename", node.attr("fullname#{suffix}"))
80
+ else
81
+ safe_xml_string(xml, "forename", node.attr("givenname#{suffix}"))
82
+ safe_xml_string(xml, "surname", node.attr("surname#{suffix}"))
83
+ end
84
+ end
85
+
78
86
  def default_publisher
79
87
  "OGC"
80
88
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Ogc
3
- VERSION = "2.5.2".freeze
3
+ VERSION = "2.5.3".freeze
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
27
27
 
28
28
  spec.add_dependency "iso-639"
29
- spec.add_dependency "metanorma-standoc", "~> 2.8.2"
29
+ spec.add_dependency "metanorma-standoc", "~> 2.8.4"
30
30
 
31
31
  spec.add_development_dependency "debug"
32
32
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
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.2
4
+ version: 2.5.3
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-02-19 00:00:00.000000000 Z
11
+ date: 2024-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.8.2
33
+ version: 2.8.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.8.2
40
+ version: 2.8.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement