metanorma-un 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,8 +6,8 @@ require_relative "i18n"
6
6
  module IsoDoc
7
7
  module UN
8
8
  module Init
9
- def metadata_init(lang, script, labels)
10
- @meta = Metadata.new(lang, script, labels)
9
+ def metadata_init(lang, script, locale, labels)
10
+ @meta = Metadata.new(lang, script, locale, labels)
11
11
  @meta.set(:toc, @toc)
12
12
  end
13
13
 
@@ -16,8 +16,9 @@ module IsoDoc
16
16
  @xrefs = Xref.new(lang, script, html, labels, options)
17
17
  end
18
18
 
19
- def i18n_init(lang, script, i18nyaml = nil)
20
- @i18n = I18n.new(lang, script, i18nyaml: i18nyaml || @i18nyaml)
19
+ def i18n_init(lang, script, locale, i18nyaml = nil)
20
+ @i18n = I18n.new(lang, script, locale: locale,
21
+ i18nyaml: i18nyaml || @i18nyaml)
21
22
  end
22
23
 
23
24
  def fileloc(loc)
@@ -4,9 +4,8 @@ require "iso-639"
4
4
 
5
5
  module IsoDoc
6
6
  module UN
7
-
8
7
  class Metadata < IsoDoc::Metadata
9
- def initialize(lang, script, labels)
8
+ def initialize(lang, script, locale, labels)
10
9
  super
11
10
  here = File.dirname(__FILE__)
12
11
  set(:logo, File.expand_path(File.join(here, "html", "logo.jpg")))
@@ -27,8 +26,8 @@ module IsoDoc
27
26
  def extract_languages(nodeset)
28
27
  lgs = []
29
28
  nodeset.each do |l|
30
- l && ISO_639&.find(l.text)&.english_name &&
31
- lgs << ISO_639.find(l.text).english_name
29
+ l && ISO_639.find(l.text)&.english_name and
30
+ lgs << ISO_639.find(l.text).english_name
32
31
  end
33
32
  lgs.map { |l| l == "Spanish; Castilian" ? "Spanish" : l }
34
33
  end
@@ -36,7 +35,7 @@ module IsoDoc
36
35
  def author(isoxml, _out)
37
36
  tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
38
37
  set(:tc, tc.text) if tc
39
- set(:distribution, isoxml&.at(ns("//bibdata/ext/distribution"))&.text)
38
+ set(:distribution, isoxml.at(ns("//bibdata/ext/distribution"))&.text)
40
39
  lgs = extract_languages(isoxml.xpath(ns("//bibdata/language")))
41
40
  lgs.sort == %w(English French Arabic Chinese Russian Spanish).sort and
42
41
  lgs = []
@@ -56,23 +55,23 @@ module IsoDoc
56
55
  end
57
56
 
58
57
  def session(isoxml, _out)
59
- set(:session_number, isoxml&.at(ns("//bibdata/ext/session/number"))&.
60
- text&.to_i&.localize&.
61
- to_rbnf_s("SpelloutRules", "spellout-ordinal")&.capitalize)
62
- set(:session_date, isoxml&.at(ns("//bibdata/ext/session/date"))&.text)
58
+ set(:session_number, isoxml.at(ns("//bibdata/ext/session/number"))
59
+ &.text&.to_i&.localize
60
+ &.to_rbnf_s("SpelloutRules", "spellout-ordinal")&.capitalize)
61
+ set(:session_date, isoxml.at(ns("//bibdata/ext/session/date"))&.text)
63
62
  set(:session_collaborator,
64
- isoxml&.at(ns("//bibdata/ext/session/collaborator"))&.text)
65
- sid = isoxml&.at(ns("//bibdata/ext/session/id"))&.text
63
+ isoxml.at(ns("//bibdata/ext/session/collaborator"))&.text)
64
+ sid = isoxml.at(ns("//bibdata/ext/session/id"))&.text
66
65
  set(:session_id, sid)
67
66
  set(:session_id_head, sid&.sub(%r{/.*$}, ""))
68
67
  set(:session_id_tail, sid&.sub(%r{^[^/]+}, ""))
