metanorma-plateau 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f8e1f42a81f5dd4e4bd6d068002e4499e15c467d1961331ff42555588b1c776
4
- data.tar.gz: e760543b322da439d2115e7600482c4b942896d428be685cbed845444a7c61c0
3
+ metadata.gz: 838839bc86469a328f7252f84d236687d5584c0d59633746756a445a40e063fb
4
+ data.tar.gz: 816088c99147f784b587d3c8b4c32c357aaa049340dc27e7fe0d09235dc810c0
5
5
  SHA512:
6
- metadata.gz: 574d4e9c2e8c9160a7ef8244d04faff7f8c2ea9d6280fc4ca3fdadc326ad859954361c7f21fdaf87e365fef58c4496d089b39650a78c1cb488a4288d672dace7
7
- data.tar.gz: b15a8dca0976d5a6360b15da39d33934eeca5dedcba5b36e19c224cd4b885b65eb96358fb346a39c40e46f3d0a0370fe03365da1e629b49675f6c55292312a08
6
+ metadata.gz: 599842b641f909db3fbbb804de614a340f5cf1b3699ba64d0c36a1b99b857cce80686e5a7babb87ce0fd453618d1037fe7fd707c93c4151b8291cc7e95b20782
7
+ data.tar.gz: 266668f37b4ab39f4dc7f7b72659f7c7a5dd31184c9bac10a210f378619af9c0d0bd6424e09a85b6c582700c107571835fb34cfd7203b375dee4aeb803fc093a
@@ -3521,13 +3521,35 @@
3521
3521
  </xsl:for-each>
3522
3522
  </xsl:element>
3523
3523
 
3524
- <xsl:call-template name="insertAnnexInSeparatePageSequences"/>
3524
+ <xsl:call-template name="insertAnnexAndBibliographyInSeparatePageSequences"/>
3525
3525
 
3526
- <xsl:call-template name="insertBibliographyInSeparatePageSequences"/>
3526
+ <!-- <xsl:call-template name="insertBibliographyInSeparatePageSequences"/> -->
3527
3527
 
3528
3528
  <!-- <xsl:call-template name="insertIndexInSeparatePageSequences"/> -->
3529
3529
  </xsl:template> <!-- END: insertMainSectionsInSeparatePageSequences -->
3530
3530
 
3531
+ <xsl:template name="insertAnnexAndBibliographyInSeparatePageSequences">
3532
+ <xsl:for-each select="/*/*[local-name()='annex'] | /*/*[local-name()='bibliography']/*[not(@normative='true')] | /*/*[local-name()='bibliography']/*[local-name()='clause'][*[local-name()='references'][not(@normative='true')]] | /*/*[local-name()='indexsect']">
3533
+ <xsl:sort select="@displayorder" data-type="number"/>
3534
+ <xsl:choose>
3535
+ <xsl:when test="local-name() = 'annex' or local-name() = 'indexsect'">
3536
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3537
+ <xsl:attribute name="main_page_sequence"/>
3538
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3539
+ </xsl:element>
3540
+ </xsl:when>
3541
+ <xsl:otherwise> <!-- bibliography -->
3542
+ <xsl:element name="bibliography" namespace="{$namespace_full}"> <!-- save context element -->
3543
+ <xsl:element name="page_sequence" namespace="{$namespace_full}">
3544
+ <xsl:attribute name="main_page_sequence"/>
3545
+ <xsl:apply-templates select="." mode="update_xml_step_move_pagebreak"/>
3546
+ </xsl:element>
3547
+ </xsl:element>
3548
+ </xsl:otherwise>
3549
+ </xsl:choose>
3550
+ </xsl:for-each>
3551
+ </xsl:template>
3552
+
3531
3553
  <xsl:template name="insertAnnexInSeparatePageSequences">
3532
3554
  <xsl:for-each select="/*/*[local-name()='annex']">
3533
3555
  <xsl:sort select="@displayorder" data-type="number"/>
@@ -12335,10 +12357,12 @@
12335
12357
  <xsl:template match="*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']" mode="update_xml_step1">
12336
12358
  <xsl:copy>
12337
12359
  <xsl:copy-of select="@*"/>
12338
- <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12339
- <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12340
- <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12341
- <xsl:value-of select="."/>
12360
+ <xsl:if test="1 = 2"> <!-- remove attachment/text(), because attachments added in the template 'addPDFUAmeta' before applying 'update_xml_step1' -->
12361
+ <xsl:variable name="name_filepath" select="concat($inputxml_basepath, @name)"/>
12362
+ <xsl:variable name="file_exists" select="normalize-space(java:exists(java:java.io.File.new($name_filepath)))"/>
12363
+ <xsl:if test="$file_exists = 'false'"> <!-- copy attachment content only if file on disk doesnt exist -->
12364
+ <xsl:value-of select="normalize-space(.)"/>
12365
+ </xsl:if>
12342
12366
  </xsl:if>
12343
12367
  </xsl:copy>
12344
12368
  </xsl:template>
@@ -13320,7 +13344,8 @@
13320
13344
  <xsl:for-each select="//*[contains(local-name(), '-standard')]/*[local-name() = 'metanorma-extension']/*[local-name() = 'attachment']">
13321
13345
  <xsl:choose>
13322
13346
  <xsl:when test="normalize-space() != ''">
