metanorma-csa 2.4.1 → 2.4.3

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: 33d743a277d5c4b8e79e72e00babc9a6d893b790aa6d05b20c255fdad5497440
4
- data.tar.gz: 11f31706e87c44207935ff00b4b04fba1521a946b5a5025d28c20c8a78c95bb2
3
+ metadata.gz: 9e4fa9ad31dfc822948fa0c41539cee42c88dcbc4d90aab489ea37075b2a25fd
4
+ data.tar.gz: ea51d3c48d4301eb2fbb32bcc2d143a831c4bd01503016ff4a5c89633a94a05a
5
5
  SHA512:
6
- metadata.gz: aed6f2d3098350158f721f3caf59dcc1347a5677746e7200c686d2440df3af93e2d13efc730fbd89e5cd1d4667562d352a8835b34c0585bf26ef6ed12ba5a060
7
- data.tar.gz: f1f3a765842c7c35a7d6e04c7bcdb5509da00e81a2ff7430fc87ee3c4755a1b00fbd60b5ea593fac0076072522bc0ca1f4176466d0a772208c53d907161ba87f
6
+ metadata.gz: adf4a1a7e2bd08738e9d69dab199852d899438a6646b567662bc77d189647e4436dedc4a8f011b9a490ebc52017c41dcd398c89fd525f1e7d4458e63fbb96c39
7
+ data.tar.gz: ed481d1008946eea02b468a40168e98f7f216ff864936f15dc2f85a68431ff11829770d42d34b8041308d4f837492ae4cf65a7293406d14dea1c4b09c35b962a
@@ -583,6 +583,8 @@
583
583
  <xsl:param name="svg_images"/> <!-- svg images array -->
584
584
  <xsl:variable name="images" select="document($svg_images)"/>
585
585
  <xsl:param name="basepath"/> <!-- base path for images -->
586
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
587
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
586
588
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
587
589
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
588
590
  <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 -->
@@ -635,6 +637,20 @@
635
637
  <xsl:call-template name="getLang"/>
636
638
  </xsl:variable>
637
639
 
640
+ <xsl:variable name="inputxml_filename_prefix">
641
+ <xsl:choose>
642
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
643
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
644
+ </xsl:when>
645
+ <xsl:when test="contains($inputxml_filename, '.xml')">
646
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
647
+ </xsl:when>
648
+ <xsl:otherwise>
649
+ <xsl:value-of select="$inputxml_filename"/>
650
+ </xsl:otherwise>
651
+ </xsl:choose>
652
+ </xsl:variable>
653
+
638
654
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
639
655
  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>,
640
656
  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 -->
@@ -1093,6 +1109,10 @@
1093
1109
 
1094
1110
  </xsl:attribute-set>
1095
1111
 
1112
+ <xsl:template name="refine_termexample-style">
1113
+
1114
+ </xsl:template>
1115
+
1096
1116
  <xsl:attribute-set name="example-style">
1097
1117
 
1098
1118
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1522,6 +1542,10 @@
1522
1542
 
1523
1543
  </xsl:attribute-set>
1524
1544
 
1545
+ <xsl:template name="refine_figure-block-style">
1546
+
1547
+ </xsl:template>
1548
+
1525
1549
  <xsl:attribute-set name="figure-style">
1526
1550
 
1527
1551
  </xsl:attribute-set>
@@ -2185,6 +2209,36 @@
2185
2209
  </xsl:for-each>
2186
2210
  </xsl:template>
2187
2211
 
2212
+ <xsl:template name="processMainSectionsDefault_flatxml">
2213
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2214
+ <xsl:sort select="@displayorder" data-type="number"/>
2215
+ <xsl:variable name="flatxml">
2216
+ <xsl:apply-templates select="." mode="flatxml"/>
2217
+ </xsl:variable>
2218
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2219
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2220
+
2221
+ </xsl:for-each>
2222
+
2223
+ <xsl:for-each select="/*/*[local-name()='annex']">
2224
+ <xsl:sort select="@displayorder" data-type="number"/>
2225
+ <xsl:variable name="flatxml">
2226
+ <xsl:apply-templates select="." mode="flatxml"/>
2227
+ </xsl:variable>
2228
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2229
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2230
+ </xsl:for-each>
2231
+
2232
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2233
+ <xsl:sort select="@displayorder" data-type="number"/>
2234
+ <xsl:variable name="flatxml">
2235
+ <xsl:apply-templates select="." mode="flatxml"/>
2236
+ </xsl:variable>
2237
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2238
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2239
+ </xsl:for-each>
2240
+ </xsl:template>
2241
+
2188
2242
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2189
2243
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2190
2244
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -2410,7 +2464,7 @@
2410
2464
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2411
2465
 
