metanorma-csa 2.4.2 → 2.4.3

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: b5bef565529ba8c3d376a169c0593757f0be8e0f51a876ef8043aa08127728df
4
- data.tar.gz: 47c1ae2636d2c8d0a954694480afe9f998d08afce3eb0626ae9e6f423e583ec4
3
+ metadata.gz: 9e4fa9ad31dfc822948fa0c41539cee42c88dcbc4d90aab489ea37075b2a25fd
4
+ data.tar.gz: ea51d3c48d4301eb2fbb32bcc2d143a831c4bd01503016ff4a5c89633a94a05a
5
5
  SHA512:
6
- metadata.gz: 83bcf0f50b66cf1893a1de62f51e1fbcbe77a3703f6071d7be60d7968e6fdc28b772551062a781e3e1b9231aa6e16f190a00137765e60fd83dec2712c5d5e2dd
7
- data.tar.gz: 8d50516c5236e27df948c97cf6e7c36a9182df9e1d51c9fbf382fd1a7c8392978425de3d210d825edf2268976af3c0edc4e35bc3528045f5b821b2fd69addbb7
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 -->
@@ -1526,6 +1542,10 @@
1526
1542
 
1527
1543
  </xsl:attribute-set>
1528
1544
 
1545
+ <xsl:template name="refine_figure-block-style">
1546
+
1547
+ </xsl:template>
1548
+
1529
1549
  <xsl:attribute-set name="figure-style">
1530
1550
 
1531
1551
  </xsl:attribute-set>
@@ -2444,7 +2464,7 @@
2444
2464
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2445
2465
 
2446
2466
  <xsl:variable name="colwidths">
2447
- <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')">
2448
2468
  <xsl:call-template name="calculate-column-widths">
2449
2469
  <xsl:with-param name="cols-count" select="$cols-count"/>
2450
2470
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2556,6 +2576,11 @@
2556
2576
  <fo:table-column column-width="{@width}"/>
2557
2577
  </xsl:for-each>
2558
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>
2559
2584
  <xsl:otherwise>
2560
2585
  <xsl:call-template name="insertTableColumnWidth">
2561
2586
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3831,6 +3856,7 @@
3831
3856
  <!-- ===================== -->
3832
3857
  <!-- Definition List -->
3833
3858
  <!-- ===================== -->
3859
+
3834
3860
  <xsl:template match="*[local-name()='dl']">
3835
3861
  <xsl:variable name="isAdded" select="@added"/>
3836
3862
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4043,10 +4069,21 @@
4043
4069
  </xsl:variable>
4044
4070
 
4045
4071
  <xsl:variable name="colwidths">
4046
- <xsl:call-template name="calculate-column-widths">
4047
- <xsl:with-param name="cols-count" select="2"/>
4048
- <xsl:with-param name="table" select="$simple-table"/>
4049
- </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>
4050
4087
  </xsl:variable>
4051
4088
 
4052
4089
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -6142,6 +6179,12 @@
6142
6179
  <xsl:when test="@updatetype = 'true'">
6143
6180
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6144
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>
6145
6188
  <xsl:otherwise>
6146
6189
  <xsl:value-of select="normalize-space(@target)"/>
6147
6190
  </xsl:otherwise>
@@ -6551,6 +6594,7 @@
6551
6594
  <xsl:variable name="isAdded" select="@added"/>
6552
6595
  <xsl:variable name="isDeleted" select="@deleted"/>
6553
6596
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6597
+ <xsl:call-template name="refine_figure-block-style"/>
6554
6598
 
6555
6599
  <xsl:call-template name="setTrackChangesStyles">
6556
6600
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -10887,10 +10931,10 @@
10887
10931
 
10888
10932
  <xsl:template name="addPDFUAmeta">
10889
10933
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
10890
- <pdf:dictionary type="normal" key="ViewerPreferences">
10891
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10892
- </pdf:dictionary>
10893
- </pdf:catalog>
10934
+ <pdf:dictionary type="normal" key="ViewerPreferences">
10935
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10936
+ </pdf:dictionary>
10937
+ </pdf:catalog>
10894
10938
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
10895
10939
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
10896
10940
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -10942,6 +10986,19 @@
10942
10986
  </rdf:Description>
10943
10987
  </rdf:RDF>
10944
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>
10945
11002
  </xsl:template> <!-- addPDFUAmeta -->
10946
11003
 
10947
11004
  <xsl:template name="getId">
@@ -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.2".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.1"
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.2
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-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: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.6.1
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.1
26
+ version: 2.6.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement