metanorma-ribose 2.4.2 → 2.4.4

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: 3d825402f962fe09dcaf1ed2da73bea3ee01caa2f54f6d6018a8a803f26570b8
4
- data.tar.gz: d2511c4b57dd5b2480cdaede2c2c5230b96800bdda243bace2af5ce5897c3ccb
3
+ metadata.gz: 7ce8de0432273f5b9ba03eeb10aa7c494698cf0d84701dd9e945a7bd1228665b
4
+ data.tar.gz: cb59e908e459a490b6edcf44f7caf0f6622079cd96591d74c03cb19b3dc49615
5
5
  SHA512:
6
- metadata.gz: e3ae9cecaeb3156b425a736a3d42f130530fc92bed574076ec7c249fae2777fc6528a8c4176066b0edc24922de238334db29ceed8b82655cff43f581f9a00465
7
- data.tar.gz: 1dba76ff265355a56d478c78e67c13d41f97f7871852cbfe7426f21d8ba64a3db97f2d1d9efe64a5d07fc70dde90fb7c4eb1734748559e4e1015700d8cc1c94a
6
+ metadata.gz: 1575984cc44861b1cec45264eace9db1a8733a8e135ac6d06e2a7cb2b32a882e7617531b6665caf9c6dd692e72d312087d1f98f75556a979e6745f041c8236b5
7
+ data.tar.gz: 673c558664981e0eca5a2965ca6cb4222a6281d94465a8e0e85eac029c26b31813188206e5a10e02dad4cdcfd7f0e20f79b61d0500f29a3e733f2122fe8394b3
@@ -1216,6 +1216,8 @@
1216
1216
  <xsl:param name="svg_images"/> <!-- svg images array -->
1217
1217
  <xsl:variable name="images" select="document($svg_images)"/>
1218
1218
  <xsl:param name="basepath"/> <!-- base path for images -->
1219
+ <xsl:param name="inputxml_basepath"/> <!-- input xml file path -->
1220
+ <xsl:param name="inputxml_filename"/> <!-- input xml file name -->
1219
1221
  <xsl:param name="external_index"/><!-- path to index xml, generated on 1st pass, based on FOP Intermediate Format -->
1220
1222
  <xsl:param name="syntax-highlight">false</xsl:param> <!-- syntax highlighting feature, default - off -->
1221
1223
  <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 -->
@@ -1268,6 +1270,20 @@
1268
1270
  <xsl:call-template name="getLang"/>
1269
1271
  </xsl:variable>
1270
1272
 
1273
+ <xsl:variable name="inputxml_filename_prefix">
1274
+ <xsl:choose>
1275
+ <xsl:when test="contains($inputxml_filename, '.presentation.xml')">
1276
+ <xsl:value-of select="substring-before($inputxml_filename, '.presentation.xml')"/>
1277
+ </xsl:when>
1278
+ <xsl:when test="contains($inputxml_filename, '.xml')">
1279
+ <xsl:value-of select="substring-before($inputxml_filename, '.xml')"/>
1280
+ </xsl:when>
1281
+ <xsl:otherwise>
1282
+ <xsl:value-of select="$inputxml_filename"/>
1283
+ </xsl:otherwise>
1284
+ </xsl:choose>
1285
+ </xsl:variable>
1286
+
1271
1287
  <!-- Note 1: Each xslt has declated variable `namespace` that allows to set some properties, processing logic, etc. for concrete xslt.
1272
1288
  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>,
1273
1289
  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 -->
@@ -2235,6 +2251,10 @@
2235
2251
 
2236
2252
  </xsl:attribute-set>
2237
2253
 
2254
+ <xsl:template name="refine_figure-block-style">
2255
+
2256
+ </xsl:template>
2257
+
2238
2258
  <xsl:attribute-set name="figure-style">
2239
2259
  <!-- background for image -->
2240
2260
  <xsl:attribute name="background-color">rgb(236,242,246)</xsl:attribute>
@@ -3192,7 +3212,7 @@
3192
3212
  <xsl:variable name="cols-count" select="count(xalan:nodeset($simple-table)/*/tr[1]/td)"/>
3193
3213
 
3194
3214
  <xsl:variable name="colwidths">
3195
- <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col'])">
3215
+ <xsl:if test="not(*[local-name()='colgroup']/*[local-name()='col']) and not(@class = 'dl')">
3196
3216
  <xsl:call-template name="calculate-column-widths">
3197
3217
  <xsl:with-param name="cols-count" select="$cols-count"/>
3198
3218
  <xsl:with-param name="table" select="$simple-table"/>
@@ -3304,6 +3324,11 @@
3304
3324
  <fo:table-column column-width="{@width}"/>
3305
3325
  </xsl:for-each>
3306
3326
  </xsl:when>
3327
+ <xsl:when test="@class = 'dl'">
3328
+ <xsl:for-each select=".//*[local-name()='tr'][1]/*">
3329
+ <fo:table-column column-width="{@width}"/>
3330
+ </xsl:for-each>
3331
+ </xsl:when>
3307
3332
  <xsl:otherwise>
3308
3333
  <xsl:call-template name="insertTableColumnWidth">
3309
3334
  <xsl:with-param name="colwidths" select="$colwidths"/>
@@ -4579,6 +4604,7 @@
4579
4604
  <!-- ===================== -->
4580
4605
  <!-- Definition List -->
4581
4606
  <!-- ===================== -->
4607
+
4582
4608
  <xsl:template match="*[local-name()='dl']">
4583
4609
  <xsl:variable name="isAdded" select="@added"/>
4584
4610
  <xsl:variable name="isDeleted" select="@deleted"/>
@@ -4791,10 +4817,21 @@
4791
4817
  </xsl:variable>
4792
4818
 
4793
4819
  <xsl:variable name="colwidths">
4794
- <xsl:call-template name="calculate-column-widths">
4795
- <xsl:with-param name="cols-count" select="2"/>
4796
- <xsl:with-param name="table" select="$simple-table"/>
4797
- </xsl:call-template>
4820
+ <xsl:choose>
4821
+ <!-- dl from table[@class='dl'] -->
4822
+ <xsl:when test="*[local-name() = 'colgroup']">
4823
+ <autolayout/>
4824
+ <xsl:for-each select="*[local-name() = 'colgroup']/*[local-name() = 'col']">
4825
+ <column><xsl:value-of select="translate(@width,'%m','')"/></column>
4826
+ </xsl:for-each>
4827
+ </xsl:when>
4828
+ <xsl:otherwise>
4829
+ <xsl:call-template name="calculate-column-widths">
4830
+ <xsl:with-param name="cols-count" select="2"/>
4831
+ <xsl:with-param name="table" select="$simple-table"/>
4832
+ </xsl:call-template>
4833
+ </xsl:otherwise>
4834
+ </xsl:choose>
4798
4835
  </xsl:variable>
4799
4836
 
4800
4837
  <!-- <xsl:text disable-output-escaping="yes">&lt;!- -</xsl:text>
@@ -5533,7 +5570,8 @@
5533
5570
  </xsl:template>
5534
5571
 
5535
5572
  <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
5536
- <xsl:variable name="text" select="normalize-space(.)"/>
5573
+ <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
5574
+ <xsl:variable name="text" select="."/>
5537
5575
  <fo:inline font-size="75%" role="SKIP">
5538
5576
  <xsl:if test="string-length($text) &gt; 0">
5539
5577
  <xsl:variable name="smallCapsText">
@@ -6901,6 +6939,12 @@
6901
6939
  <xsl:when test="@updatetype = 'true'">
6902
6940
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6903
6941
  </xsl:when>
6942
+ <xsl:when test="contains(@target, concat('_', $inputxml_filename_prefix, '_attachments'))">
6943
+ <!-- link to the PDF attachment -->
6944
+ <xsl:variable name="target_" select="translate(@target, '\', '/')"/>
6945
+ <xsl:variable name="target__" select="substring-after($target_, concat('_', $inputxml_filename_prefix, '_attachments', '/'))"/>
6946
+ <xsl:value-of select="concat('url(embedded-file:', $target__, ')')"/>
6947
+ </xsl:when>
6904
6948
  <xsl:otherwise>
6905
6949
  <xsl:value-of select="normalize-space(@target)"/>
6906
6950
  </xsl:otherwise>
@@ -7310,6 +7354,7 @@
7310
7354
  <xsl:variable name="isAdded" select="@added"/>
7311
7355
  <xsl:variable name="isDeleted" select="@deleted"/>
7312
7356
  <fo:block-container id="{@id}" xsl:use-attribute-sets="figure-block-style">
7357
+ <xsl:call-template name="refine_figure-block-style"/>
7313
7358
 
7314
7359
  <xsl:call-template name="setTrackChangesStyles">
7315
7360
  <xsl:with-param name="isAdded" select="$isAdded"/>
@@ -7666,16 +7711,44 @@
7666
7711
  </xsl:choose>