2412
2466
  <xsl:variable name="colwidths">
2413
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2467
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2414
2468
  <xsl:call-template name="calculate-column-widths">
2415
2469
  <xsl:with-param name="cols-count" select="$cols-count"/>
2416
2470
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2522,6 +2576,11 @@
2522
2576
  <fo:table-column column-width="{@width}"/>
2523
2577
  </xsl:for-each>
2524
2578
  </xsl:when>
2579
+ <xsl:when test="@class = 'dl'">
2580
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2581
+ <fo:table-column column-width="{@width}"/>
2582
+ </xsl:for-each>
2583
+ </xsl:when>
2525
2584
  <xsl:otherwise>
2526
2585
  <xsl:call-template name="insertTableColumnWidth">
2527
2586
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3797,6 +3856,7 @@
3797
3856
  <!-- ===================== -->
3798
3857
  <!-- Definition List -->
3799
3858
  <!-- ===================== -->
3859
+
3800
3860
  <xsl:template match="*[local-name()='dl']">
3801
3861
  <xsl:variable name="isAdded" select="@added"/>
3802
3862
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4009,10 +4069,21 @@
4009
4069
  </xsl:variable>
4010
4070
 
4011
4071
  <xsl:variable name="colwidths">
4012
- <xsl:call-template name="calculate-column-widths">
4013
- <xsl:with-param name="cols-count" select="2"/>
4014
- <xsl:with-param name="table" select="$simple-table"/>
4015
- </xsl:call-template>
4072
+ <xsl:choose>
4073
+ <!-- dl from table[@class='dl'] -->
4074
+ <xsl:when test="*[local-name() = 'colgroup']">
4075
+ <autolayout/>
4076
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4077
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4078
+ </xsl:for-each>
4079
+ </xsl:when>
4080
+ <xsl:otherwise>
4081
+ <xsl:call-template name="calculate-column-widths">
4082
+ <xsl:with-param name="cols-count" select="2"/>
4083
+ <xsl:with-param name="table" select="$simple-table"/>
4084
+ </xsl:call-template>
4085
+ </xsl:otherwise>
4086
+ </xsl:choose>
4016
4087
  </xsl:variable>
4017
4088
 
4018
4089
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -4258,13 +4329,13 @@
4258
4329
  <tr>
4259
4330
  <td>
4260
4331
  <xsl:attribute name="id">
4261
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4332
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
4262
4333
  </xsl:attribute>
4263
4334
  <xsl:apply-templates/>
4264
4335
  </td>
4265
4336
  <td>
4266
4337
  <xsl:attribute name="id">
4267
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4338
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
4268
4339
  </xsl:attribute>
4269
4340
 
4270
4341
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -4875,6 +4946,10 @@
4875
4946
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4876
4947
  </xsl:template>
4877
4948
 
4949
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
4950
+ <xsl:value-of select="."/>
4951
+ </xsl:template>
4952
+
4878
4953
  <!-- ========================= -->
4879
4954
  <!-- END Rich text formatting -->
4880
4955
  <!-- ========================= -->
@@ -5505,7 +5580,7 @@
5505
5580
  </xsl:choose>
5506
5581
  </xsl:variable>
5507
5582
  <xsl:attribute name="id">
5508
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5583
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
5509
5584
  </xsl:attribute>
5510
5585
 
5511
5586
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5513,7 +5588,7 @@
5513
5588
  <xsl:copy-of select="@*"/>
5514
5589
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5515
5590
  <xsl:attribute name="id">
5516
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5591
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5517
5592
  </xsl:attribute>
5518
5593
 
5519
5594
  <!-- <xsl:copy-of select="node()" /> -->
@@ -5577,7 +5652,7 @@
5577
5652
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5578
5653
  <xsl:copy>
5579
5654
  <xsl:attribute name="id">
5580
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5655
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5581
5656
  </xsl:attribute>
5582
5657
  <xsl:copy-of select="node()"/>
5583
5658
  </xsl:copy>
@@ -6104,6 +6179,12 @@
6104
6179
  <xsl:when test="@updatetype = 'true'">
6105
6180
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6106
6181
  </xsl:when>
6182
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6183
+ <!-- link to the PDF attachment -->
6184
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6185
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6186
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6187
+ </xsl:when>
6107
6188
  <xsl:otherwise>
6108
6189
  <xsl:value-of select="normalize-space(@target)"/>
6109
6190
  </xsl:otherwise>
