metanorma-plateau 0.1.6 → 0.1.8

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: 10c7b63bef90ba83fc5fd3313f8e34f1fed8b7df4b0446cc1c6e704512280059
4
+ data.tar.gz: 7a10a1ffa2e99a91067fb30c365eb8cb905999346befc7dbaf58f02137784d38
5
5
  SHA512:
6
- metadata.gz: 6cf30287643b8d49fd4c1412b7a4b0381d81bb5f6210875916f6fcccd2a7edfc2fb3764f26eb374d5d8d1bd8a64d7f5fc2bb3735308b0242cc3a9ecccb93eae4
7
- data.tar.gz: 7d5fe6507a675e5cf1fd8cc9d4c36cbd767e407d28b3fc0840963dbdf9198581df95bf2c0903d7115f1233c98a99aa6eef67e9e5e9106ed50790ff95708fd92f
6
+ metadata.gz: 880958057850f42dd2af7cc25bf7a5f791be0e22925cf7745c768c61bb2cfad3a26f3c69a69f6b10202756f0b9bc72b47da5c3bbc952ca07ebcfe59017101996
7
+ data.tar.gz: 28f184250ae4aaf41a82d0db807b571e041400216993af0c34792a88ef9d6903e209d4ab920c7823266bb854a8ce48b2ad2e865a8623d8d0d8873e31587947f3
@@ -2,7 +2,7 @@ require_relative "base_convert"
2
2
 
3
3
  module IsoDoc
4
4
  module Plateau
5
- class HtmlConvert < IsoDoc::JIS::HtmlConvert
5
+ class HtmlConvert < IsoDoc::Jis::HtmlConvert
6
6
  def initialize(options)
7
7
  super
8
8
  @libdir = File.dirname(__FILE__)
@@ -3,7 +3,7 @@ require "twitter_cldr"
3
3
 
4
4
  module IsoDoc
5
5
  module Plateau
6
- class I18n < IsoDoc::JIS::I18n
6
+ class I18n < IsoDoc::Jis::I18n
7
7
  def load_file(fname)
8
8
  f = File.join(File.dirname(__FILE__), fname)
9
9
  File.exist?(f) ? YAML.load_file(f) : {}
@@ -22,7 +22,7 @@ module IsoDoc
22
22
  end
23
23
 
24
24
  def bibrenderer(options = {})
