metanorma-plateau 0.1.6 → 0.1.7

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: 994c9fb200d2e1cffe7ea418f5c6129233ae0319898f161e0b4387cda7b62606
4
- data.tar.gz: 1cf4aa824bda63e7905f0a77fc1c5a684791232453f82da45aadbb0eee061094
3
+ metadata.gz: 2a8305a8257b5394f752d00acac7528bef4f3c705d3d48de912a3b7e0e56fc6b
4
+ data.tar.gz: 86a26d997e46cb1df2a6507393a41053e5b97f35f123f2dc88fb6f1c01605298
5
5
  SHA512:
6
- metadata.gz: 6cf30287643b8d49fd4c1412b7a4b0381d81bb5f6210875916f6fcccd2a7edfc2fb3764f26eb374d5d8d1bd8a64d7f5fc2bb3735308b0242cc3a9ecccb93eae4
7
- data.tar.gz: 7d5fe6507a675e5cf1fd8cc9d4c36cbd767e407d28b3fc0840963dbdf9198581df95bf2c0903d7115f1233c98a99aa6eef67e9e5e9106ed50790ff95708fd92f
6
+ metadata.gz: ebd2eba5567af8905624373946856776907927f4268a5c9b76cc9c30db7eed2fc522975e871b08c2fd0e0d66f10059178782025efa39b2bc32da9edbbfd98896
7
+ data.tar.gz: 4e7f84a4f116a3cc4b4b6fbfb64d11b1b147b56afe7a79d557de1e28d0fc3ef208338c974abc4b11761592a6aeb9d13b4da15db18fabb5ee4c3c3f57e8d07128
@@ -15,6 +15,7 @@
15
15
  <xsl:variable name="i18n_table_of_contents"><xsl:call-template name="getLocalizedString"><xsl:with-param name="key">table_of_contents</xsl:with-param></xsl:call-template></xsl:variable>
16
16
 
17
17
  <xsl:variable name="vertical_layout" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout)"/>
18
+ <xsl:variable name="vertical_layout_rotate_clause_numbers" select="normalize-space(/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:vertical-layout-rotate-clause-numbers)"/>
18
19
 
19
20
  <xsl:variable name="page_header">
20
21
  <xsl:value-of select="/*/plateau:metanorma-extension/plateau:presentation-metadata/plateau:use-case"/>
@@ -500,12 +501,22 @@
500
501
  <xsl:choose>
501
502
  <xsl:when test="$doctype = 'technical-report'">
502
503
  <fo:block space-after="5pt">
504
+ <xsl:variable name="margin-left">
505
+ <xsl:choose>
506
+ <xsl:when test="@level = 1">1</xsl:when>
507
+ <xsl:when test="@level = 2">3.5</xsl:when>
508
+ <xsl:when test="@level = 3">7</xsl:when>
509
+ <xsl:otherwise>10</xsl:otherwise>
510
+ </xsl:choose>
511
+ </xsl:variable>
503
512
  <xsl:attribute name="margin-left">
504
513
  <xsl:choose>
505
- <xsl:when test="@level = 1">1mm</xsl:when>
506
- <xsl:when test="@level = 2">3.5mm</xsl:when>
507
- <xsl:when test="@level = 3">7mm</xsl:when>
508
- <xsl:otherwise>10mm</xsl:otherwise>
514
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
515
+ <xsl:value-of select="concat($margin-left * 1.5, 'mm')"/>
516
+ </xsl:when>
517
+ <xsl:otherwise>
518
+ <xsl:value-of select="concat($margin-left, 'mm')"/>
519
+ </xsl:otherwise>
509
520
  </xsl:choose>
510
521
  </xsl:attribute>
511
522
  <xsl:call-template name="insertTocItem">
@@ -523,18 +534,38 @@
523
534
  <xsl:otherwise>
524
535
  <xsl:variable name="margin_left" select="number(@level - 1) * 3"/>
525
536
  <fo:list-block space-after="2pt" margin-left="{$margin_left}mm">
