metanorma-iec 2.5.3 → 2.5.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: 8e601a61dd0a3359b2038225f9fb50dacfb48d0a26b9f2f16337810f893d2553
4
- data.tar.gz: 718a96b97e8bf3ed54ef8d3c9b64569c77fca701d412fef1a1534629e16d4cac
3
+ metadata.gz: f918d2d4de755bfda4e2a14f98d9b99204aa777ed615c517ea873176593b810a
4
+ data.tar.gz: 8520e503f38b00d06ac8ad6758e79104e80350b1ee2b1282fcedfc521e729b92
5
5
  SHA512:
6
- metadata.gz: 41d137d1d2de28c1cbca08ee2ffc683e3e3ea87d7ff9ca81c0ab270206bf8e309b9bde6a64d40a615f3edecbd57fbd2d89fda105bd5b9d98ce9e5808da281d84
7
- data.tar.gz: dfe35f7ed429283b59142e1f19ff892d2a65908bdb85be257f33cd9c726376dd08e5444dfd66d42518949ade2b057cbd281193e53c85500a807d5aa423a61a64
6
+ metadata.gz: c097a715deb9e05a1c6ca0b9ea5fe80aad4f070c6db5cf5714034d5a6fa9add0287e71fb203498c75fd4e899c250a4774e2dd9408c9558a33a2ab41093f1a043
7
+ data.tar.gz: 2af3c2050c896f922e6a8bca89fc0867981965dcdcb00d7ff0bebf4b6577d62317358394270651355e9286e5a5b2e1614155389be4f4bbfd1af78f59112b0b46
@@ -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; }
@@ -1322,9 +1322,11 @@
1322
1322
  </xsl:template>
1323
1323
 
1324
1324
  <xsl:template match="iec:preface//iec:clause[@type = 'toc']" priority="3">
1325
- <fo:block-container>
1325
+ <fo:block-container role="SKIP">
1326
+ <!-- render 'Contents' outside if role="TOC" -->
1327
+ <xsl:apply-templates select="*[local-name() = 'title']"/>
1326
1328
  <fo:block role="TOC">
1327
- <xsl:apply-templates/>
1329
+ <xsl:apply-templates select="node()[not(local-name() = 'title')]"/>
1328
1330
 
1329
1331
  <xsl:if test="count(*) = 1 and *[local-name() = 'title']"> <!-- if there isn't user ToC -->
1330
1332
  <xsl:variable name="docid">
@@ -1339,7 +1341,7 @@
1339
1341
  </xsl:template>
1340
1342
 
1341
1343
  <xsl:template match="iec:preface//iec:clause[@type = 'toc']/iec:title" priority="3">
1342
- <fo:block font-size="12pt" text-align="center" margin-bottom="22pt" role="H1">
1344
+ <fo:block font-size="12pt" text-align="center" margin-bottom="22pt">
1343
1345
  <xsl:call-template name="addLetterSpacing">
1344
1346
  <xsl:with-param name="text" select="java:toUpperCase(java:java.lang.String.new(.))"/>
1345
1347
  </xsl:call-template>
@@ -5494,6 +5496,7 @@
5494
5496
 
5495
5497
  <fo:block role="SKIP">
5496
5498
  <xsl:apply-templates/>
5499
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5497
5500
  </fo:block>
5498
5501
  </fo:table-cell>
5499
5502
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -5557,6 +5560,8 @@
5557
5560
 
5558
5561
  <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"/> -->
5559
5562
 
5563
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5564
+
5560
5565
  </fo:block>
5561
5566
  </fo:table-cell>
5562
5567
  </xsl:template> <!-- td -->
@@ -8425,14 +8430,16 @@
8425
8430
  <xsl:template match="*[local-name()='link']" name="link">
8426
8431
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
8427
8432
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
8433
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
8428
8434
  <xsl:variable name="target">
8429
8435
  <xsl:choose>
8430
8436
  <xsl:when test="@updatetype = 'true'">
8431
8437
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
8432
8438
  </xsl:when>
8433
8439
  <!-- link to the PDF attachment -->
8434
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
8435
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
8440
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
8441
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
8442
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
8436
8443
  </xsl:when>
8437
8444
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
8438
8445
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -8463,6 +8470,11 @@
8463
8470
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8464
8471
  </xsl:if>
8465
8472
 
8473
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8474
+ <xsl:attribute name="color">inherit</xsl:attribute>
8475
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
8476
+ </xsl:if>
8477
+
8466
8478
  <xsl:call-template name="refine_link-style"/>
8467
8479
 
8468
8480
  <xsl:choose>
@@ -8473,6 +8485,9 @@
8473
8485
  <xsl:call-template name="insert_basic_link">
8474
8486
  <xsl:with-param name="element">
8475
8487
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
8488
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8489
+ <xsl:attribute name="role">Annot</xsl:attribute>
8490
+ </xsl:if>
8476
8491
  <xsl:choose>
8477
8492
  <xsl:when test="normalize-space(.) = ''">
8478
8493
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -8485,6 +8500,10 @@
8485
8500
  </xsl:otherwise>
8486
8501
  </xsl:choose>
8487
8502
  </fo:basic-link>
8503
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
8504
+ <!-- reserve space at right for PaperClip icon -->
8505
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
8506
+ </xsl:if>
8488
8507
  </xsl:with-param>
8489
8508
  </xsl:call-template>
8490
8509
  </xsl:otherwise>