25
- ::Relaton::Render::JIS::General.new(options.merge(language: @lang,
25
+ ::Relaton::Render::Jis::General.new(options.merge(language: @lang,
26
26
  i18nhash: @i18n.get))
27
27
  end
28
28
  end
@@ -1,6 +1,6 @@
1
1
  module IsoDoc
2
2
  module Plateau
3
- class Metadata < IsoDoc::JIS::Metadata
3
+ class Metadata < IsoDoc::Jis::Metadata
4
4
  def docid(xml, _out)
5
5
  id = xml.at(ns("//bibdata/docidentifier[@type = 'PLATEAU']"))&.text or
6
6
  return
@@ -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 -->
@@ -5107,7 +5163,8 @@
5107
5163
  </xsl:choose>
5108
5164
  </xsl:variable>
5109
5165
  <xsl:variable name="current_fn_number_text">
5110
- <xsl:value-of select="$current_fn_number"/>
5166
+
5167
+ <xsl:value-of select="$current_fn_number"/>
5111
5168
 
5112
5169
  </xsl:variable>
5113
5170
 
@@ -5143,8 +5200,10 @@
5143
5200
 
5144
5201
  <xsl:call-template name="insert_basic_link">
5145
5202
  <xsl:with-param name="element">
5146
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5147
- <xsl:copy-of select="$current_fn_number_text"/>
5203
+ <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}"> <!-- note: role="Lbl" removed in https://github.com/metanorma/mn2pdf/issues/291 -->
5204
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5205
+ <xsl:copy-of select="$current_fn_number_text"/>
5206
+ </fo:inline>
5148
5207
  </fo:basic-link>
5149
5208
  </xsl:with-param>
5150
5209
  </xsl:call-template>
@@ -5429,7 +5488,7 @@
5429
5488
 
5430
5489
  <xsl:call-template name="refine_fn-reference-style"/>
5431
5490
 
5432
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5491
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5433
5492
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5434
5493
  <xsl:attribute name="internal-destination">
5435
5494
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6429,9 +6488,19 @@
6429
6488
  </fo:inline>
6430
6489
  </xsl:template>
6431
6490
 
6432
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6491
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6492
+ <xsl:param name="txt"/>
6433
6493
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6434
- <xsl:variable name="text" select="."/>
6494
+ <xsl:variable name="text">
6495
+ <xsl:choose>
6496
+ <xsl:when test="$txt != ''">
6497
+ <xsl:value-of select="$txt"/>
6498
+ </xsl:when>
6499
+ <xsl:otherwise>
6500
+ <xsl:value-of select="."/>
6501
+ </xsl:otherwise>
6502
+ </xsl:choose>
6503
+ </xsl:variable>
6435
6504
  <xsl:variable name="ratio_">
6436
6505
  0.75
6437
6506
  </xsl:variable>
@@ -7825,14 +7894,16 @@
7825
7894
  <xsl:template match="*[local-name()='link']" name="link">
7826
7895
  <xsl:variable name="target_normalized" select="translate(@target, '\', '/')"/>
7827
7896
  <xsl:variable name="target_attachment_name" select="substring-after($target_normalized, '_attachments/')"/>
7897
+ <xsl:variable name="isLinkToEmbeddedFile" select="normalize-space(@attachment = 'true' and $pdfAttachmentsList//attachment[@filename = current()/@target])"/>
7828
7898
  <xsl:variable name="target">
7829
7899
  <xsl:choose>
7830
7900
  <xsl:when test="@updatetype = 'true'">
7831
7901
  <xsl:value-of select="concat(normalize-space(@target), '.pdf')"/>
7832
7902
  </xsl:when>
7833
7903
  <!-- 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, ')')"/>
7904
+ <xsl:when test="$isLinkToEmbeddedFile = 'true'">
7905
+ <xsl:variable name="target_file" select="java:org.metanorma.fop.Util.getFilenameFromPath(@target)"/>
7906
+ <xsl:value-of select="concat('url(embedded-file:', $target_file, ')')"/>
7836
7907
  </xsl:when>
7837
7908
  <!-- <xsl:when test="starts-with($target_normalized, '_') and contains($target_normalized, '_attachments/') and $pdfAttachmentsList//attachment[@filename = $target_attachment_name]">
7838
7909
  <xsl:value-of select="concat('url(embedded-file:', $target_attachment_name, ')')"/>
@@ -7863,6 +7934,11 @@
7863
7934
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7864
7935
  </xsl:if>
7865
7936
 
7937
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7938
+ <xsl:attribute name="color">inherit</xsl:attribute>
7939
+ <xsl:attribute name="text-decoration">none</xsl:attribute>
7940
+ </xsl:if>
7941
+
7866
7942
  <xsl:call-template name="refine_link-style"/>
7867
7943
 
7868
7944
  <xsl:choose>
@@ -7870,9 +7946,15 @@
7870
7946
  <xsl:apply-templates/>
7871
7947
  </xsl:when>
7872
7948
  <xsl:otherwise>
7949
+ <xsl:variable name="alt_text">
7950
+ <xsl:call-template name="getAltText"/>
7951
+ </xsl:variable>
7873
7952
  <xsl:call-template name="insert_basic_link">
7874
7953
  <xsl:with-param name="element">
7875
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7954
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
7955
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7956
+ <xsl:attribute name="role">Annot</xsl:attribute>
7957
+ </xsl:if>
7876
7958
  <xsl:choose>
7877
7959
  <xsl:when test="normalize-space(.) = ''">
7878
7960
  <xsl:call-template name="add-zero-spaces-link-java">
@@ -7885,6 +7967,10 @@
7885
7967
  </xsl:otherwise>
7886
7968
  </xsl:choose>
7887
7969
  </fo:basic-link>