537
+ <xsl:variable name="provisional-distance-between-starts">
538
+ <xsl:choose>
539
+ <xsl:when test="@level = 1">7</xsl:when>
540
+ <xsl:when test="@level = 2">10</xsl:when>
541
+ <xsl:when test="@level = 3">14</xsl:when>
542
+ <xsl:otherwise>14</xsl:otherwise>
543
+ </xsl:choose>
544
+ </xsl:variable>
545
+
526
546
  <xsl:attribute name="provisional-distance-between-starts">
527
547
  <xsl:choose>
528
- <xsl:when test="@level = 1">7mm</xsl:when>
529
- <xsl:when test="@level = 2">10mm</xsl:when>
530
- <xsl:when test="@level = 3">14mm</xsl:when>
531
- <xsl:otherwise>14mm</xsl:otherwise>
548
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
549
+ <xsl:value-of select="concat($provisional-distance-between-starts * 1.5, 'mm')"/>
550
+ </xsl:when>
551
+ <xsl:otherwise>
552
+ <xsl:value-of select="concat($provisional-distance-between-starts, 'mm')"/>
553
+ </xsl:otherwise>
532
554
  </xsl:choose>
533
555
  </xsl:attribute>
534
556
  <fo:list-item>
535
557
  <fo:list-item-label end-indent="label-end()">
536
558
  <fo:block>
537
- <xsl:value-of select="@section"/>
559
+ <xsl:choose>
560
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
561
+ <xsl:call-template name="insertVerticalChar">
562
+ <xsl:with-param name="str" select="@section"/>
563
+ </xsl:call-template>
564
+ </xsl:when>
565
+ <xsl:otherwise>
566
+ <xsl:value-of select="@section"/>
567
+ </xsl:otherwise>
568
+ </xsl:choose>
538
569
  </fo:block>
539
570
  </fo:list-item-label>
540
571
  <fo:list-item-body start-indent="body-start()">
@@ -1024,10 +1055,20 @@
1024
1055
  <xsl:call-template name="extractSection"/>
1025
1056
  </xsl:variable>
1026
1057
  <xsl:if test="normalize-space($section) != ''">
1027
- <fo:inline> <!-- font-family="Noto Sans Condensed" font-weight="bold" -->
1028
- <xsl:value-of select="$section"/>
1029
- <fo:inline padding-right="4mm"> </fo:inline>
1030
- </fo:inline>
1058
+ <xsl:choose>
1059
+ <xsl:when test="$vertical_layout_rotate_clause_numbers = 'true'">
1060
+ <xsl:call-template name="insertVerticalChar">
1061
+ <xsl:with-param name="str" select="$section"/>
1062
+ </xsl:call-template>
1063
+ <fo:inline padding-right="4mm"> </fo:inline>
1064
+ </xsl:when>
1065
+ <xsl:otherwise>
1066
+ <fo:inline> <!-- font-family="Noto Sans Condensed" font-weight="bold" -->
1067
+ <xsl:value-of select="$section"/>
1068
+ <fo:inline padding-right="4mm"> </fo:inline>
1069
+ </fo:inline>
1070
+ </xsl:otherwise>
1071
+ </xsl:choose>
1031
1072
  </xsl:if>
1032
1073
 
1033
1074
  <xsl:call-template name="extractTitle"/>
@@ -1679,12 +1720,24 @@
1679
1720
  <xsl:choose>
1680
1721
  <xsl:when test="$doctype = 'technical-report'">
1681
1722
  <fo:block-container height="23mm" display-align="after">
1682
- <fo:block text-align="center" margin-bottom="16mm">- <fo:page-number/> -</fo:block>
1723
+ <fo:block text-align="center" margin-bottom="16mm">
1724
+ <xsl:if test="$vertical_layout = 'true'">
1725
+ <xsl:attribute name="margin-bottom">0mm</xsl:attribute>
1726
+ </xsl:if>
1727
+ <xsl:text>- </xsl:text>
1728
+ <fo:page-number/>
1729
+ <xsl:text> -</xsl:text>
1730
+ </fo:block>
1683
1731
  </fo:block-container>
1684
1732
  </xsl:when>
1685
1733
  <xsl:otherwise>
1686
1734
  <fo:block-container height="24mm" display-align="after">