13323
- <pdf:embedded-file src="{.}" filename="{@name}"/>
13347
+ <xsl:variable name="src_attachment" select="java:replaceAll(java:java.lang.String.new(.),'(&#13;&#10;|&#13;|&#10;)', '')"/> <!-- remove line breaks -->
13348
+ <pdf:embedded-file src="{$src_attachment}" filename="{@name}"/>
13324
13349
  </xsl:when>
13325
13350
  <xsl:otherwise>
13326
13351
  <!-- _{filename}_attachments -->
@@ -3,6 +3,11 @@ require_relative "init"
3
3
  module IsoDoc
4
4
  module Plateau
5
5
  class PresentationXMLConvert < IsoDoc::JIS::PresentationXMLConvert
6
+ def initialize(options)
7
+ @iso = ::IsoDoc::Iso::PresentationXMLConvert.new(options)
8
+ super
9
+ end
10
+
6
11
  def toc_title_insert_pt(docxml)
7
12
  i = preface_init_insert_pt(docxml) or return nil
8
13
  a = i.at(ns("./abstract[last()] | ./clause[@type = 'revhistory']")) and
@@ -70,6 +75,14 @@ module IsoDoc
70
75
  elem.previous = ret
71
76
  end
72
77
 
78
+ def ol_depth(node)
79
+ @iso.ol_depth(node)
80
+ end
81
+
82
+ def bibliography_bibitem_number(docxml)
83
+ super
84
+ end
85
+
73
86
  include Init
74
87
  end
75
88
  end
@@ -4,6 +4,11 @@ module IsoDoc
4
4
  end
5
5
 
6
6
  class Xref < IsoDoc::JIS::Xref
7
+ def initialize(lang, script, klass, i18n, options)
8
+ @iso = ::IsoDoc::Iso::Xref.new(lang, script, klass, i18n, options)
9
+ super
10
+ end
11
+
7
12
  def clause_order_main(_docxml)
8
13
  [
9
14
  {
@@ -39,42 +44,6 @@ module IsoDoc
39
44
  end
40
45
  end
41
46
 
42
- def section_name_anchors(clause, num, level)
43
- super
44
- if level >= 4 && level <= 6
45
- label, xref = section_name_anchors_deep(num, level)
46
- @anchors[clause["id"]][:label] = label
47
- @anchors[clause["id"]][:xref] = l10n(xref)
48
- end
49
- end
50
-
51
- def section_name_anchors_deep(num, level)
52
- numparts = num.split(".")
53
- core = numparts[0..2].join(".")
54
- (4..level).each do |l|
55
- core += " #{section_name_label_deep(numparts[l - 1], l)}"
56
- end
57
- [section_name_label_deep(numparts[-1], level), l10n(core)]
58
- end
59
-
60
- def section_name_label_deep(num, level)
61
- case level
62
- when 4 then l10n("(#{num})")
63
- when 5 then l10n("#{num})")
64
- when 6
65
- ("" << (num.to_i + 0x245f))
66
- end
67
- end
68
-
69
- def annex_name_anchors1(clause, num, level)
70
- super
71
- if level >= 4 && level <= 6
72
- label, xref = section_name_anchors_deep(num, level)
73
- @anchors[clause["id"]][:label] = label
74
- @anchors[clause["id"]][:xref] = l10n(xref)
75
- end
76
- end
77
-
78
47
  def hierarchical_figure_names(clause, num)
79
48
  c = IsoDoc::XrefGen::Counter.new
80
49
  j = 0
@@ -102,6 +71,14 @@ module IsoDoc
102
71
  end
103
72
  end
104
73
 
74
+ def list_item_anchor_names(list, list_anchor, depth, prev_label,
75
+ refer_list)
76
+ @iso.list_item_anchor_names(list, list_anchor, depth, prev_label, refer_list)
77
+ end
78
+
79
+ def list_item_value(entry, counter, depth, opts)
80
+ @iso.list_item_value(entry, counter, depth, opts)
81
+ end
105
82
  end
106
83
  end
107
84
  end
@@ -28,13 +28,20 @@ module Metanorma
28
28
  super
29
29
  end
30
30
 
31
- def pub_class(bib)
32
- return 1 if bib.at("#{PUBLISHER}[name = '#{pub_hash['en']}']") ||
33
- bib.at("#{PUBLISHER}[name = '#{pub_hash['ja']}']") ||
34
- bib.at("#{PUBLISHER}[abbreviation = 'MLIT']")
35
- return 2 if bib["type"] == "standard"
31
+ # Abandoned in favour of JIS ordering
32
+ # def pub_class(bib)
33
+ # return 1 if bib.at("#{PUBLISHER}[name = '#{pub_hash['en']}']") ||
34
+ # bib.at("#{PUBLISHER}[name = '#{pub_hash['ja']}']") ||
35
+ # bib.at("#{PUBLISHER}[abbreviation = 'MLIT']")
36
+ # return 2 if bib["type"] == "standard"
37
+ #
38
+ # 3
39
+ # end
36
40
 
37
- 3
41
+ def biblio_reorder(xmldoc)
42
+ xmldoc.xpath("//references").each do |r|
43
+ biblio_reorder1(r)
44
+ end
38
45
  end
39
46
  end
40
47
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Plateau
3
- VERSION = "0.1.2".freeze
3
+ VERSION = "0.1.3".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.2
4
+ version: 0.1.3
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-08-05 00:00:00.000000000 Z
11
+ date: 2024-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-jis