metanorma-cc 2.4.1 → 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: a74278944515a96765355e89d30bfa38d646f59103f31f99246ee3a41ef94881
4
- data.tar.gz: 72d2d58b0a0a96269a64e64b1a98852c63d7e4d11073939a39133e2bcbf89fc3
3
+ metadata.gz: 32bfaf3f86ecb540428f86505f79864dd157364fbeb6fccf10c181cbeb58b2be
4
+ data.tar.gz: adfd87a733968a6a3f6433819f1e525673fe269195cc3796053b29f7d6e30ee8
5
5
  SHA512:
6
- metadata.gz: 7e4b30978683747f20cd9c4461e9d2b0a262f10fb4c6b0d8a4b7e8fcc97bf58c09681b8a362b4c9f97c0147c570fd3d56a6e98f661be0188c539f0b6df0e72d3
7
- data.tar.gz: fe54f010d18b64cd5ea8a5189df24b9b7c92140442e2cd543e2a18f22fd69f982b2ae7db8b2290ae1284d063537eb70f8de2414ac6fcb32f56464aafb4e5e054
6
+ metadata.gz: '098d32219289258a4427b7f0f0b86c66086b49a0346465dd05081216a8bf788a93781a03af337029759fe579e266b2c51ed7c54ea90a3840f158e8d93470079a'
7
+ data.tar.gz: a1a92edfde8b3a32a187f3516c3092ff3527e459360aee45e9a4c82542bd16889434dea7c1015877f5de5565f9d8762f226895d43fe58af72896da12121f5bc4
@@ -586,6 +586,8 @@
586
586
  <xsl:param name="svg_images"/> <!-- svg images array -->
587
587
  <xsl:variable name="images" select="document($svg_images)"/>
588
588
  <xsl:param name="basepath"/> <!-- base path for images -->
589
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
590
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
589
591
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
590
592
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
591
593
  <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 -->
@@ -638,6 +640,20 @@
638
640
  <xsl:call-template name="getLang"/>
639
641
  </xsl:variable>
640
642
 
643
+ <xsl:variable name="inputxml_filename_prefix">
644
+ <xsl:choose>
645
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
646
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
647
+ </xsl:when>
648
+ <xsl:when test="contains($inputxml_filename, '.xml')">
649
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
650
+ </xsl:when>
651
+ <xsl:otherwise>
652
+ <xsl:value-of select="$inputxml_filename"/>
653
+ </xsl:otherwise>
654
+ </xsl:choose>
655
+ </xsl:variable>
656
+
641
657
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
642
658
  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>,
643
659
  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 -->
@@ -1094,6 +1110,10 @@
1094
1110
 
1095
1111
  </xsl:attribute-set>
1096
1112
 
1113
+ <xsl:template name="refine_termexample-style">
1114
+
1115
+ </xsl:template>
1116
+
1097
1117
  <xsl:attribute-set name="example-style">
1098
1118
 
1099
1119
  <xsl:attribute name="font-size">10pt</xsl:attribute>
@@ -1531,6 +1551,10 @@
1531
1551
 
1532
1552
  </xsl:attribute-set>
1533
1553
 
1554
+ <xsl:template name="refine_figure-block-style">
1555
+
1556
+ </xsl:template>
1557
+
1534
1558
  <xsl:attribute-set name="figure-style">
1535
1559
 
1536
1560
  </xsl:attribute-set>
@@ -2169,6 +2193,36 @@
2169
2193
  </xsl:for-each>
2170
2194
  </xsl:template>
2171
2195
 
2196
+ <xsl:template name="processMainSectionsDefault_flatxml">
2197
+ <xsl:for-each select="/*/*[local-name()='sections']/* | /*/*[local-name()='bibliography']/*[local-name()='references'][@normative='true']">
2198
+ <xsl:sort select="@displayorder" data-type="number"/>
2199
+ <xsl:variable name="flatxml">
2200
+ <xsl:apply-templates select="." mode="flatxml"/>
2201
+ </xsl:variable>
2202
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2203
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2204
+
2205
+ </xsl:for-each>
2206
+
2207
+ <xsl:for-each select="/*/*[local-name()='annex']">
2208
+ <xsl:sort select="@displayorder" data-type="number"/>
2209
+ <xsl:variable name="flatxml">
2210
+ <xsl:apply-templates select="." mode="flatxml"/>
2211
+ </xsl:variable>
2212
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2213
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2214
+ </xsl:for-each>
2215
+
2216
+ <xsl:for-each select="/*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]]">
2217
+ <xsl:sort select="@displayorder" data-type="number"/>
2218
+ <xsl:variable name="flatxml">
2219
+ <xsl:apply-templates select="." mode="flatxml"/>
2220
+ </xsl:variable>
2221
+ <!-- debug_flatxml='<xsl:copy-of select="$flatxml"/>' -->
2222
+ <xsl:apply-templates select="xalan:nodeset($flatxml)/*"/>
2223
+ </xsl:for-each>
2224
+ </xsl:template>
2225
+
2172
2226
  <xsl:variable name="regex_standard_reference">([A-Z]{2,}(/[A-Z]{2,})* \d+(-\d+)*(:\d{4})?)</xsl:variable>
2173
2227
  <xsl:variable name="tag_fo_inline_keep-together_within-line_open">###fo:inline keep-together_within-line###</xsl:variable>
2174
2228
  <xsl:variable name="tag_fo_inline_keep-together_within-line_close">###/fo:inline keep-together_within-line###</xsl:variable>
@@ -2396,7 +2450,7 @@
2396
2450
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
2397
2451
 
2398
2452
  <xsl:variable name="colwidths">
2399
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
2453
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
2400
2454
  <xsl:call-template name="calculate-column-widths">
2401
2455
  <xsl:with-param name="cols-count" select="$cols-count"/>
2402
2456
  <xsl:with-param name="table" select="$simple-table"/>
@@ -2508,6 +2562,11 @@
2508
2562
  <fo:table-column column-width="{@width}"/>
2509
2563
  </xsl:for-each>
2510
2564
  </xsl:when>
2565
+ <xsl:when test="@class = 'dl'">
2566
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
2567
+ <fo:table-column column-width="{@width}"/>
2568
+ </xsl:for-each>
2569
+ </xsl:when>
2511
2570
  <xsl:otherwise>
2512
2571
  <xsl:call-template name="insertTableColumnWidth">
2513
2572
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -3783,6 +3842,7 @@
3783
3842
  <!-- ===================== -->
3784
3843
  <!-- Definition List -->
3785
3844
  <!-- ===================== -->
3845
+
3786
3846
  <xsl:template match="*[local-name()='dl']">
3787
3847
  <xsl:variable name="isAdded" select="@added"/>
3788
3848
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -3995,10 +4055,21 @@
3995
4055
  </xsl:variable>
3996
4056
 
3997
4057
  <xsl:variable name="colwidths">
3998
- <xsl:call-template name="calculate-column-widths">
3999
- <xsl:with-param name="cols-count" select="2"/>
4000
- <xsl:with-param name="table" select="$simple-table"/>
4001
- </xsl:call-template>
4058
+ <xsl:choose>
4059
+ <!-- dl from table[@class='dl'] -->
4060
+ <xsl:when test="*[local-name() = 'colgroup']">
4061
+ <autolayout/>
4062
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4063
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4064
+ </xsl:for-each>
4065
+ </xsl:when>
4066
+ <xsl:otherwise>
4067
+ <xsl:call-template name="calculate-column-widths">
4068
+ <xsl:with-param name="cols-count" select="2"/>
4069
+ <xsl:with-param name="table" select="$simple-table"/>
4070
+ </xsl:call-template>
4071
+ </xsl:otherwise>
4072
+ </xsl:choose>
4002
4073
  </xsl:variable>
4003
4074
 
4004
4075
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -4244,13 +4315,13 @@
4244
4315
  <tr>
4245
4316
  <td>
4246
4317
  <xsl:attribute name="id">
4247
- <xsl:value-of select="concat($id,'_',$row_number,'_1')"/>
4318
+ <xsl:value-of select="concat($id,'@',$row_number,'_1')"/>
4248
4319
  </xsl:attribute>
4249
4320
  <xsl:apply-templates/>
4250
4321
  </td>
4251
4322
  <td>
4252
4323
  <xsl:attribute name="id">
4253
- <xsl:value-of select="concat($id,'_',$row_number,'_2')"/>
4324
+ <xsl:value-of select="concat($id,'@',$row_number,'_2')"/>
4254
4325
  </xsl:attribute>
4255
4326
 
4256
4327
  <xsl:apply-templates select="following-sibling::*[local-name()='dd'][1]">
@@ -4862,6 +4933,10 @@
4862
4933
  <fo:inline keep-with-next.within-line="always"><xsl:value-of select="."/></fo:inline>
4863
4934
  </xsl:template>
4864
4935
 
4936
+ <xsl:template match="*[local-name() = 'span'][contains(@style, 'text-transform:none')]//text()" priority="5">
4937
+ <xsl:value-of select="."/>
4938
+ </xsl:template>
4939
+
4865
4940
  <!-- ========================= -->
4866
4941
  <!-- END Rich text formatting -->
4867
4942
  <!-- ========================= -->
@@ -5492,7 +5567,7 @@
5492
5567
  </xsl:choose>
5493
5568
  </xsl:variable>
5494
5569
  <xsl:attribute name="id">
5495
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_',$divide)"/>
5570
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_',$divide)"/>
5496
5571
  </xsl:attribute>
5497
5572
 
5498
5573
  <xsl:for-each select="*[local-name() = 'p']">
@@ -5500,7 +5575,7 @@
5500
5575
  <xsl:copy-of select="@*"/>
5501
5576
  <xsl:variable name="p_num" select="count(preceding-sibling::*[local-name() = 'p']) + 1"/>
5502
5577
  <xsl:attribute name="id">
5503
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5578
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_p_',$p_num,'_',$divide)"/>
5504
5579
  </xsl:attribute>
5505
5580
 
5506
5581
  <!-- <xsl:copy-of select="node()" /> -->
@@ -5564,7 +5639,7 @@
5564
5639
  <xsl:variable name="num" select="count(preceding-sibling::word) + 1"/>
5565
5640
  <xsl:copy>
5566
5641
  <xsl:attribute name="id">
5567
- <xsl:value-of select="concat($id,'_',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5642
+ <xsl:value-of select="concat($id,'@',$row_number,'_',$col_number,'_word_',$num,'_',$divide)"/>
5568
5643
  </xsl:attribute>
5569
5644
  <xsl:copy-of select="node()"/>
5570
5645
  </xsl:copy>
@@ -6091,6 +6166,12 @@
6091
6166
  <xsl:when test="@updatetype = 'true'">
6092
6167
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6093
6168
  </xsl:when>
6169
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6170
+ <!-- link to the PDF attachment -->
6171
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6172
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6173
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6174
+ </xsl:when>
6094
6175
  <xsl:otherwise>
6095
6176
  <xsl:value-of select="normalize-space(@target)"/>
6096
6177
  </xsl:otherwise>
@@ -6496,6 +6577,7 @@
6496
6577
  <xsl:variable name="isAdded" select="@added"/>
6497
6578
  <xsl:variable name="isDeleted" select="@deleted"/>
6498
6579
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
6580
+ <xsl:call-template name="refine_figure-block-style"/>
6499
6581
 
6500
6582
  <xsl:call-template name="setTrackChangesStyles">
6501
6583
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -8366,7 +8448,7 @@
8366
8448
  <!-- ====== -->
8367
8449
  <xsl:template match="*[local-name() = 'termexample']">
8368
8450
  <fo:block id="{@id}" xsl:use-attribute-sets="termexample-style">
8369
-
8451
+ <xsl:call-template name="refine_termexample-style"/>
8370
8452
  <xsl:call-template name="setBlockSpanAll"/>
8371
8453
 
8372
8454
  <xsl:apply-templates select="*[local-name()='name']"/>
@@ -10864,10 +10946,10 @@
10864
10946
 
10865
10947
  <xsl:template name="addPDFUAmeta">
10866
10948
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
10867
- <pdf:dictionary type="normal" key="ViewerPreferences">
10868
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10869
- </pdf:dictionary>
10870
- </pdf:catalog>
10949
+ <pdf:dictionary type="normal" key="ViewerPreferences">
10950
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
10951
+ </pdf:dictionary>
10952
+ </pdf:catalog>
10871
10953
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
10872
10954
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
10873
10955
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -10919,6 +11001,19 @@
10919
11001
  </rdf:Description>
10920
11002
  </rdf:RDF>
10921
11003
  </x:xmpmeta>
11004
+ <!-- add attachments -->
11005
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11006
+ <xsl:choose>
11007
+ <xsl:when test="normalize-space() != ''">
11008
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11009
+ </xsl:when>
11010
+ <xsl:otherwise>
11011
+ <!-- _{filename}_attachments -->
11012
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11013
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11014
+ </xsl:otherwise>
11015
+ </xsl:choose>
11016
+ </xsl:for-each>
10922
11017
  </xsl:template> <!-- addPDFUAmeta -->
10923
11018
 
10924
11019
  <xsl:template name="getId">
@@ -14,7 +14,7 @@ module IsoDoc
14
14
  end
15
15
 
16
16
  def title(isoxml, _out)
17
- main = isoxml&.at(ns("//bibdata/title[@language='en']"))&.text
17
+ main = isoxml.at(ns("//bibdata/title[@language='en']"))&.children&.to_xml
18
18
  set(:doctitle, main)
19
19
  end
20
20
 
@@ -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 CC
3
- VERSION = "2.4.1".freeze
3
+ VERSION = "2.4.3".freeze
4
4
  end
5
5
  end
data/metanorma-cc.gemspec CHANGED
@@ -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-cc
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