7667
7712
 
7668
7713
  <xsl:attribute name="content-width">scale-down-to-fit</xsl:attribute>
7669
- <xsl:variable name="svg_width" select="xalan:nodeset($svg_content)/*/@width"/>
7670
- <xsl:variable name="svg_height" select="xalan:nodeset($svg_content)/*/@height"/>
7714
+ <xsl:variable name="svg_width_" select="xalan:nodeset($svg_content)/*/@width"/>
7715
+ <xsl:variable name="svg_width" select="number(translate($svg_width_, 'px', ''))"/>
7716
+ <xsl:variable name="svg_height_" select="xalan:nodeset($svg_content)/*/@height"/>
7717
+ <xsl:variable name="svg_height" select="number(translate($svg_height_, 'px', ''))"/>
7718
+
7719
+ <!-- Example: -->
7671
7720
  <!-- effective height 297 - 27.4 - 13 = 256.6 -->
7672
7721
  <!-- effective width 210 - 12.5 - 25 = 172.5 -->
7673
7722
  <!-- effective height / width = 1.48, 1.4 - with title -->
7674
- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)"> <!-- for images with big height -->
7723
+
7724
+ <xsl:variable name="scale_x">
7725
+ <xsl:choose>
7726
+ <xsl:when test="$svg_width &gt; $width_effective_px">
7727
+ <xsl:value-of select="$width_effective_px div $svg_width"/>
7728
+ </xsl:when>
7729
+ <xsl:otherwise>1</xsl:otherwise>
7730
+ </xsl:choose>
7731
+ </xsl:variable>
7732
+ <xsl:variable name="scale_y">
7733
+ <xsl:choose>
7734
+ <xsl:when test="$svg_height * $scale_x &gt; $height_effective_px">
7735
+ <xsl:value-of select="$height_effective_px div ($svg_height * $scale_x)"/>
7736
+ </xsl:when>
7737
+ <xsl:otherwise>1</xsl:otherwise>
7738
+ </xsl:choose>
7739
+ </xsl:variable>
7740
+
7741
+ <!-- for images with big height -->
7742
+ <!-- <xsl:if test="$svg_height &gt; ($svg_width * 1.4)">
7675
7743
  <xsl:variable name="width" select="(($svg_width * 1.4) div $svg_height) * 100"/>
7676
7744
  <xsl:attribute name="width"><xsl:value-of select="$width"/>%</xsl:attribute>
7677
- </xsl:if>
7745
+ </xsl:if> -->
7678
7746
  <xsl:attribute name="scaling">uniform</xsl:attribute>
7747
+
7748
+ <xsl:if test="$scale_y != 1">
7749
+ <xsl:attribute name="content-height"><xsl:value-of select="round($scale_x * $scale_y * 100)"/>%</xsl:attribute>
7750
+ </xsl:if>
7751
+
7679
7752
  <xsl:copy-of select="$svg_content"/>
7680
7753
  </fo:instream-foreign-object>
7681
7754
  <!-- </fo:block> -->
@@ -7713,8 +7786,12 @@
7713
7786
  <xsl:variable name="width" select="normalize-space($viewbox//item[3])"/>
7714
7787
  <xsl:variable name="height" select="normalize-space($viewbox//item[4])"/>
7715
7788
 
7789
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[1][local-name() = 'image']/@width)"/>
7790
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[1][local-name() = 'image']/@height)"/>
7791
+
7716
7792
  <xsl:attribute name="width">
7717
7793
  <xsl:choose>
7794
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7718
7795
  <xsl:when test="$width != ''">
7719
7796
  <xsl:value-of select="round($width)"/>
7720
7797
  </xsl:when>
@@ -7723,6 +7800,7 @@
7723
7800
  </xsl:attribute>
7724
7801
  <xsl:attribute name="height">
7725
7802
  <xsl:choose>
7803
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7726
7804
  <xsl:when test="$height != ''">
7727
7805
  <xsl:value-of select="round($height)"/>
7728
7806
  </xsl:when>
@@ -7734,6 +7812,28 @@
7734
7812
  </xsl:copy>
7735
7813
  </xsl:template>
7736
7814
 
