metanorma-csa 2.5.2 → 2.5.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: 59fc6bb20c36f092138dea577abe66a6e1e63604316f806028487e6668aab801
4
- data.tar.gz: 67b871bae162e214b5d3431bd588d3db240d1a82f7952fefdb54a87c1c8a38c4
3
+ metadata.gz: 379fbbcafcd9cf94cf6f8745dc4b884166e262758cf606d47b570bbadb154a4e
4
+ data.tar.gz: bb91c273b3667bf4831eec3178b562735ee4ec46691b6823b2d85f0299394af9
5
5
  SHA512:
6
- metadata.gz: 9c3596a2d9c2d0f3ee08277e4a11d4d952336e0bcca4cdadd4ede530b057caf00d188c6afcb6712ed8f671629df94866f4655eb4942adec3fd2e55ce6d7677f9
7
- data.tar.gz: 72a05f08024dd308f2afd68a381295e270802c7620a90111500ac5f86abb4f4a54a36a60bb9561824b98acd6bf28f88554ea1226fb79bc890d9100764cfdaf2a
6
+ metadata.gz: a1dab799436d4f3094be42faecb1293ca5c181c4694cc1e86e5bd3a9d51862c6e7f0156071482eb74258b3e0b481f730a30cfa4fc4d81158637aa5617599a511
7
+ data.tar.gz: 77149266b62dd042f42b091158d0b2b4a415d8e4d4dac68a15a76d2b794c34205e6c2f39ce7ab4b5d6833f6fee24166503b881b09771c2b02e909acbe11c6608
@@ -3837,6 +3837,7 @@
3837
3837
 
3838
3838
  <fo:block role="SKIP">
3839
3839
  <xsl:apply-templates/>
3840
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
3840
3841
  </fo:block>
3841
3842
  </fo:table-cell>
3842
3843
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -3900,6 +3901,8 @@
3900
3901
 
3901
3902
  <xsl:if test="$isGenerateTableIF = 'true'"> <fo:inline id="{@id}_end">end</fo:inline></xsl:if> <!-- to determine width of text --> <!-- <xsl:value-of select="$hair_space"/> -->
3902
3903
 
3904
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
3905
+
3903
3906
  </fo:block>
3904
3907
  </fo:table-cell>
3905
3908
  </xsl:template> <!-- td -->
@@ -6685,14 +6688,16 @@
6685
6688
  <xsl:template match="*[local-name()='link']" name="link">
6686
6689
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
6687
6690
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
6691
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
6688
6692
  <xsl:variable name="target">
6689
6693
  <xsl:choose>
6690
6694
  <xsl:when test="@updatetype = 'true'">
6691
6695
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
6692
6696
  </xsl:when>
6693
6697
  <!-- link to the PDF attachment -->
6694
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
6695
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
6698
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
6699
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
6700
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
6696
6701
  </xsl:when>
6697
6702
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
6698
6703
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -6723,6 +6728,11 @@
6723
6728
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
6724
6729
  </xsl:if>
6725
6730
 
6731
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
6732
+ <xsl:attribute name="color">inherit</xsl:attribute>
6733
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
6734
+ </xsl:if>
6735
+
6726
6736
  <xsl:call-template name="refine_link-style"/>
6727
6737
 
6728
6738
  <xsl:choose>
@@ -6733,6 +6743,9 @@
6733
6743
  <xsl:call-template name="insert_basic_link">
6734
6744
  <xsl:with-param name="element">
6735
6745
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
6746
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
6747
+ <xsl:attribute name="role">Annot</xsl:attribute>
6748
+ </xsl:if>
6736
6749
  <xsl:choose>
6737
6750
  <xsl:when test="normalize-space(.) = ''">
6738
6751
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -6745,6 +6758,10 @@
6745
6758
  </xsl:otherwise>
6746
6759
  </xsl:choose>
6747
6760
  </fo:basic-link>
6761
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
6762
+ <!-- reserve space at right for PaperClip icon -->
6763
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
6764
+ </xsl:if>
6748
6765
  </xsl:with-param>
6749
6766
  </xsl:call-template>
6750
6767
  </xsl:otherwise>
@@ -12235,9 +12252,14 @@
12235
12252
  </x:xmpmeta>
12236
12253
  <!-- add attachments -->
12237
12254
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
12238
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
12239
-
12240
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
12255
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
12256
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
12257
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
12258
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
12259
+ <!-- Todo: need update -->
12260
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12261
+
12262
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
12241
12263
  <xsl:attribute name="src">
12242
12264
  <xsl:choose>
12243
12265
  <xsl:when test="normalize-space() != ''">
@@ -12253,18 +12275,27 @@
12253
12275
  <xsl:if test="$description != ''">
12254
12276
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12255
12277
  </xsl:if>
12278
+ <xsl:if test="$afrelationship != ''">
12279
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12280
+ </xsl:if>
12256
12281
  </pdf:embedded-file>
12257
12282
  </xsl:for-each>
12258
12283
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
12259
12284
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
12260
12285
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
12261
12286
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
12287
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
12262
12288
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
12263
12289
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
12264
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
12290
+ <!-- Todo: need update -->
12291
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
12292
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
12265
12293
  <xsl:if test="$description != ''">
12266
12294
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
12267
12295
  </xsl:if>
12296
+ <xsl:if test="$afrelationship != ''">
12297
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
12298
+ </xsl:if>
12268
12299
  </pdf:embedded-file>
12269
12300
  </xsl:for-each>
12270
12301
  </xsl:if>
@@ -12284,6 +12315,12 @@
12284
12315
  <!-- Get or calculate depth of the element -->
12285
12316
  <xsl:template name="getLevel">
12286
12317
  <xsl:param name="depth"/>
12318
+ <!-- <xsl:message>
12319
+ <xsl:choose>
12320
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
12321
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
12322
+ </xsl:choose>
12323
+ </xsl:message> -->
12287
12324
  <xsl:choose>
12288
12325
  <xsl:when test="normalize-space(@depth) != ''">
12289
12326
  <xsl:value-of select="@depth"/>
@@ -12304,8 +12341,27 @@
12304
12341
  <xsl:when test="ancestor::*[local-name() = 'preface']">
12305
12342
  <xsl:value-of select="$level_total - 2"/>
12306
12343
  </xsl:when>
12344
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
12345
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12346
+ <xsl:choose>
12347
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12348
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12349
+ </xsl:when>
12350
+ <xsl:otherwise>
12351
+ <xsl:value-of select="$level_total - 2"/>
12352
+ </xsl:otherwise>
12353
+ </xsl:choose>
12354
+ </xsl:when>
12307
12355
  <xsl:when test="ancestor::*[local-name() = 'sections']">
12308
- <xsl:value-of select="$level_total - 1"/>
12356
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
12357
+ <xsl:choose>
12358
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12359
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12360
+ </xsl:when>
12361
+ <xsl:otherwise>
12362
+ <xsl:value-of select="$level_total - 1"/>
12363
+ </xsl:otherwise>
12364
+ </xsl:choose>
12309
12365
  </xsl:when>
12310
12366
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
12311
12367
  <xsl:value-of select="$level_total - 1"/>
@@ -12313,6 +12369,17 @@
12313
12369
  <xsl:when test="parent::*[local-name() = 'annex']">
12314
12370
  <xsl:value-of select="$level_total - 1"/>
12315
12371
  </xsl:when>
12372
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
12373
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
12374
+ <xsl:choose>
12375
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
12376
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
12377
+ </xsl:when>
12378
+ <xsl:otherwise>
12379
+ <xsl:value-of select="$level_total - 1"/>
12380
+ </xsl:otherwise>
12381
+ </xsl:choose>
12382
+ </xsl:when>
12316
12383
  <xsl:when test="ancestor::*[local-name() = 'annex']">
12317
12384
  <xsl:value-of select="$level_total"/>
12318
12385
  </xsl:when>
@@ -12671,6 +12738,20 @@
12671
12738
 
12672
12739
  <!-- END: insert cover page image -->
12673
12740
 
12741
+ <xsl:template name="insertVerticalChar">
12742
+ <xsl:param name="str"/>
12743
+ <xsl:if test="string-length($str) &gt; 0">
12744
+ <fo:inline-container writing-mode="lr-tb" text-align="center" alignment-baseline="central" reference-orientation="90" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
12745
+ <fo:block-container width="1em">
12746
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
12747
+ </fo:block-container>
12748
+ </fo:inline-container>
12749
+ <xsl:call-template name="insertVerticalChar">
12750
+ <xsl:with-param name="str" select="substring($str, 2)"/>
12751
+ </xsl:call-template>
12752
+ </xsl:if>
12753
+ </xsl:template>
12754
+
12674
12755
  <xsl:template name="number-to-words">
12675
12756
  <xsl:param name="number"/>
12676
12757
  <xsl:param name="first"/>
@@ -12958,4 +13039,18 @@
12958
13039
  </xsl:if>
12959
13040
  </xsl:template>
12960
13041
 
13042
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
13043
+ <xsl:copy>
13044
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
13045
+ </xsl:copy>
13046
+ </xsl:template>
13047
+
13048
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
13049
+ <xsl:copy>
13050
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
13051
+ <xsl:attribute name="role">SKIP</xsl:attribute>
13052
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
13053
+ </xsl:copy>
13054
+ </xsl:template>
13055
+
12961
13056
  </xsl:stylesheet>
@@ -82,6 +82,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
82
82
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
83
83
  font-size: {{monospacefontsize}}; }
84
84
 
85
+ sub, sup {
86
+ font-size: 0.75em; }
87
+
85
88
  article, aside, details, figcaption, figure,
86
89
  footer, header, hgroup, menu, nav, section {
87
90
  display: block; }
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Csa
3
- VERSION = "2.5.2".freeze
3
+ VERSION = "2.5.3".freeze
4
4
  end
5
5
  end
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.5.2
4
+ version: 2.5.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-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic