metanorma-itu 2.1.8.1 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,7 +24,7 @@ module IsoDoc
24
24
  super
25
25
  if @parse_settings.empty? || @parse_settings[:clauses]
26
26
  if annexid = docxml
27
- &.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
27
+ .at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
28
28
  docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
29
29
  else
30
30
  informative_annex_names(docxml)
@@ -57,14 +57,6 @@ module IsoDoc
57
57
  doc.xpath(ns("//boilerplate//clause")).each { |c| preface_names(c) }
58
58
  doc.xpath("//xmlns:preface/child::*").each { |c| preface_names(c) }
59
59
  end
60
- if @parse_settings.empty?
61
- if @hierarchical_assets
62
- hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
63
- "Preface")
64
- else
65
- sequential_asset_names(doc.xpath("//xmlns:preface/child::*"))
66
- end
67
- end
68
60
  if @parse_settings.empty? || @parse_settings[:clauses]
69
61
  n = Counter.new
70
62
  n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
@@ -75,11 +67,6 @@ module IsoDoc
75
67
  n = section_names(doc.at(ns("//sections/definitions")), n, 1)
76
68
  clause_names(doc, n)
77
69
  end
78
- if @parse_settings.empty?
79
- middle_section_asset_names(doc)
80
- termnote_anchor_names(doc)
81
- termexample_anchor_names(doc)
82
- end
83
70
  end
84
71
 
85
72
  def middle_sections
@@ -90,6 +77,18 @@ module IsoDoc
90
77
  "//sections/definitions | //clause[parent::sections]"
91
78
  end
92
79
 
80
+ def asset_anchor_names(doc)
81
+ super
82
+ if @parse_settings.empty?
83
+ if @hierarchical_assets
84
+ hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
85
+ "Preface")
86
+ else
87
+ sequential_asset_names(doc.xpath("//xmlns:preface/child::*"))
88
+ end
89
+ end
90
+ end
91
+
93
92
  def middle_section_asset_names(doc)
94
93
  return super unless @hierarchical_assets
95
94
 
@@ -98,47 +97,28 @@ module IsoDoc
98
97
  end
99
98
  end
100
99
 
101
- def sequential_figure_names(clause)
102
- c = Counter.new
103
- j = 0
104
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).each do |t|
105
- if t.parent.name == "figure" then j += 1
106
- else
107
- j = 0
108
- c.increment(t)
109
- end
110
- label = c.print + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr}")
111
- next if t["id"].nil? || t["id"].empty?
112
-
113
- @anchors[t["id"]] =
114
- anchor_struct(label, nil, @labels["figure"], "figure",
115
- t["unnumbered"])
116
- end
100
+ def sequential_figure_body(subfignum, counter, block)
101
+ label = counter.print
102
+ label &&= label +
103
+ (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
104
+ @anchors[block["id"]] = anchor_struct(
105
+ label, nil, @labels["figure"], "figure", block["unnumbered"]
106
+ )
117
107
  end
118
108
 
119
- def hierarchical_figure_names(clause, num)
120
- c = Counter.new
121
- j = 0
122
- clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).each do |t|
123
- if t.parent.name == "figure" then j += 1
124
- else
125
- j = 0
126
- c.increment(t)
127
- end
128
- label = "#{num}#{hiersep}#{c.print}" + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr}")
129
- next if t["id"].nil? || t["id"].empty?
109
+ def hierarchical_figure_body(num, subfignum, counter, block)
110
+ label = "#{num}#{hiersep}#{counter.print}" +
111
+ (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
130
112
 
131
- @anchors[t["id"]] =
132
- anchor_struct(label, nil, @labels["figure"], "figure",
133
- t["unnumbered"])
134
- end
113
+ @anchors[block["id"]] = anchor_struct(label, nil, @labels["figure"],
114
+ "figure", block["unnumbered"])
135
115
  end
136
116
 
137
117
  def sequential_formula_names(clause)
138
- clause&.first&.xpath(ns(middle_sections))&.each do |c|
118
+ clause.first&.xpath(ns(middle_sections))&.each do |c|
139
119
  if c["id"] && @anchors[c["id"]]
140
- hierarchical_formula_names(c,
141
- @anchors[c["id"]][:label] || @anchors[c["id"]][:xref] || "???")
120
+ hierarchical_formula_names(c, @anchors[c["id"]][:label] ||
121
+ @anchors[c["id"]][:xref] || "???")
142
122
  else
143
123
  hierarchical_formula_names(c, "???")
144
124
  end
@@ -147,9 +127,7 @@ module IsoDoc
147
127
 
148
128
  def hierarchical_formula_names(clause, num)
149
129
  c = Counter.new
150
- clause.xpath(ns(".//formula")).reject do |n|
151
- blank?(n["id"])
152
- end.each do |t|
130
+ clause.xpath(ns(".//formula")).noblank.each do |t|
153
131
  @anchors[t["id"]] = anchor_struct(
154
132
  "#{num}-#{c.increment(t).print}", nil,
155
133
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
@@ -168,7 +146,7 @@ module IsoDoc
168
146
  docxml.xpath(ns("//term[termnote]")).each do |t|
169
147
  c = Counter.new
170
148
  notes = t.xpath(ns("./termnote"))
171
- notes.reject { |n| blank?(n["id"]) }.each do |n|
149
+ notes.noblank.each do |n|
172
150
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
173
151
  @anchors[n["id"]] =
174
152
  { label: termnote_label(idx).strip, type: "termnote", value: idx,
@@ -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>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.1.8.1".freeze
3
+ VERSION = "2.1.9".freeze
4
4
  end
5
5
  end
@@ -1,3 +1,3 @@
1
1
  template:
2
- # skip standardidentifier, it is inserted in front of formattedref within metanorma
2
+ # skip authoritative identifier, it is inserted in front of formattedref within metanorma
3
3
  standard: "<em>{{ title }}</em> ,_{{ edition | capitalize_first }} . {{ extent }}."
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
26
26
 
27
27
  spec.add_dependency "htmlentities", "~> 4.3.4"
28
- spec.add_dependency "metanorma-standoc", "~> 2.2.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 2.2.4"
29
29
  spec.add_dependency "ruby-jing"
30
30
  spec.add_dependency "twitter_cldr", ">= 3.0.0"
31
31
  spec.add_dependency "tzinfo-data" # we need this for windows only
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-itu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8.1
4
+ version: 2.1.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-07 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: htmlentities
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.2.0
33
+ version: 2.2.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.2.0
40
+ version: 2.2.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby-jing
43
43
  requirement: !ruby/object:Gem::Requirement