69
- set(:item_footnote,
70
- isoxml&.at(ns("//bibdata/ext/session/item-footnote"))&.text)
71
- set(:session_itemnumber,
68
+ set(:item_footnote,
69
+ isoxml.at(ns("//bibdata/ext/session/item-footnote"))&.text)
70
+ set(:session_itemnumber,
72
71
  multival(isoxml, "//bibdata/ext/session/item-number"))
73
- set(:session_itemname,
72
+ set(:session_itemname,
74
73
  multival(isoxml, "//bibdata/ext/session/item-name"))
75
- set(:session_subitemname,
74
+ set(:session_subitemname,
76
75
  multival(isoxml, "//bibdata/ext/session/subitem-name"))
77
76
  end
78
77
 
@@ -80,8 +79,8 @@ module IsoDoc
80
79
  dn = isoxml.at(ns("//bibdata/docidentifier"))&.text
81
80
  set(:docnumber, dn)
82
81
  type = isoxml&.at(ns("//bibdata/ext/doctype"))&.text
83
- set(:formatted_docnumber, type == "recommendation" ?
84
- "UN/CEFACT Recommendation #{dn}" : dn)
82
+ set(:formatted_docnumber,
83
+ type == "recommendation" ? "UN/CEFACT Recommendation #{dn}" : dn)
85
84
  end
86
85
 
87
86
  def stage_abbr(status)
@@ -6542,6 +6542,18 @@
6542
6542
  </xsl:copy>
6543
6543
  </xsl:template>
6544
6544
 
6545
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
6546
+ <xsl:copy>
6547
+ <xsl:apply-templates mode="contents_item"/>
6548
+ </xsl:copy>
6549
+ </xsl:template>
6550
+
6551
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
6552
+ <xsl:copy>
6553
+ <xsl:apply-templates mode="contents_item"/>
6554
+ </xsl:copy>
6555
+ </xsl:template>
6556
+
6545
6557
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6546
6558
  <xsl:copy-of select="."/>
6547
6559
  </xsl:template>
@@ -6542,6 +6542,18 @@
6542
6542
  </xsl:copy>
6543
6543
  </xsl:template>
6544
6544
 
6545
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
6546
+ <xsl:copy>
6547
+ <xsl:apply-templates mode="contents_item"/>
6548
+ </xsl:copy>
6549
+ </xsl:template>
6550
+
6551
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
6552
+ <xsl:copy>
6553
+ <xsl:apply-templates mode="contents_item"/>
6554
+ </xsl:copy>
6555
+ </xsl:template>
6556
+
6545
6557
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6546
6558
  <xsl:copy-of select="."/>
6547
6559
  </xsl:template>
@@ -6622,6 +6622,18 @@
6622
6622
  </xsl:copy>
6623
6623
  </xsl:template>
6624
6624
 
6625
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
6626
+ <xsl:copy>
6627
+ <xsl:apply-templates mode="contents_item"/>
6628
+ </xsl:copy>
6629
+ </xsl:template>
6630
+
6631
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
6632
+ <xsl:copy>
6633
+ <xsl:apply-templates mode="contents_item"/>
6634
+ </xsl:copy>
6635
+ </xsl:template>
6636
+
6625
6637
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
6626
6638
  <xsl:copy-of select="."/>
6627
6639
  </xsl:template>
@@ -25,6 +25,15 @@ module IsoDoc
25
25
  end
26
26
  end
27
27
 
28
+ def asset_anchor_names(doc)
29
+ super
30
+ @parse_settings.empty? or return
31
+ sequential_asset_names(
32
+ doc.xpath(ns("//preface/abstract | //foreword | //introduction | "\
33
+ "//preface/clause | //acknowledgements")),
34
+ )
35
+ end
36
+
28
37
  def clause_names(docxml, _sect_num)
29
38
  q = "//clause[parent::sections]"
30
39
  @paranumber = 0
@@ -73,8 +73,14 @@
73
73
  <text/>
74
74
  </element>
75
75
  </define>
76
- <define name="script">
76
+ <define name="locale">
77
77
  <a:documentation>ISO-639</a:documentation>
78
+ <element name="locale">
79
+ <text/>
80
+ </element>
81
+ </define>
82
+ <define name="script">
83
+ <a:documentation>ISO-3166</a:documentation>
78
84
  <element name="script">
79
85
  <text/>
80
86
  </element>
@@ -93,6 +99,9 @@
93
99
  <!-- multiple languages and scripts possible: comma delimit them if so -->
94
100
  <attribute name="language"/>
95
101
  </optional>
102
+ <optional>
103
+ <attribute name="locale"/>
104
+ </optional>
96
105
  <optional>
97
106
  <attribute name="script"/>
98
107
  </optional>
@@ -136,6 +145,9 @@
136
145
  <!-- multiple languages and scripts possible: comma delimit them if so -->
137
146
  <attribute name="language"/>
138
147
  </optional>
148
+ <optional>
149
+ <attribute name="locale"/>
150
+ </optional>
139
151
  <optional>
140
152
  <attribute name="script"/>
141
153
  </optional>
@@ -650,6 +662,9 @@
650
662
  <zeroOrMore>
651
663
  <ref name="language"/>
652
664
  </zeroOrMore>
665
+ <zeroOrMore>
666
+ <ref name="locale"/>
667
+ </zeroOrMore>
653
668
  <zeroOrMore>
654
669
  <ref name="script"/>
655
670
  </zeroOrMore>
@@ -741,6 +756,9 @@
741
756
  <zeroOrMore>
742
757
  <ref name="language"/>
743
758
  </zeroOrMore>
759
+ <zeroOrMore>
760
+ <ref name="locale"/>
761
+ </zeroOrMore>
744
762
  <zeroOrMore>
745
763
  <ref name="script"/>
746
764
  </zeroOrMore>
@@ -854,6 +872,15 @@
854
872
  <optional>
855
873
  <attribute name="type"/>
856
874
  </optional>
875
+ <optional>
876
+ <attribute name="language"/>
877
+ </optional>
878
+ <optional>
879
+ <attribute name="locale"/>
880
+ </optional>
881
+ <optional>
882
+ <attribute name="script"/>
883
+ </optional>
857
884
  <data type="anyURI"/>
858
885
  </define>
859
886
  <define name="DateType">
@@ -882,6 +909,7 @@
882
909
  <value>vote-started</value>
883
910
  <value>vote-ended</value>
884
911
  <value>announced</value>
912
+ <value>stable-until</value>
885
913
  </choice>
886
914
  </define>
887
915
  <define name="bdate">
@@ -930,6 +958,9 @@
930
958
  <optional>
931
959
  <attribute name="language"/>
932
960
  </optional>
961
+ <optional>
962
+ <attribute name="locale"/>
963
+ </optional>
933
964
  <optional>
934
965
  <attribute name="script"/>
935
966
  </optional>
@@ -51,7 +51,7 @@ module Metanorma
51
51
  def metadata_id(node, xml)
52
52
  dn = node.attr("docnumber")
53
53
  if docstatus = node.attr("status")
54
- abbr = IsoDoc::UN::Metadata.new("en", "Latn", @i18n)
54
+ abbr = IsoDoc::UN::Metadata.new("en", "Latn", "", @i18n)
55
55
  .stage_abbr(docstatus)
56
56
  dn = "#{dn}(#{abbr})" unless abbr.empty?
57
57
  end
@@ -67,13 +67,13 @@ module Metanorma
67
67
  xml.session do |session|
68
68
  session.number node.attr("session") if node.attr("session")
69
69
  session.date node.attr("session-date") if node.attr("session-date")
70
- node&.attr("item-number")&.split(/, */)&.each do |i|
70
+ node.attr("item-number")&.split(/, */)&.each do |i|
71
71
  session.item_number i
72
72
  end
73
- node&.attr("item-name")&.split(/, */)&.each do |i|
73
+ node.attr("item-name")&.split(/, */)&.each do |i|
74
74
  session.item_name i
75
75
  end
76
- node&.attr("subitem-name")&.split(/, */)&.each do |i|
76
+ node.attr("subitem-name")&.split(/, */)&.each do |i|
77
77
  session.subitem_name i
78
78
  end
79
79
  node.attr("collaborator") and
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module UN
3
- VERSION = "0.9.8".freeze
3
+ VERSION = "0.9.9".freeze
4
4
  end
5
5
  end
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "roman-numerals"
31
31
  spec.add_dependency "twitter_cldr"
32
32
 
33
- spec.add_dependency "metanorma-standoc", "~> 2.2.0"
33
+ spec.add_dependency "metanorma-standoc", "~> 2.2.4"
34
34
 
35
35
  spec.add_development_dependency "debug"
36
36
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-un
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.8
4
+ version: 0.9.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-09-06 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: iso-639
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.2.0
61
+ version: 2.2.4
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.2.0
68
+ version: 2.2.4
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: debug
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -235,13 +235,16 @@ files:
235
235
  - lib/isodoc/un/html/html_unece_intro.html
236
236
  - lib/isodoc/un/html/html_unece_plenary_titlepage.html
237
237
  - lib/isodoc/un/html/html_unece_titlepage.html
238
+ - lib/isodoc/un/html/htmlstyle.css
238
239
  - lib/isodoc/un/html/htmlstyle.scss
239
240
  - lib/isodoc/un/html/logo.jpg
240
241
  - lib/isodoc/un/html/scripts.html
242
+ - lib/isodoc/un/html/unece.css
241
243
  - lib/isodoc/un/html/unece.scss
242
244
  - lib/isodoc/un/html/word_unece_intro.html
243
245
  - lib/isodoc/un/html/word_unece_plenary_titlepage.html
244
246
  - lib/isodoc/un/html/word_unece_titlepage.html
247
+ - lib/isodoc/un/html/wordstyle.css
245
248
  - lib/isodoc/un/html/wordstyle.scss
246
249
  - lib/isodoc/un/html_convert.rb
247
250
  - lib/isodoc/un/i18n-en.yaml
@@ -269,7 +272,7 @@ files:
269
272
  - lib/metanorma/un/un.rng
270
273
  - lib/metanorma/un/validate.rb
271
274
  - lib/metanorma/un/version.rb
272
- - metanorma-unece.gemspec
275
+ - metanorma-un.gemspec
273
276
  homepage: https://github.com/metanorma/metanorma-un
274
277
  licenses:
275
278
  - BSD-2-Clause