7815
+ <xsl:template match="*[local-name() = 'svg']/@width" mode="svg_update">
7816
+ <!-- image[@width]/svg -->
7817
+ <xsl:variable name="parent_image_width" select="normalize-space(ancestor::*[2][local-name() = 'image']/@width)"/>
7818
+ <xsl:attribute name="width">
7819
+ <xsl:choose>
7820
+ <xsl:when test="$parent_image_width != '' and $parent_image_width != 'auto'"><xsl:value-of select="$parent_image_width"/></xsl:when>
7821
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7822
+ </xsl:choose>
7823
+ </xsl:attribute>
7824
+ </xsl:template>
7825
+
7826
+ <xsl:template match="*[local-name() = 'svg']/@height" mode="svg_update">
7827
+ <!-- image[@height]/svg -->
7828
+ <xsl:variable name="parent_image_height" select="normalize-space(ancestor::*[2][local-name() = 'image']/@height)"/>
7829
+ <xsl:attribute name="height">
7830
+ <xsl:choose>
7831
+ <xsl:when test="$parent_image_height != '' and $parent_image_height != 'auto'"><xsl:value-of select="$parent_image_height"/></xsl:when>
7832
+ <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>
7833
+ </xsl:choose>
7834
+ </xsl:attribute>
7835
+ </xsl:template>
7836
+
7737
7837
  <!-- regex for 'display: inline-block;' -->
7738
7838
  <xsl:variable name="regex_svg_style_notsupported">display(\s|\h)*:(\s|\h)*inline-block(\s|\h)*;</xsl:variable>
7739
7839
  <xsl:template match="*[local-name() = 'svg']//*[local-name() = 'style']/text()" mode="svg_update">
@@ -9808,7 +9908,9 @@
9808
9908
  </xsl:template> <!-- sections_element_style -->
9809
9909
 
9810
9910
  <xsl:template match="//*[contains(local-name(), '-standard')]/*[local-name() = 'preface']/*" priority="2"> <!-- /*/*[local-name() = 'preface']/* -->
9811
- <fo:block break-after="page"/>
9911
+
9912
+ <fo:block break-after="page"/>
9913
+
9812
9914
  <fo:block>
9813
9915
  <xsl:call-template name="setId"/>
9814
9916
  <xsl:apply-templates/>
@@ -9875,7 +9977,7 @@
9875
9977
  <xsl:when test="ancestor::*[contains(local-name(), '-standard')] and not(ancestor::*[contains(local-name(), '-standard')]//*[@id = $id_from])">
9876
9978
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9877
9979
  </xsl:when>
9878
- <xsl:when test="not(//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9980
+ <xsl:when test="not(/*[@id = $id_from]) and not(/*//*[@id = $id_from]) and not(preceding-sibling::*[@id = $id_from])">
9879
9981
  <fo:block id="{@from}" font-size="1pt"><xsl:value-of select="$hair_space"/></fo:block>
9880
9982
  </xsl:when>
9881
9983
  </xsl:choose>
@@ -11669,10 +11771,10 @@
11669
11771
 
11670
11772
  <xsl:template name="addPDFUAmeta">
11671
11773
  <pdf:catalog xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
11672
- <pdf:dictionary type="normal" key="ViewerPreferences">
11673
- <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11674
- </pdf:dictionary>
11675
- </pdf:catalog>
11774
+ <pdf:dictionary type="normal" key="ViewerPreferences">
11775
+ <pdf:boolean key="DisplayDocTitle">true</pdf:boolean>
11776
+ </pdf:dictionary>
11777
+ </pdf:catalog>
11676
11778
  <x:xmpmeta xmlns:x="adobe:ns:meta/">
11677
11779
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
11678
11780
  <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:pdf="http://ns.adobe.com/pdf/1.3/" rdf:about="">
@@ -11724,6 +11826,19 @@
11724
11826
  </rdf:Description>
11725
11827
  </rdf:RDF>
11726
11828
  </x:xmpmeta>
11829
+ <!-- add attachments -->
11830
+ <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
11831
+ <xsl:choose>
11832
+ <xsl:when test="normalize-space() != ''">
11833
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{.}" filename="{@name}"/>
11834
+ </xsl:when>
11835
+ <xsl:otherwise>
11836
+ <!-- _{filename}_attachments -->
11837
+ <xsl:variable name="url" select="concat('url(file:///',$inputxml_basepath, '_', $inputxml_filename_prefix, '_attachments', '/', @name, ')')"/>
11838
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{@name}"/>
11839
+ </xsl:otherwise>
11840
+ </xsl:choose>
11841
+ </xsl:for-each>
11727
11842
  </xsl:template> <!-- addPDFUAmeta -->
11728
11843
 
11729
11844
  <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 Ribose
3
- VERSION = "2.4.2".freeze
3
+ VERSION = "2.4.4".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-ribose
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.4
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-10 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