@@ -14021,9 +14040,14 @@
14021
14040
  </x:xmpmeta>
14022
14041
  <!-- add attachments -->
14023
14042
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
14024
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
14025
-
14026
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{@name}">
14043
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
14044
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
14045
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
14046
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
14047
+ <!-- Todo: need update -->
14048
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14049
+
14050
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" filename="{$filename}" link-as-file-annotation="true">
14027
14051
  <xsl:attribute name="src">
14028
14052
  <xsl:choose>
14029
14053
  <xsl:when test="normalize-space() != ''">
@@ -14039,18 +14063,27 @@
14039
14063
  <xsl:if test="$description != ''">
14040
14064
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14041
14065
  </xsl:if>
14066
+ <xsl:if test="$afrelationship != ''">
14067
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14068
+ </xsl:if>
14042
14069
  </pdf:embedded-file>
14043
14070
  </xsl:for-each>
14044
14071
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
14045
14072
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
14046
14073
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
14047
14074
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
14075
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
14048
14076
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
14049
14077
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
14050
- <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_path}">
14078
+ <!-- Todo: need update -->
14079
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
14080
+ <pdf:embedded-file xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf" src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
14051
14081
  <xsl:if test="$description != ''">
14052
14082
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
14053
14083
  </xsl:if>
14084
+ <xsl:if test="$afrelationship != ''">
14085
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
14086
+ </xsl:if>
14054
14087
  </pdf:embedded-file>
14055
14088
  </xsl:for-each>
14056
14089
  </xsl:if>
@@ -14070,6 +14103,12 @@
14070
14103
  <!-- Get or calculate depth of the element -->
14071
14104
  <xsl:template name="getLevel">
14072
14105
  <xsl:param name="depth"/>
14106
+ <!-- <xsl:message>
14107
+ <xsl:choose>
14108
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
14109
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
14110
+ </xsl:choose>
14111
+ </xsl:message> -->
14073
14112
  <xsl:choose>
14074
14113
  <xsl:when test="normalize-space(@depth) != ''">
14075
14114
  <xsl:value-of select="@depth"/>
@@ -14090,8 +14129,27 @@
14090
14129
  <xsl:when test="ancestor::*[local-name() = 'preface']">
14091
14130
  <xsl:value-of select="$level_total - 2"/>
14092
14131
  </xsl:when>
14132
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
14133
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14134
+ <xsl:choose>
14135
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14136
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14137
+ </xsl:when>
14138
+ <xsl:otherwise>
14139
+ <xsl:value-of select="$level_total - 2"/>
14140
+ </xsl:otherwise>
14141
+ </xsl:choose>
14142
+ </xsl:when>
14093
14143
  <xsl:when test="ancestor::*[local-name() = 'sections']">
14094
- <xsl:value-of select="$level_total - 1"/>
14144
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
14145
+ <xsl:choose>
14146
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14147
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14148
+ </xsl:when>
14149
+ <xsl:otherwise>
14150
+ <xsl:value-of select="$level_total - 1"/>
14151
+ </xsl:otherwise>
14152
+ </xsl:choose>
14095
14153
  </xsl:when>
14096
14154
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
14097
14155
  <xsl:value-of select="$level_total - 1"/>
@@ -14099,6 +14157,17 @@
14099
14157
  <xsl:when test="parent::*[local-name() = 'annex']">
14100
14158
  <xsl:value-of select="$level_total - 1"/>
14101
14159
  </xsl:when>
14160
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
14161
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
14162
+ <xsl:choose>
14163
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
14164
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
14165
+ </xsl:when>
14166
+ <xsl:otherwise>
14167
+ <xsl:value-of select="$level_total - 1"/>
14168
+ </xsl:otherwise>
14169
+ </xsl:choose>
14170
+ </xsl:when>
14102
14171
  <xsl:when test="ancestor::*[local-name() = 'annex']">
14103
14172
  <xsl:value-of select="$level_total"/>
14104
14173
  </xsl:when>
@@ -14457,6 +14526,20 @@
14457
14526
 
14458
14527
  <!-- END: insert cover page image -->
14459
14528
 
14529
+ <xsl:template name="insertVerticalChar">
14530
+ <xsl:param name="str"/>
14531
+ <xsl:if test="string-length($str) &gt; 0">
14532
+ <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">
14533
+ <fo:block-container width="1em">
14534
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14535
+ </fo:block-container>
14536
+ </fo:inline-container>
14537
+ <xsl:call-template name="insertVerticalChar">
14538
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14539
+ </xsl:call-template>
14540
+ </xsl:if>
14541
+ </xsl:template>
14542
+
14460
14543
  <xsl:template name="number-to-words">
14461
14544
  <xsl:param name="number"/>
14462
14545
  <xsl:param name="first"/>
@@ -14744,4 +14827,18 @@
14744
14827
  </xsl:if>
14745
14828
  </xsl:template>
14746
14829
 
14830
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14831
+ <xsl:copy>
14832
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14833
+ </xsl:copy>
14834
+ </xsl:template>
14835
+
14836
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14837
+ <xsl:copy>
14838
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14839
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14840
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14841
+ </xsl:copy>
14842
+ </xsl:template>
14843
+
14747
14844
  </xsl:stylesheet>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.5.3".freeze
3
+ VERSION = "2.5.4".freeze
4
4
  end
5
5
  end
6
6
 
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.5.3
4
+ version: 2.5.4
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-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-iso