metanorma-plateau 0.1.7 → 0.1.9

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: 2a8305a8257b5394f752d00acac7528bef4f3c705d3d48de912a3b7e0e56fc6b
4
- data.tar.gz: 86a26d997e46cb1df2a6507393a41053e5b97f35f123f2dc88fb6f1c01605298
3
+ metadata.gz: ab9e5b170ac05003c3091580f6846e16b52599553cc6fbcaa7bc1ab11ebdd37f
4
+ data.tar.gz: 0d53ba47be6206dd65ca377f008e2b6e7a8c062691d70b15e5e7bfc02e476794
5
5
  SHA512:
6
- metadata.gz: ebd2eba5567af8905624373946856776907927f4268a5c9b76cc9c30db7eed2fc522975e871b08c2fd0e0d66f10059178782025efa39b2bc32da9edbbfd98896
7
- data.tar.gz: 4e7f84a4f116a3cc4b4b6fbfb64d11b1b147b56afe7a79d557de1e28d0fc3ef208338c974abc4b11761592a6aeb9d13b4da15db18fabb5ee4c3c3f57e8d07128
6
+ metadata.gz: af32cb85caa4f2ff962894f8c3d93ca4580b008e245715f3905ebc5a4c4cb26348c943438ebe43456aa36c6b23a352c04a9337a14224ce5465d6918f09e9ee48
7
+ data.tar.gz: 664b495f66e07b6e557cb9e47e72d297a164063a512db4b94ae3be3d844e2b27c5ea52f75b96028bc912abcd279ad0d0ec826a3cdd41311662aac0135580b597
@@ -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
@@ -5163,7 +5163,8 @@
5163
5163
  </xsl:choose>
5164
5164
  </xsl:variable>
5165
5165
  <xsl:variable name="current_fn_number_text">
5166
- <xsl:value-of select="$current_fn_number"/>
5166
+
5167
+ <xsl:value-of select="$current_fn_number"/>
5167
5168
 
5168
5169
  </xsl:variable>
5169
5170
 
@@ -5181,10 +5182,14 @@
5181
5182
  <xsl:variable name="fn_styles">
5182
5183
  <xsl:choose>
5183
5184
  <xsl:when test="ancestor::*[local-name() = 'bibitem']">
5184
- <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style"/>
5185
+ <fn_styles xsl:use-attribute-sets="bibitem-note-fn-style">
5186
+
5187
+ </fn_styles>
5185
5188
  </xsl:when>
5186
5189
  <xsl:otherwise>
5187
- <fn_styles xsl:use-attribute-sets="fn-num-style"/>
5190
+ <fn_styles xsl:use-attribute-sets="fn-num-style">
5191
+
5192
+ </fn_styles>
5188
5193
  </xsl:otherwise>
5189
5194
  </xsl:choose>
5190
5195
  </xsl:variable>
@@ -5199,8 +5204,10 @@
5199
5204
 
5200
5205
  <xsl:call-template name="insert_basic_link">
5201
5206
  <xsl:with-param name="element">
5202
- <fo:basic-link internal-destination="{$ref_id}" fox:alt-text="footnote {$current_fn_number}" role="Lbl">
5203
- <xsl:copy-of select="$current_fn_number_text"/>
5207
+ <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 -->
5208
+ <fo:inline role="Lbl"> <!-- need for https://github.com/metanorma/metanorma-iso/issues/1003 -->
5209
+ <xsl:copy-of select="$current_fn_number_text"/>
5210
+ </fo:inline>
5204
5211
  </fo:basic-link>
5205
5212
  </xsl:with-param>
5206
5213
  </xsl:call-template>
@@ -5485,7 +5492,7 @@
5485
5492
 
5486
5493
  <xsl:call-template name="refine_fn-reference-style"/>
5487
5494
 
5488
- <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="{@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5495
+ <fo:basic-link internal-destination="{@reference}_{ancestor::*[@id][1]/@id}" fox:alt-text="footnote {@reference}"> <!-- @reference | ancestor::*[local-name()='clause'][1]/@id-->
5489
5496
  <xsl:if test="ancestor::*[local-name()='table'][1]/@id"> <!-- for footnotes in tables -->
5490
5497
  <xsl:attribute name="internal-destination">
5491
5498
  <xsl:value-of select="concat(@reference, '_', ancestor::*[local-name()='table'][1]/@id)"/>
@@ -6485,9 +6492,19 @@
6485
6492
  </fo:inline>
6486
6493
  </xsl:template>
6487
6494
 
6488
- <xsl:template match="text()[ancestor::*[local-name()='smallcap']]">
6495
+ <xsl:template match="text()[ancestor::*[local-name()='smallcap']]" name="smallcaps">
6496
+ <xsl:param name="txt"/>
6489
6497
  <!-- <xsl:variable name="text" select="normalize-space(.)"/> --> <!-- https://github.com/metanorma/metanorma-iso/issues/1115 -->
6490
- <xsl:variable name="text" select="."/>
6498
+ <xsl:variable name="text">
6499
+ <xsl:choose>
6500
+ <xsl:when test="$txt != ''">
6501
+ <xsl:value-of select="$txt"/>
6502
+ </xsl:when>
6503
+ <xsl:otherwise>
6504
+ <xsl:value-of select="."/>
6505
+ </xsl:otherwise>
6506
+ </xsl:choose>
6507
+ </xsl:variable>
6491
6508
  <xsl:variable name="ratio_">
6492
6509
  0.75
6493
6510
  </xsl:variable>
@@ -7933,9 +7950,12 @@
7933
7950
  <xsl:apply-templates/>
7934
7951
  </xsl:when>
7935
7952
  <xsl:otherwise>
7953
+ <xsl:variable name="alt_text">
7954
+ <xsl:call-template name="getAltText"/>
7955
+ </xsl:variable>
7936
7956
  <xsl:call-template name="insert_basic_link">
7937
7957
  <xsl:with-param name="element">
7938
- <fo:basic-link external-destination="{$target}" fox:alt-text="{$target}">
7958
+ <fo:basic-link external-destination="{$target}" fox:alt-text="{$alt_text}">
7939
7959
  <xsl:if test="$isLinkToEmbeddedFile = 'true'">
7940
7960
  <xsl:attribute name="role">Annot</xsl:attribute>
7941
7961
  </xsl:if>
@@ -7962,6 +7982,14 @@
7962
7982
  </fo:inline>
7963
7983
  </xsl:template> <!-- link -->
7964
7984
 
7985
+ <xsl:template name="getAltText">
7986
+ <xsl:choose>
7987
+ <xsl:when test="normalize-space(.) = ''"><xsl:value-of select="@target"/></xsl:when>
7988
+ <xsl:otherwise><xsl:value-of select="normalize-space(translate(normalize-space(), ' —', ' -'))"/></xsl:otherwise>
7989
+ <!-- <xsl:otherwise><xsl:value-of select="@target"/></xsl:otherwise> -->
7990
+ </xsl:choose>
7991
+ </xsl:template>
7992
+
7965
7993
  <!-- ======================== -->
7966
7994
  <!-- Appendix processing -->
7967
7995
  <!-- ======================== -->
@@ -7992,7 +8020,7 @@
7992
8020
  <xsl:template match="*[local-name() = 'callout']">
7993
8021
  <xsl:choose>
7994
8022
  <xsl:when test="normalize-space(@target) = ''">&lt;<xsl:apply-templates/>&gt;</xsl:when>
7995
- <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
8023
+ <xsl:otherwise><fo:basic-link internal-destination="{@target}" fox:alt-text="{normalize-space()}">&lt;<xsl:apply-templates/>&gt;</fo:basic-link></xsl:otherwise>
7996
8024
  </xsl:choose>
7997
8025
  </xsl:template>
7998
8026
 
@@ -8021,10 +8049,14 @@
8021
8049
  <xsl:template match="*[local-name() = 'xref']">
8022
8050
  <xsl:call-template name="insert_basic_link">
8023
8051
  <xsl:with-param name="element">
8024
- <fo:basic-link internal-destination="{@target}" fox:alt-text="{@target}" xsl:use-attribute-sets="xref-style">
8052
+ <xsl:variable name="alt_text">
8053
+ <xsl:call-template name="getAltText"/>
8054
+ </xsl:variable>
8055
+ <fo:basic-link internal-destination="{@target}" fox:alt-text="{$alt_text}" xsl:use-attribute-sets="xref-style">
8025
8056
  <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'])">
8026
8057
  <xsl:attribute name="keep-together.within-line">always</xsl:attribute>
8027
8058
  </xsl:if>
8059
+
8028
8060
  <xsl:if test="parent::*[local-name() = 'add']">
8029
8061
  <xsl:call-template name="append_add-style"/>
8030
8062
  </xsl:if>
@@ -8133,44 +8165,44 @@
8133
8165
 
8134
8166
  <xsl:template match="*[local-name() = 'note']" name="note">
8135
8167
 
8136
- <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
8168
+ <fo:block-container id="{@id}" xsl:use-attribute-sets="note-style" role="SKIP">
8137
8169
 
8138
- <xsl:call-template name="setBlockSpanAll"/>
8170
+ <xsl:call-template name="setBlockSpanAll"/>
8139
8171
 
8140
- <xsl:call-template name="refine_note-style"/>
8172
+ <xsl:call-template name="refine_note-style"/>
8141
8173
 
8142
- <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
8174
+ <fo:block-container margin-left="0mm" margin-right="0mm" role="SKIP">
8143
8175
 
8144
- <fo:block>
8176
+ <fo:block>
8145
8177
 
8146
- <xsl:call-template name="refine_note_block_style"/>
8178
+ <xsl:call-template name="refine_note_block_style"/>
8147
8179
 
8148
- <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8180
+ <fo:inline xsl:use-attribute-sets="note-name-style" role="SKIP">
8149
8181
 
8150
- <xsl:call-template name="refine_note-name-style"/>
8182
+ <xsl:call-template name="refine_note-name-style"/>
8151
8183
 
8152
- <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8153
- <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
8154
- <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
8155
- <xsl:call-template name="append_add-style"/>
8156
- </xsl:if>
8184
+ <!-- if 'p' contains all text in 'add' first and last elements in first p are 'add' -->
8185
+ <!-- <xsl:if test="*[not(local-name()='name')][1][node()[normalize-space() != ''][1][local-name() = 'add'] and node()[normalize-space() != ''][last()][local-name() = 'add']]"> -->
8186
+ <xsl:if test="*[not(local-name()='name')][1][count(node()[normalize-space() != '']) = 1 and *[local-name() = 'add']]">
8187
+ <xsl:call-template name="append_add-style"/>
8188
+ </xsl:if>
8157
8189
 
8158
- <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
8159
- <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
8160
- <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
8161
- <xsl:with-param name="skip">false</xsl:with-param>
8162
- </xsl:apply-templates>
8163
- </xsl:if>
8190
+ <!-- if note contains only one element and first and last childs are `add` ace-tag, then move start ace-tag before NOTE's name-->
8191
+ <xsl:if test="count(*[not(local-name() = 'name')]) = 1 and *[not(local-name() = 'name')]/node()[last()][local-name() = 'add'][starts-with(text(), $ace_tag)]">
8192
+ <xsl:apply-templates select="*[not(local-name() = 'name')]/node()[1][local-name() = 'add'][starts-with(text(), $ace_tag)]">
8193
+ <xsl:with-param name="skip">false</xsl:with-param>
8194
+ </xsl:apply-templates>
8195
+ </xsl:if>
8164
8196
 
8165
- <xsl:apply-templates select="*[local-name() = 'name']"/>
8197
+ <xsl:apply-templates select="*[local-name() = 'name']"/>
8166
8198
 
8167
- </fo:inline>
8199
+ </fo:inline>
8168
8200
 
8169
- <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8170
- </fo:block>
8201
+ <xsl:apply-templates select="node()[not(local-name() = 'name')]"/>
8202
+ </fo:block>
8171
8203
 
8172
- </fo:block-container>
8173
- </fo:block-container>
8204
+ </fo:block-container>
8205
+ </fo:block-container>
8174
8206
 
8175
8207
  </xsl:template>
8176
8208
 
@@ -10499,12 +10531,14 @@
10499
10531
 
10500
10532
  <xsl:when test="contains(normalize-space($fo_element), 'list')">
10501
10533
 
10502
- <xsl:variable name="provisional_distance_between_starts">
10534
+ <xsl:variable name="provisional_distance_between_starts_">
10503
10535
  7
10504
10536
  </xsl:variable>
10505
- <xsl:variable name="indent">
10537
+ <xsl:variable name="provisional_distance_between_starts" select="normalize-space($provisional_distance_between_starts_)"/>
10538
+ <xsl:variable name="indent_">
10506
10539
  0
10507
10540
  </xsl:variable>
10541
+ <xsl:variable name="indent" select="normalize-space($indent_)"/>
10508
10542
 
10509
10543
  <fo:list-block provisional-distance-between-starts="{$provisional_distance_between_starts}mm">
10510
10544
  <fo:list-item>
@@ -10568,6 +10602,7 @@
10568
10602
  </xsl:when>
10569
10603
  <xsl:when test="contains(normalize-space($fo_element), 'block')">
10570
10604
  <fo:block xsl:use-attribute-sets="example-name-style">
10605
+
10571
10606
  <xsl:apply-templates/>
10572
10607
  </fo:block>
10573
10608
  </xsl:when>
@@ -10583,6 +10618,7 @@
10583
10618
 
10584
10619
  <xsl:template match="*[local-name() = 'table']/*[local-name() = 'example']/*[local-name() = 'name']">
10585
10620
  <fo:inline xsl:use-attribute-sets="example-name-style">
10621
+
10586
10622
  <xsl:apply-templates/>
10587
10623
  </fo:inline>
10588
10624
  </xsl:template>
@@ -10946,12 +10982,14 @@
10946
10982
 
10947
10983
  <xsl:if test="parent::*[local-name() = 'term'] and not(preceding-sibling::*[local-name() = 'preferred'])"> <!-- if first preffered in term, then display term's name -->
10948
10984
  <fo:block xsl:use-attribute-sets="term-name-style" role="SKIP">
10985
+
10949
10986
  <xsl:apply-templates select="ancestor::*[local-name() = 'term'][1]/*[local-name() = 'name']"/>
10950
10987
  </fo:block>
10951
10988
  </xsl:if>
10952
10989
 
10953
10990
  <fo:block xsl:use-attribute-sets="preferred-term-style" role="SKIP">
10954
10991
  <xsl:call-template name="setStyle_preferred"/>
10992
+
10955
10993
  <xsl:apply-templates/>
10956
10994
  </fo:block>
10957
10995
  </fo:block>
@@ -11226,14 +11264,17 @@
11226
11264
  </xsl:when>
11227
11265
  <xsl:when test="local-name(..) = 'ol' and @label"> <!-- for ordered lists 'ol', and if there is @label, for instance label="1.1.2" -->
11228
11266
 
11229
- <xsl:variable name="label">
11267
+ <xsl:variable name="type" select="../@type"/>
11230
11268
 
11231
- <xsl:variable name="type" select="../@type"/>
11269
+ <xsl:variable name="label">
11232
11270
 
11233
11271
  <xsl:variable name="style_prefix_">
11234
11272
  <xsl:if test="$type = 'roman'">
11235
11273
  <!-- Example: (i) -->
11236
11274
  </xsl:if>
11275
+ <xsl:if test="$type = 'alphabet'">
11276
+
11277
+ </xsl:if>
11237
11278
  </xsl:variable>
11238
11279
  <xsl:variable name="style_prefix" select="normalize-space($style_prefix_)"/>
11239
11280
 