7970
+ <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7971
+ <!-- reserve space at right for PaperClip icon -->
7972
+ <fo:inline keep-with-previous.within-line="always">        </fo:inline>
7973
+ </xsl:if>
7888
7974
  </xsl:with-param>
7889
7975
  </xsl:call-template>
7890
7976
  </xsl:otherwise>
@@ -7892,6 +7978,14 @@
7892
7978
  </fo:inline>
7893
7979
  </xsl:template> <!-- link -->
7894
7980
 
7981
+ <xsl:template name="getAltText">
7982
+ <xsl:choose>
7983
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
7984
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
7985
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
7986
+ </xsl:choose>
7987
+ </xsl:template>
7988
+
7895
7989
  <!-- ======================== -->
7896
7990
  <!-- Appendix processing -->
7897
7991
  <!-- ======================== -->
@@ -7922,7 +8016,7 @@
7922
8016
  <xsl:template match="*[local-name() = 'callout']">
7923
8017
  <xsl:choose>
7924
8018
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
7925
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8019
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
7926
8020
  </xsl:choose>
7927
8021
  </xsl:template>
7928
8022
 
@@ -7951,7 +8045,10 @@
7951
8045
  <xsl:template match="*[local-name() = 'xref']">
7952
8046
  <xsl:call-template name="insert_basic_link">
7953
8047
  <xsl:with-param name="element">
7954
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8048
+ <xsl:variable name="alt_text">
8049
+ <xsl:call-template name="getAltText"/>
8050
+ </xsl:variable>
8051
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
7955
8052
  <xsl:if test="string-length(normalize-space()) &lt; 30 and not(contains(normalize-space(), 'http://')) and not(contains(normalize-space(), 'https://')) and not(ancestor::*[local-name() = 'table' or local-name() = 'dl'])">
7956
8053
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
7957
8054
  </xsl:if>
@@ -10429,12 +10526,14 @@
10429
10526
 
10430
10527
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
10431
10528
 
10432
- <xsl:variable name="provisional_distance_between_starts">
10529
+ <xsl:variable name="provisional_distance_between_starts_">
10433
10530
  7
10434
10531
  </xsl:variable>
10435
- <xsl:variable name="indent">
10532
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10533
+ <xsl:variable name="indent_">
10436
10534
  0
10437
10535
  </xsl:variable>
10536
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10438
10537
 
10439
10538
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10440
10539
  <fo:list-item>
@@ -11156,14 +11255,17 @@
11156
11255
  </xsl:when>
11157
11256
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11158
11257
 
11159
- <xsl:variable name="label">
11258
+ <xsl:variable name="type" select="../@type"/>
11160
11259
 
11161
- <xsl:variable name="type" select="../@type"/>
11260
+ <xsl:variable name="label">
11162
11261
 
11163
11262
  <xsl:variable name="style_prefix_">
11164
11263
  <xsl:if test="$type = 'roman'">
11165
11264
  <!-- Example: (i) -->
11166
11265
  </xsl:if>
11266
+ <xsl:if test="$type = 'alphabet'">
11267
+
11268
+ </xsl:if>
11167
11269
  </xsl:variable>
11168
11270
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11169
11271
 
@@ -11189,13 +11291,15 @@
11189
11291
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11190
11292
  <xsl:value-of select="$style_prefix"/>
11191
11293
  </xsl:if>
11294
+
11192
11295
  <xsl:value-of select="@label"/>
11296
+
11193
11297
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11194
11298
  <xsl:value-of select="$style_suffix"/>
11195
11299
  </xsl:if>
11196
11300
  </xsl:variable>
11197
11301
 
11198
- <xsl:value-of select="normalize-space($label)"/>
11302
+ <xsl:value-of select="normalize-space($label)"/>
11199
11303
 
11200
11304
  </xsl:when>
11201
11305
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -13501,9 +13605,15 @@
13501
13605
  </x:xmpmeta>
13502
13606
  <!-- add attachments -->
13503
13607
  <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}">