1687
- <fo:block text-align="center" margin-bottom="16mm"><fo:page-number/></fo:block>
1735
+ <fo:block text-align="center" margin-bottom="16mm">
1736
+ <xsl:if test="$vertical_layout = 'true'">
1737
+ <xsl:attribute name="margin-bottom">0mm</xsl:attribute>
1738
+ </xsl:if>
1739
+ <fo:page-number/>
1740
+ </fo:block>
1688
1741
  </fo:block-container>
1689
1742
  </xsl:otherwise>
1690
1743
  </xsl:choose>
@@ -4973,6 +5026,7 @@
4973
5026
 
4974
5027
  <fo:block role="SKIP">
4975
5028
  <xsl:apply-templates/>
5029
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
4976
5030
  </fo:block>
4977
5031
  </fo:table-cell>
4978
5032
  </xsl:template> <!-- cell in table header row - 'th' -->
@@ -5036,6 +5090,8 @@
5036
5090
 
5037
5091
  <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"/> -->
5038
5092
 
5093
+ <xsl:if test="$isGenerateTableIF = 'false' and count(node()) = 0"> </xsl:if>
5094
+
5039
5095
  </fo:block>
5040
5096
  </fo:table-cell>
5041
5097
  </xsl:template> <!-- td -->
@@ -7825,14 +7881,16 @@
7825
7881
  <xsl:template match="*[local-name()='link']" name="link">
7826
7882
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7827
7883
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7884
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7828
7885
  <xsl:variable name="target">
7829
7886
  <xsl:choose>
7830
7887
  <xsl:when test="@updatetype = 'true'">
7831
7888
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7832
7889
  </xsl:when>
7833
7890
  <!-- link to the PDF attachment -->
7834
- <xsl:when test="@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target]">
7835
- <xsl:value-of select="concat('url(embedded-file:', @target, ')')"/>
7891
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7892
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7893
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7836
7894
  </xsl:when>
7837
7895
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7838
7896
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7863,6 +7921,11 @@
7863
7921
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7864
7922
  </xsl:if>
7865
7923
 
7924
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7925
+ <xsl:attribute name="color">inherit</xsl:attribute>
7926
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7927
+ </xsl:if>
7928
+
7866
7929
  <xsl:call-template name="refine_link-style"/>
7867
7930
 
7868
7931
  <xsl:choose>
@@ -7873,6 +7936,9 @@
7873
7936
  <xsl:call-template name="insert_basic_link">
7874
7937
  <xsl:with-param name="element">
7875
7938
  <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7939
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7940
+ <xsl:attribute name="role">Annot</xsl:attribute>
7941
+ </xsl:if>
7876
7942
  <xsl:choose>
7877
7943
  <xsl:when test="normalize-space(.) = ''">
7878
7944
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7885,6 +7951,10 @@
7885
7951
  </xsl:otherwise>
7886
7952
  </xsl:choose>
7887
7953
  </fo:basic-link>
7954
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7955
+ <!-- reserve space at right for PaperClip icon -->
7956
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7957
+ </xsl:if>
7888
7958
  </xsl:with-param>
7889
7959
  </xsl:call-template>
7890
7960
  </xsl:otherwise>
@@ -13501,9 +13571,14 @@
13501
13571
  </x:xmpmeta>
13502
13572
  <!-- add attachments -->
13503
13573
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13504
- <xsl:variable name="description" select="normalize-space(//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]/*[local-name() = 'formattedref'])"/>
13505
-
13506
- <pdf:embedded-file filename="{@name}">
13574
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13575
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13576
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13577
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13578
+ <!-- Todo: need update -->
13579
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13580
+
13581
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13507
13582
  <xsl:attribute name="src">
13508
13583
  <xsl:choose>
13509
13584
  <xsl:when test="normalize-space() != ''">
@@ -13519,18 +13594,27 @@
13519
13594
  <xsl:if test="$description != ''">
13520
13595
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13521
13596
  </xsl:if>
13597
+ <xsl:if test="$afrelationship != ''">
13598
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13599
+ </xsl:if>
13522
13600
  </pdf:embedded-file>
13523
13601
  </xsl:for-each>
13524
13602
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13525
13603
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13526
13604
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13527
13605
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13606
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13528
13607
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13529
13608
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13530
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13609
+ <!-- Todo: need update -->
13610
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13611
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13531
13612
  <xsl:if test="$description != ''">
13532
13613
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13533
13614
  </xsl:if>
13615
+ <xsl:if test="$afrelationship != ''">
13616
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13617
+ </xsl:if>
13534
13618
  </pdf:embedded-file>
13535
13619
  </xsl:for-each>
13536
13620
  </xsl:if>
@@ -13550,6 +13634,12 @@
13550
13634
  <!-- Get or calculate depth of the element -->
13551
13635
  <xsl:template name="getLevel">
13552
13636
  <xsl:param name="depth"/>
13637
+ <!-- <xsl:message>
13638
+ <xsl:choose>
13639
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13640
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13641
+ </xsl:choose>
13642
+ </xsl:message> -->
13553
13643
  <xsl:choose>
13554
13644
  <xsl:when test="normalize-space(@depth) != ''">
13555
13645
  <xsl:value-of select="@depth"/>
@@ -13570,8 +13660,27 @@
13570
13660
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13571
13661
  <xsl:value-of select="$level_total - 2"/>
13572
13662
  </xsl:when>
13663
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13664
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13665
+ <xsl:choose>
13666
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13667
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13668
+ </xsl:when>
13669
+ <xsl:otherwise>
13670
+ <xsl:value-of select="$level_total - 2"/>
13671
+ </xsl:otherwise>
13672
+ </xsl:choose>
13673
+ </xsl:when>
13573
13674
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13574
- <xsl:value-of select="$level_total - 1"/>
13675
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13676
+ <xsl:choose>
13677
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13678
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13679
+ </xsl:when>
13680
+ <xsl:otherwise>
13681
+ <xsl:value-of select="$level_total - 1"/>
13682
+ </xsl:otherwise>
13683
+ </xsl:choose>
13575
13684
  </xsl:when>
13576
13685
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13577
13686
  <xsl:value-of select="$level_total - 1"/>
@@ -13579,6 +13688,17 @@
13579
13688
  <xsl:when test="parent::*[local-name() = 'annex']">
13580
13689
  <xsl:value-of select="$level_total - 1"/>
13581
13690
  </xsl:when>
13691
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13692
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13693
+ <xsl:choose>
13694
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13695
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13696
+ </xsl:when>
13697
+ <xsl:otherwise>
13698
+ <xsl:value-of select="$level_total - 1"/>
13699
+ </xsl:otherwise>
13700
+ </xsl:choose>
13701
+ </xsl:when>
13582
13702
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13583
13703
  <xsl:value-of select="$level_total"/>
13584
13704
  </xsl:when>
@@ -13935,6 +14055,20 @@
13935
14055
 
13936
14056
  <!-- END: insert cover page image -->
13937
14057
 
14058
+ <xsl:template name="insertVerticalChar">
14059
+ <xsl:param name="str"/>
14060
+ <xsl:if test="string-length($str) &gt; 0">
14061
+ <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">
14062
+ <fo:block-container width="1em">
14063
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14064
+ </fo:block-container>
14065
+ </fo:inline-container>
14066
+ <xsl:call-template name="insertVerticalChar">
14067
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14068
+ </xsl:call-template>
14069
+ </xsl:if>
14070
+ </xsl:template>
14071
+
13938
14072
  <xsl:template name="number-to-words">
13939
14073
  <xsl:param name="number"/>
13940
14074
  <xsl:param name="first"/>
@@ -14222,4 +14356,18 @@
14222
14356
  </xsl:if>
14223
14357
  </xsl:template>
14224
14358
 
14359
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14360
+ <xsl:copy>
14361
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14362
+ </xsl:copy>
14363
+ </xsl:template>
14364
+
14365
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14366
+ <xsl:copy>
14367
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14368
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14369
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14370
+ </xsl:copy>
14371
+ </xsl:template>
14372
+
14225
14373
  </xsl:stylesheet>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- VERSION = "0.1.6".freeze
3
+ VERSION = "0.1.7".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-plateau
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
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-jis