@@ -11259,13 +11300,15 @@
11259
11300
  <xsl:if test="$style_prefix != '' and not(starts-with(@label, $style_prefix))">
11260
11301
  <xsl:value-of select="$style_prefix"/>
11261
11302
  </xsl:if>
11303
+
11262
11304
  <xsl:value-of select="@label"/>
11305
+
11263
11306
  <xsl:if test="not(java:endsWith(java:java.lang.String.new(@label),$style_suffix))">
11264
11307
  <xsl:value-of select="$style_suffix"/>
11265
11308
  </xsl:if>
11266
11309
  </xsl:variable>
11267
11310
 
11268
- <xsl:value-of select="normalize-space($label)"/>
11311
+ <xsl:value-of select="normalize-space($label)"/>
11269
11312
 
11270
11313
  </xsl:when>
11271
11314
  <xsl:otherwise> <!-- for ordered lists 'ol' -->
@@ -13576,7 +13619,8 @@
13576
13619
  <xsl:variable name="description" select="normalize-space($bibitem_attachment/*[local-name() = 'formattedref'])"/>
13577
13620
  <xsl:variable name="filename" select="java:org.metanorma.fop.Util.getFilenameFromPath(@name)"/>
13578
13621
  <!-- Todo: need update -->
13579
- <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13622
+ <xsl:variable name="afrelationship" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13623
+ <xsl:variable name="volatile" select="normalize-space($bibitem_attachment//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13580
13624
 
13581
13625
  <pdf:embedded-file filename="{$filename}" link-as-file-annotation="true">
13582
13626
  <xsl:attribute name="src">
@@ -13597,6 +13641,9 @@
13597
13641
  <xsl:if test="$afrelationship != ''">
13598
13642
  <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13599
13643
  </xsl:if>
13644
+ <xsl:if test="$volatile != ''">
13645
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13646
+ </xsl:if>
13600
13647
  </pdf:embedded-file>
13601
13648
  </xsl:for-each>
13602
13649
  <!-- references to external attachments (no binary-encoded within the Metanorma XML file) -->
@@ -13607,14 +13654,18 @@
13607
13654
  <xsl:variable name="url" select="concat('url(file:///',$basepath, $attachment_path, ')')"/>
13608
13655
  <xsl:variable name="description" select="normalize-space(*[local-name() = 'formattedref'])"/>
13609
13656
  <!-- Todo: need update -->
13610
- <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'span'][@class = 'pdf-AFRelationship'])"/>
13657
+ <xsl:variable name="afrelationship" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-AFRelationship'])"/>
13658
+ <xsl:variable name="volatile" select="normalize-space(.//*[local-name() = 'classification'][@type = 'pdf-volatile'])"/>
13611
13659
  <pdf:embedded-file src="{$url}" filename="{$attachment_name}" link-as-file-annotation="true">
13612
13660
  <xsl:if test="$description != ''">
13613
13661
  <xsl:attribute name="description"><xsl:value-of select="$description"/></xsl:attribute>
13614
13662
  </xsl:if>
13615
13663
  <xsl:if test="$afrelationship != ''">
13616
- <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13617
- </xsl:if>
13664
+ <xsl:attribute name="afrelationship"><xsl:value-of select="$afrelationship"/></xsl:attribute>
13665
+ </xsl:if>
13666
+ <xsl:if test="$volatile != ''">
13667
+ <xsl:attribute name="volatile"><xsl:value-of select="$volatile"/></xsl:attribute>
13668
+ </xsl:if>
13618
13669
  </pdf:embedded-file>
13619
13670
  </xsl:for-each>
13620
13671
  </xsl:if>
@@ -13661,10 +13712,31 @@
13661
13712
  <xsl:value-of select="$level_total - 2"/>
13662
13713
  </xsl:when>
13663
13714
  <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)"/>
13715
+ <!-- determine 'depth' depends on upper clause with title/@depth -->
13716
+ <!-- <xsl:message>title=<xsl:value-of select="."/></xsl:message> -->
13717
+ <xsl:variable name="clause_with_depth_depth" select="ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/*[local-name() = 'title']/@depth"/>
13718
+ <!-- <xsl:message>clause_with_depth_depth=<xsl:value-of select="$clause_with_depth_depth"/></xsl:message> -->
13719
+ <xsl:variable name="clause_with_depth_level" select="count(ancestor::*[local-name() = 'clause'][*[local-name() = 'title']/@depth][1]/ancestor::*)"/>
13720
+ <!-- <xsl:message>clause_with_depth_level=<xsl:value-of select="$clause_with_depth_level"/></xsl:message> -->
13721
+ <xsl:variable name="curr_level" select="count(ancestor::*) - 1"/>
13722
+ <!-- <xsl:message>curr_level=<xsl:value-of select="$curr_level"/></xsl:message> -->
13723
+ <!-- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][2]/*[local-name() = 'title']/@depth)"/> -->
13724
+ <xsl:variable name="curr_clause_depth" select="number($clause_with_depth_depth) + (number($curr_level) - number($clause_with_depth_level)) "/>
13725
+ <!-- <xsl:message>curr_clause_depth=<xsl:value-of select="$curr_clause_depth"/></xsl:message> -->
13665
13726
  <xsl:choose>
13666
- <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13667
- <xsl:value-of select="number($upper_clause_depth + 1)"/>
13727
+ <xsl:when test="string(number($curr_clause_depth)) != 'NaN'">
13728
+ <xsl:value-of select="number($curr_clause_depth)"/>
13729
+ </xsl:when>
13730
+ <xsl:otherwise>
13731
+ <xsl:value-of select="$level_total - 2"/>
13732
+ </xsl:otherwise>
13733
+ </xsl:choose>
13734
+ </xsl:when>
13735
+ <xsl:when test="ancestor::*[local-name() = 'sections'] and self::*[local-name() = 'name'] and parent::*[local-name() = 'term']">
13736
+ <xsl:variable name="upper_terms_depth" select="normalize-space(ancestor::*[local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13737
+ <xsl:choose>
13738
+ <xsl:when test="string(number($upper_terms_depth)) != 'NaN'">
13739
+ <xsl:value-of select="number($upper_terms_depth + 1)"/>
13668
13740
  </xsl:when>
13669
13741
  <xsl:otherwise>
13670
13742
  <xsl:value-of select="$level_total - 2"/>
@@ -13672,7 +13744,7 @@
13672
13744
  </xsl:choose>
13673
13745
  </xsl:when>
13674
13746
  <xsl:when test="ancestor::*[local-name() = 'sections']">
13675
- <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause'][1]/*[local-name() = 'title']/@depth)"/>
13747
+ <xsl:variable name="upper_clause_depth" select="normalize-space(ancestor::*[local-name() = 'clause' or local-name() = 'terms'][1]/*[local-name() = 'title']/@depth)"/>
13676
13748
  <xsl:choose>
13677
13749
  <xsl:when test="string(number($upper_clause_depth)) != 'NaN'">
13678
13750
  <xsl:value-of select="number($upper_clause_depth + 1)"/>
@@ -13987,9 +14059,10 @@
13987
14059
  <xsl:template name="insertBackgroundPageImage">
13988
14060
  <xsl:param name="number">1</xsl:param>
13989
14061
  <xsl:param name="name">coverpage-image</xsl:param>
14062
+ <xsl:param name="suffix"/>
13990
14063
  <xsl:variable name="num" select="number($number)"/>
13991
14064
  <!-- background image -->
13992
- <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage_{$name}_{$number}_{generate-id()}">
14065
+ <fo:block-container absolute-position="fixed" left="0mm" top="0mm" font-size="0" id="__internal_layout__coverpage{$suffix}_{$name}_{$number}_{generate-id()}">
13993
14066
  <fo:block>
13994
14067
  <xsl:for-each select="/*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'presentation-metadata'][*[local-name() = 'name'] = $name][1]/*[local-name() = 'value']/*[local-name() = 'image'][$num]">
13995
14068
  <xsl:choose>
@@ -14055,16 +14128,29 @@
14055
14128
 
14056
14129
  <!-- END: insert cover page image -->
14057
14130
 
14131
+ <xsl:variable name="regex_ja_spec">[\uFF08\uFF09]</xsl:variable>
14058
14132
  <xsl:template name="insertVerticalChar">
14059
14133
  <xsl:param name="str"/>
14134
+ <xsl:param name="writing-mode">lr-tb</xsl:param>
14135
+ <xsl:param name="reference-orientation">90</xsl:param>
14060
14136
  <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">
14137
+ <fo:inline-container text-align="center" alignment-baseline="central" width="1em" margin="0" padding="0" text-indent="0mm" last-line-end-indent="0mm" start-indent="0mm" end-indent="0mm">
14138
+ <xsl:if test="normalize-space($writing-mode) != ''">
14139
+ <xsl:attribute name="writing-mode"><xsl:value-of select="$writing-mode"/></xsl:attribute>
14140
+ <xsl:attribute name="reference-orientation">90</xsl:attribute>
14141
+ </xsl:if>
14142
+ <xsl:variable name="char" select="substring($str,1,1)"/>
14143
+ <xsl:if test="normalize-space(java:matches(java:java.lang.String.new($char), concat('(', $regex_ja_spec, '{1,})'))) = 'true'">
14144
+ <xsl:attribute name="reference-orientation">0</xsl:attribute>
14145
+ </xsl:if>
14062
14146
  <fo:block-container width="1em">
14063
- <fo:block line-height="1em"><xsl:value-of select="substring($str,1,1)"/></fo:block>
14147
+ <fo:block line-height="1em"><xsl:value-of select="$char"/></fo:block>
14064
14148
  </fo:block-container>
14065
14149
  </fo:inline-container>
14066
14150
  <xsl:call-template name="insertVerticalChar">
14067
14151
  <xsl:with-param name="str" select="substring($str, 2)"/>
14152
+ <xsl:with-param name="writing-mode" select="$writing-mode"/>
14153
+ <xsl:with-param name="reference-orientation" select="$reference-orientation"/>
14068
14154
  </xsl:call-template>
14069
14155
  </xsl:if>
14070
14156
  </xsl:template>
@@ -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,22 +1,6 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- class Converter < JIS::Converter
4
- def bibdata_cleanup(xmldoc)
5
- super
6
- coverpage_images(xmldoc)
7
- end
8
-
9
- def coverpage_images(xmldoc)
10
- %w(coverpage-image).each do |n|
11
- xmldoc.xpath("//bibdata/ext/#{n}").each do |x|
12
- ins = add_misc_container(xmldoc)
13
- ins << "<presentation-metadata><name>#{n}</name>" \
14
- "<value>#{x.remove.children.to_xml}</value>" \
15
- "</presentation-metadata>"
16
- end
17
- end
18
- end
19
-
3
+ class Converter < Jis::Converter
20
4
  def blocksource_cleanup(xmldoc)
21
5
  xmldoc.xpath("//termsource").each do |s|
22
6
  p = s.previous_element or next
@@ -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
@@ -44,23 +44,6 @@ module Metanorma
44
44
  "#{@doctype} is not a recognised document type")
45
45
  end
46
46
 
47
- def metadata_ext(node, xml)
48
- super
49
- metadata_coverpage_images(node, xml)
50
- end
51
-
52
- def metadata_coverpage_images(node, xml)
53
- %w(coverpage-image).each do |n|
54
- if a = node.attr(n)
55
- xml.send n do |c|
56
- a.split(",").each do |x|
57
- c.image src: x
58
- end
59
- end
60
- end
61
- end
62
- end
63
-
64
47
  def metadata_id(node, xml)
65
48
  if id = node.attr("docidentifier")
66
49
  xml.docidentifier "PLATEAU #{id.sub(/^PLATEAU /, '')}",
@@ -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.7".freeze
3
+ VERSION = "0.1.9".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.7
4
+ version: 0.1.9
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-30 00:00:00.000000000 Z
11
+ date: 2024-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-jis