13608
+ <xsl:variable name="bibitem_attachment_" select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment'] = current()/@name]"/>
13609
+ <xsl:variable name="bibitem_attachment" select="xalan:nodeset($bibitem_attachment_)"/>
13610
+ <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13611
+ <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13612
+ <!-- Todo: need update -->
13613
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13614
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13615
+
13616
+ <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13507
13617
  <xsl:attribute name="src">
13508
13618
  <xsl:choose>
13509
13619
  <xsl:when test="normalize-space() != ''">
@@ -13519,18 +13629,34 @@
13519
13629
  <xsl:if test="$description != ''">
13520
13630
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13521
13631
  </xsl:if>
13632
+ <xsl:if test="$afrelationship != ''">
13633
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13634
+ </xsl:if>
13635
+ <xsl:if test="$volatile != ''">
13636
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13637
+ </xsl:if>
13522
13638
  </pdf:embedded-file>
13523
13639
  </xsl:for-each>
13524
13640
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
13525
13641
  <xsl:if test="not(//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment'])">
13526
13642
  <xsl:for-each select="//*[local-name() = 'bibitem'][@hidden = 'true'][*[local-name() = 'uri'][@type = 'attachment']]">
13527
13643
  <xsl:variable name="attachment_path" select="*[local-name() = 'uri'][@type = 'attachment']"/>
13644
+ <xsl:variable name="attachment_name" select="java:org.metanorma.fop.Util.getFilenameFromPath($attachment_path)"/>
13528
13645
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13529
13646
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13530
- <pdf:embedded-file src="{$url}" filename="{$attachment_path}">
13647
+ <!-- Todo: need update -->
13648
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13649
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13650
+ <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13531
13651
  <xsl:if test="$description != ''">
13532
13652
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13533
13653
  </xsl:if>
13654
+ <xsl:if test="$afrelationship != ''">
13655
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13656
+ </xsl:if>
13657
+ <xsl:if test="$volatile != ''">
13658
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13659
+ </xsl:if>
13534
13660
  </pdf:embedded-file>
13535
13661
  </xsl:for-each>
13536
13662
  </xsl:if>
@@ -13550,6 +13676,12 @@
13550
13676
  <!-- Get or calculate depth of the element -->
13551
13677
  <xsl:template name="getLevel">
13552
13678
  <xsl:param name="depth"/>
13679
+ <!-- <xsl:message>
13680
+ <xsl:choose>
13681
+ <xsl:when test="local-name() = 'title'">title=<xsl:value-of select="."/></xsl:when>
13682
+ <xsl:when test="local-name() = 'clause'">clause/title=<xsl:value-of select="*[local-name() = 'title']"/></xsl:when>
13683
+ </xsl:choose>
13684
+ </xsl:message> -->
13553
13685
  <xsl:choose>
13554
13686
  <xsl:when test="normalize-space(@depth) != ''">
13555
13687
  <xsl:value-of select="@depth"/>
@@ -13570,8 +13702,48 @@
13570
13702
  <xsl:when test="ancestor::*[local-name() = 'preface']">
13571
13703
  <xsl:value-of select="$level_total - 2"/>
13572
13704
  </xsl:when>
13705
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'title']">
13706
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
13707
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
13708
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
13709
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
13710
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
13711
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
13712
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
13713
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
13714
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
13715
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
13716
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
13717
+ <xsl:choose>
13718
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
13719
+ <xsl:value-of select="number($curr_clause_depth)"/>
13720
+ </xsl:when>
13721
+ <xsl:otherwise>
13722
+ <xsl:value-of select="$level_total - 2"/>
13723
+ </xsl:otherwise>
13724
+ </xsl:choose>
13725
+ </xsl:when>
13726
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
13727
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13728
+ <xsl:choose>
13729
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
13730
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
13731
+ </xsl:when>
13732
+ <xsl:otherwise>
13733
+ <xsl:value-of select="$level_total - 2"/>
13734
+ </xsl:otherwise>
13735
+ </xsl:choose>
13736
+ </xsl:when>
13573
13737
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13574
- <xsl:value-of select="$level_total - 1"/>
13738
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13739
+ <xsl:choose>
13740
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13741
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13742
+ </xsl:when>
13743
+ <xsl:otherwise>
13744
+ <xsl:value-of select="$level_total - 1"/>
13745
+ </xsl:otherwise>
13746
+ </xsl:choose>
13575
13747
  </xsl:when>
13576
13748
  <xsl:when test="ancestor::*[local-name() = 'bibliography']">
13577
13749
  <xsl:value-of select="$level_total - 1"/>
@@ -13579,6 +13751,17 @@
13579
13751
  <xsl:when test="parent::*[local-name() = 'annex']">
13580
13752
  <xsl:value-of select="$level_total - 1"/>
13581
13753
  </xsl:when>
13754
+ <xsl:when test="ancestor::*[local-name() = 'annex'] and self::*[local-name() = 'title']">
13755
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/>
13756
+ <xsl:choose>
13757
+ <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13758
+ <xsl:value-of select="number($upper_clause_depth + 1)"/>
13759
+ </xsl:when>
13760
+ <xsl:otherwise>
13761
+ <xsl:value-of select="$level_total - 1"/>
13762
+ </xsl:otherwise>
13763
+ </xsl:choose>
13764
+ </xsl:when>
13582
13765
  <xsl:when test="ancestor::*[local-name() = 'annex']">
13583
13766
  <xsl:value-of select="$level_total"/>
13584
13767
  </xsl:when>
@@ -13935,6 +14118,20 @@
13935
14118
 
13936
14119
  <!-- END: insert cover page image -->
13937
14120
 
14121
+ <xsl:template name="insertVerticalChar">
14122
+ <xsl:param name="str"/>
14123
+ <xsl:if test="string-length($str) &gt; 0">
14124
+ <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">
14125
+ <fo:block-container width="1em">
14126
+ <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14127
+ </fo:block-container>
14128
+ </fo:inline-container>
14129
+ <xsl:call-template name="insertVerticalChar">
14130
+ <xsl:with-param name="str" select="substring($str, 2)"/>
14131
+ </xsl:call-template>
14132
+ </xsl:if>
14133
+ </xsl:template>
14134
+
13938
14135
  <xsl:template name="number-to-words">
13939
14136
  <xsl:param name="number"/>
13940
14137
  <xsl:param name="first"/>
@@ -14222,4 +14419,18 @@
14222
14419
  </xsl:if>
14223
14420
  </xsl:template>
14224
14421
 
14422
+ <xsl:template match="@*|node()" mode="set_table_role_skip">
14423
+ <xsl:copy>
14424
+ <xsl:apply-templates select="@*|node()" mode="set_table_role_skip"/>
14425
+ </xsl:copy>
14426
+ </xsl:template>
14427
+
14428
+ <xsl:template match="*[starts-with(local-name(), 'table')]" mode="set_table_role_skip">
14429
+ <xsl:copy>
14430
+ <xsl:apply-templates select="@*" mode="set_table_role_skip"/>
14431
+ <xsl:attribute name="role">SKIP</xsl:attribute>
14432
+ <xsl:apply-templates select="node()" mode="set_table_role_skip"/>
14433
+ </xsl:copy>
14434
+ </xsl:template>
14435
+
14225
14436
  </xsl:stylesheet>
@@ -2,7 +2,7 @@ require_relative "init"
2
2
 
3
3
  module IsoDoc
4
4
  module Plateau
5
- class PresentationXMLConvert < IsoDoc::JIS::PresentationXMLConvert
5
+ class PresentationXMLConvert < IsoDoc::Jis::PresentationXMLConvert
6
6
  def initialize(options)
7
7
  @iso = ::IsoDoc::Iso::PresentationXMLConvert.new(options)
8
8
  super
@@ -3,7 +3,7 @@ module IsoDoc
3
3
  class Counter < IsoDoc::XrefGen::Counter
4
4
  end
5
5
 
6
- class Xref < IsoDoc::JIS::Xref
6
+ class Xref < IsoDoc::Jis::Xref
7
7
  def initialize(lang, script, klass, i18n, options)
8
8
  @iso = ::IsoDoc::Iso::Xref.new(lang, script, klass, i18n, options)
9
9
  super