@@ -6513,6 +6594,7 @@
6513
6594
  <xsl:variable name="isAdded" select="@added"/>
6514
6595
  <xsl:variable name="isDeleted" select="@deleted"/>
6515
6596
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6597
+ <xsl:call-template name="refine_figure-block-style"/>
6516
6598
 
6517
6599
  <xsl:call-template name="setTrackChangesStyles">
6518
6600
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8382,7 +8464,7 @@
8382
8464
  <!-- ====== -->
8383
8465
  <xsl:template match="*[local-name() = 'termexample']">
8384
8466
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8385
-
8467
+ <xsl:call-template name="refine_termexample-style"/>
8386
8468
  <xsl:call-template name="setBlockSpanAll"/>
8387
8469
 
8388
8470
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -10849,10 +10931,10 @@
10849
10931
 
10850
10932
  <xsl:template name="addPDFUAmeta">
10851
10933
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
10852
- <pdf:dictionary type="normal" key="ViewerPreferences">
10853
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10854
- </pdf:dictionary>
10855
- </pdf:catalog>
10934
+ <pdf:dictionary type="normal" key="ViewerPreferences">
10935
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10936
+ </pdf:dictionary>
10937
+ </pdf:catalog>
10856
10938
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
10857
10939
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
10858
10940
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -10904,6 +10986,19 @@
10904
10986
  </rdf:Description>
10905
10987
  </rdf:RDF>
10906
10988
  </x:xmpmeta>
10989
+ <!-- add attachments -->
10990
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
10991
+ <xsl:choose>
10992
+ <xsl:when test="normalize-space() != ''">
10993
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
10994
+ </xsl:when>
10995
+ <xsl:otherwise>
10996
+ <!-- _{filename}_attachments -->
10997
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
10998
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
10999
+ </xsl:otherwise>
11000
+ </xsl:choose>
11001
+ </xsl:for-each>
10907
11002
  </xsl:template> <!-- addPDFUAmeta -->
10908
11003
 
10909
11004
  <xsl:template name="getId">
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'isodoc'
3
+ require "isodoc"
4
4
 
5
5
  module IsoDoc
6
6
  module Csa
@@ -12,7 +12,8 @@ module IsoDoc
12
12
  end
13
13
 
14
14
  def title(isoxml, _out)
15
- main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
15
+ main = isoxml.at(ns("//bibdata/title[@language='en']"))
16
+ &.children&.to_xml
16
17
  set(:doctitle, main)
17
18
  end
18
19
 
@@ -39,8 +40,8 @@ module IsoDoc
39
40
  end
40
41
 
41
42
  def nonauth_roles(isoxml, persons)
42
- roles = isoxml.xpath(ns("//bibdata/contributor[person]/role/@type")).
43
- inject([]) { |m, t| m << t.value }.reject { |i| i == "author" }
43
+ roles = isoxml.xpath(ns("//bibdata/contributor[person]/role/@type"))
44
+ .inject([]) { |m, t| m << t.value }.reject { |i| i == "author" }
44
45
  roles.uniq.sort.each do |r|
45
46
  n = isoxml.xpath(ns("//bibdata/contributor[role/@type = '#{r}']"\
46
47
  "/person"))
@@ -51,12 +52,13 @@ module IsoDoc
51
52
 
52
53
  def auth_roles(isoxml, persons)
53
54
  roles = isoxml.xpath(ns("//bibdata/contributor[person]/"\
54
- "role[@type = 'author']/description")).
55
- inject([]) { |m, t| m << t.text }
55
+ "role[@type = 'author']/description"))
56
+ .inject([]) { |m, t| m << t.text }
56
57
  roles.uniq.sort.each do |r|
57
58
  n = isoxml.xpath(
58
- ns("//bibdata/contributor[role/@type = 'author']"\
59
- "[xmlns:role/description = '#{r}']/person"))
59
+ ns("//bibdata/contributor[role/@type = 'author']"\
60
+ "[xmlns:role/description = '#{r}']/person"),
61
+ )
60
62
  n.empty? or persons[r] = extract_person_names_affiliations(n)
61
63
  end
62
64
  persons
@@ -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">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.4.1".freeze
3
+ VERSION = "2.4.3".freeze
4
4
  end
5
5
  end
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
  spec.require_paths = ["lib"]
30
30
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
31
31
 
32
- spec.add_dependency "metanorma-generic", "~> 2.6.0"
32
+ spec.add_dependency "metanorma-generic", "~> 2.6.2"
33
33
 
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-csa
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.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-05 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: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.0
19
+ version: 2.6.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.6.0
26
+ version: 2.6.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement