metanorma-iec 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: 10177bc4adcd772657e975fa25b6291c9bc160c5305f6de3771dca5165376958
4
- data.tar.gz: 3e8e6457114391eab0741c6835962f8971a1d7c4895538c815372e6dc38aef80
3
+ metadata.gz: 67f13ed076d84721e934f89543ebd35bfb61dcde9a119fb1a74a6c37972ae638
4
+ data.tar.gz: 3c6d285ba5b25b7ede8fe587eb12634cc41a3bfde605f544480def7d7ddbf5ac
5
5
  SHA512:
6
- metadata.gz: 5a7d53c37f35af53686200f67f136562922c1ddecd44526782e25ba244939c5860956aceda69a2c4458d80d58e5a5aeb4e6d548d4a5cb3846f18b04665a81997
7
- data.tar.gz: e6bd168b98945bae77c74f348cacfb4ee20f81860cff0c6f8b3e4a6608a3e2372a726fc303069add01c99414da251d3ac527ee5b2ee8a7acc842c7be0073016a
6
+ metadata.gz: 12f7b8b241864d2c4ab78ca9862bf51b5d6a070959cce22501793e0709f06d37b21283e3b5447d942f21cf9a37dc61a293698e7a373b744d1774679ff812b530
7
+ data.tar.gz: 6dc3974076f9f24f247c1007e71d9eee1202bd96bdc89cf04cc900e48b137eb4870aee233461134d5ab29e8938238cb0bda7bea2ac806777d32bfc5cd91ac760
@@ -2116,6 +2116,8 @@
2116
2116
  <xsl:param name="svg_images"/> <!-- svg images array -->
2117
2117
  <xsl:variable name="images" select="document($svg_images)"/>
2118
2118
  <xsl:param name="basepath"/> <!-- base path for images -->
2119
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
2120
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
2119
2121
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
2120
2122
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
2121
2123
  <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 -->
@@ -2168,6 +2170,20 @@
2168
2170
  <xsl:call-template name="getLang"/>
2169
2171
  </xsl:variable>
2170
2172
 
2173
+ <xsl:variable name="inputxml_filename_prefix">
2174
+ <xsl:choose>
2175
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
2176
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
2177
+ </xsl:when>
2178
+ <xsl:when test="contains($inputxml_filename, '.xml')">
2179
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
2180
+ </xsl:when>
2181
+ <xsl:otherwise>
2182
+ <xsl:value-of select="$inputxml_filename"/>
2183
+ </xsl:otherwise>
2184
+ </xsl:choose>
2185
+ </xsl:variable>
2186
+
2171
2187
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
2172
2188
  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>,
2173
2189
  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 -->
@@ -3129,6 +3145,10 @@
3129
3145
 
3130
3146
  </xsl:attribute-set>
3131
3147
 
3148
+ <xsl:template name="refine_figure-block-style">
3149
+
3150
+ </xsl:template>
3151
+
3132
3152
  <xsl:attribute-set name="figure-style">
3133
3153
 
3134
3154
  </xsl:attribute-set>
@@ -4074,7 +4094,7 @@
4074
4094
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
4075
4095
 
4076
4096
  <xsl:variable name="colwidths">
4077
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
4097
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
4078
4098
  <xsl:call-template name="calculate-column-widths">
4079
4099
  <xsl:with-param name="cols-count" select="$cols-count"/>
4080
4100
  <xsl:with-param name="table" select="$simple-table"/>
@@ -4186,6 +4206,11 @@
4186
4206
  <fo:table-column column-width="{@width}"/>
4187
4207
  </xsl:for-each>
4188
4208
  </xsl:when>
4209
+ <xsl:when test="@class = 'dl'">
4210
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
4211
+ <fo:table-column column-width="{@width}"/>
4212
+ </xsl:for-each>
4213
+ </xsl:when>
4189
4214
  <xsl:otherwise>
4190
4215
  <xsl:call-template name="insertTableColumnWidth">
4191
4216
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -5534,6 +5559,7 @@
5534
5559
  <!-- ===================== -->
5535
5560
  <!-- Definition List -->
5536
5561
  <!-- ===================== -->
5562
+
5537
5563
  <xsl:template match="*[local-name()='dl']">
5538
5564
  <xsl:variable name="isAdded" select="@added"/>
5539
5565
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -5753,10 +5779,21 @@
5753
5779
  </xsl:variable>
5754
5780
 
5755
5781
  <xsl:variable name="colwidths">
5756
- <xsl:call-template name="calculate-column-widths">
5757
- <xsl:with-param name="cols-count" select="2"/>
5758
- <xsl:with-param name="table" select="$simple-table"/>
5759
- </xsl:call-template>
5782
+ <xsl:choose>
5783
+ <!-- dl from table[@class='dl'] -->
5784
+ <xsl:when test="*[local-name() = 'colgroup']">
5785
+ <autolayout/>
5786
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
5787
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
5788
+ </xsl:for-each>
5789
+ </xsl:when>
5790
+ <xsl:otherwise>
5791
+ <xsl:call-template name="calculate-column-widths">
5792
+ <xsl:with-param name="cols-count" select="2"/>
5793
+ <xsl:with-param name="table" select="$simple-table"/>
5794
+ </xsl:call-template>
5795
+ </xsl:otherwise>
5796
+ </xsl:choose>
5760
5797
  </xsl:variable>
5761
5798
 
5762
5799
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -7928,6 +7965,12 @@
7928
7965
  <xsl:when test="@updatetype = 'true'">
7929
7966
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7930
7967
  </xsl:when>
7968
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
7969
+ <!-- link to the PDF attachment -->
7970
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
7971
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
7972
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
7973
+ </xsl:when>
7931
7974
  <xsl:otherwise>
7932
7975
  <xsl:value-of select="normalize-space(@target)"/>
7933
7976
  </xsl:otherwise>
@@ -8335,6 +8378,7 @@
8335
8378
  <xsl:variable name="isAdded" select="@added"/>
8336
8379
  <xsl:variable name="isDeleted" select="@deleted"/>
8337
8380
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
8381
+ <xsl:call-template name="refine_figure-block-style"/>
8338
8382
 
8339
8383
  <xsl:call-template name="setTrackChangesStyles">
8340
8384
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -12719,10 +12763,10 @@
12719
12763
 
12720
12764
  <xsl:template name="addPDFUAmeta">
12721
12765
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
12722
- <pdf:dictionary type="normal" key="ViewerPreferences">
12723
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12724
- </pdf:dictionary>
12725
- </pdf:catalog>
12766
+ <pdf:dictionary type="normal" key="ViewerPreferences">
12767
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
12768
+ </pdf:dictionary>
12769
+ </pdf:catalog>
12726
12770
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
12727
12771
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
12728
12772
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -12774,6 +12818,19 @@
12774
12818
  </rdf:Description>
12775
12819
  </rdf:RDF>
12776
12820
  </x:xmpmeta>
12821
+ <!-- add attachments -->
12822
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12823
+ <xsl:choose>
12824
+ <xsl:when test="normalize-space() != ''">
12825
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
12826
+ </xsl:when>
12827
+ <xsl:otherwise>
12828
+ <!-- _{filename}_attachments -->
12829
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
12830
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
12831
+ </xsl:otherwise>
12832
+ </xsl:choose>
12833
+ </xsl:for-each>
12777
12834
  </xsl:template> <!-- addPDFUAmeta -->
12778
12835
 
12779
12836
  <xsl:template name="getId">
@@ -21,6 +21,11 @@ module IsoDoc
21
21
  i18nyaml: i18nyaml || @i18nyaml)
22
22
  end
23
23
 
24
+ def bibrenderer
25
+ ::Relaton::Render::Iec::General.new(options.merge(language: @lang,
26
+ i18nhash: @i18n.get))
27
+ end
28
+
24
29
  def convert1(docxml, filename, dir)
25
30
  id = docxml&.at(ns("//bibdata/docnumber"))&.text
26
31
  @is_iev = id == "60050"
@@ -50,11 +50,6 @@ module IsoDoc
50
50
  end
51
51
  end
52
52
 
53
- def bibrenderer
54
- ::Relaton::Render::Iec::General.new(language: @lang,
55
- i18nhash: @i18n.get)
56
- end
57
-
58
53
  def rearrange_clauses(docxml)
59
54
  insert_foreword(docxml) # feeds preface_rearrange
60
55
  super
@@ -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,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.4.2".freeze
3
+ VERSION = "2.4.3".freeze
4
4
  end
5
5
  end
6
6
 
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
32
32
 
33
- spec.add_dependency "metanorma-iso", "~> 2.7.2"
33
+ spec.add_dependency "metanorma-iso", "~> 2.7.3"
34
34
  spec.add_dependency "pubid-iec"
35
35
  spec.add_dependency "ruby-jing"
36
36
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
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: bin
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-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.2
19
+ version: 2.7.3
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.7.2
26
+ version: 2.7.3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid-iec
29
29
  requirement: !ruby/object:Gem::Requirement