@@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
72
72
  from other documents in the same doctype</a:documentation>
73
73
  </ref>
74
74
  </optional>
75
+ <ref name="flavor">
76
+ <a:documentation>Flavour of Metanorma used to process this document</a:documentation>
77
+ </ref>
75
78
  <optional>
76
79
  <ref name="editorialgroup">
77
80
  <a:documentation>Groups associated with the production of the standards document, typically within
@@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
113
116
  <define name="DocumentSubtype">
114
117
  <text/>
115
118
  </define>
119
+ <define name="flavor">
120
+ <element name="flavor">
121
+ <ref name="MetanormaFlavor"/>
122
+ </element>
123
+ </define>
124
+ <define name="MetanormaFlavor">
125
+ <a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
126
+ However we prefer not to hardcode it, given ongoing extension.</a:documentation>
127
+ <text/>
128
+ </define>
116
129
  <define name="editorialgroup">
117
130
  <a:documentation>A group associated with the production of the standards document, typically within
118
131
  a standards definition organization</a:documentation>
@@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
1382
1382
  <define name="bdate">
1383
1383
  <a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
1384
1384
  <element name="date">
1385
- <attribute name="type">
1386
- <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1387
- <choice>
1388
- <ref name="BibliographicDateType"/>
1389
- <text/>
1390
- </choice>
1391
- </attribute>
1392
- <optional>
1393
- <attribute name="text">
1394
- <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1395
- </attribute>
1396
- </optional>
1385
+ <ref name="bDateAttributes"/>
1397
1386
  <optional>
1398
1387
  <choice>
1399
1388
  <group>
@@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
1416
1405
  </optional>
1417
1406
  </element>
1418
1407
  </define>
1408
+ <define name="bDateAttributes">
1409
+ <attribute name="type">
1410
+ <a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
1411
+ <choice>
1412
+ <ref name="BibliographicDateType"/>
1413
+ <text/>
1414
+ </choice>
1415
+ </attribute>
1416
+ <optional>
1417
+ <attribute name="text">
1418
+ <a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
1419
+ </attribute>
1420
+ </optional>
1421
+ </define>
1419
1422
  <define name="docidentifier">
1420
1423
  <a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
1421
1424
  <element name="docidentifier">
@@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
1884
1887
  <value>hasAnnotation</value>
1885
1888
  <value>draftOf</value>
1886
1889
  <value>hasDraft</value>
1890
+ <value>preliminaryDraftOf</value>
1891
+ <value>hasPreliminaryDraft</value>
1892
+ <value>revisionDraftOf</value>
1893
+ <value>hasRevisionDraft</value>
1887
1894
  <value>editionOf</value>
1888
1895
  <value>hasEdition</value>
1889
1896
  <value>updates</value>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- class Converter < JIS::Converter
3
+ class Converter < Jis::Converter
4
4
  def bibdata_cleanup(xmldoc)
5
5
  super
6
6
  coverpage_images(xmldoc)
@@ -3,7 +3,7 @@ require_relative "cleanup"
3
3
 
4
4
  module Metanorma
5
5
  module Plateau
6
- class Converter < JIS::Converter
6
+ class Converter < Jis::Converter
7
7
  register_for "plateau"
8
8
 
9
9
  XML_ROOT_TAG = "plateau-standard".freeze
@@ -2,7 +2,7 @@ require "metanorma/processor"
2
2
 
3
3
  module Metanorma
4
4
  module Plateau
5
- class Processor < Metanorma::JIS::Processor
5
+ class Processor < Metanorma::Jis::Processor
6
6
  def initialize # rubocop:disable Lint/MissingSuper
7
7
  @short = :plateau
8
8
  @input_format = :asciidoc
@@ -7,6 +7,7 @@
7
7
  </optional>
8
8
  <ref name="doctype"/>
9
9
  <ref name="editorialgroup"/>
10
+ <ref name="flavor"/>
10
11
  <zeroOrMore>
11
12
  <ref name="ics"/>
12
13
  </zeroOrMore>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- VERSION = "0.1.6".freeze
3
+ VERSION = "0.1.8".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.8
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-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-jis