metanorma-itu 2.1.8.1 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -7907,6 +7907,18 @@
7907
7907
  </xsl:copy>
7908
7908
  </xsl:template>
7909
7909
 
7910
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7911
+ <xsl:copy>
7912
+ <xsl:apply-templates mode="contents_item"/>
7913
+ </xsl:copy>
7914
+ </xsl:template>
7915
+
7916
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7917
+ <xsl:copy>
7918
+ <xsl:apply-templates mode="contents_item"/>
7919
+ </xsl:copy>
7920
+ </xsl:template>
7921
+
7910
7922
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7911
7923
  <xsl:copy-of select="."/>
7912
7924
  </xsl:template>
@@ -8853,7 +8865,7 @@
8853
8865
  <!-- ====== -->
8854
8866
  <!-- eref -->
8855
8867
  <!-- ====== -->
8856
- <xsl:template match="*[local-name() = 'eref']">
8868
+ <xsl:template match="*[local-name() = 'eref']" name="eref">
8857
8869
  <xsl:variable name="current_bibitemid" select="@bibitemid"/>
8858
8870
  <!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
8859
8871
  <xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
@@ -9358,21 +9370,29 @@
9358
9370
  </xsl:variable>
9359
9371
 
9360
9372
  <xsl:template match="@*|node()" mode="index_add_id">
9373
+ <xsl:param name="docid"/>
9361
9374
  <xsl:copy>
9362
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9375
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9376
+ <xsl:with-param name="docid" select="$docid"/>
9377
+ </xsl:apply-templates>
9363
9378
  </xsl:copy>
9364
9379
  </xsl:template>
9365
9380
 
9366
9381
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9382
+ <xsl:param name="docid"/>
9367
9383
  <xsl:variable name="id">
9368
- <xsl:call-template name="generateIndexXrefId"/>
9384
+ <xsl:call-template name="generateIndexXrefId">
9385
+ <xsl:with-param name="docid" select="$docid"/>
9386
+ </xsl:call-template>
9369
9387
  </xsl:variable>
9370
9388
  <xsl:copy> <!-- add id to xref -->
9371
9389
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9372
9390
  <xsl:attribute name="id">
9373
9391
  <xsl:value-of select="$id"/>
9374
9392
  </xsl:attribute>
9375
- <xsl:apply-templates mode="index_add_id"/>
9393
+ <xsl:apply-templates mode="index_add_id">
9394
+ <xsl:with-param name="docid" select="$docid"/>
9395
+ </xsl:apply-templates>
9376
9396
  </xsl:copy>
9377
9397
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9378
9398
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9384,7 +9404,9 @@
9384
9404
  <xsl:attribute name="id">
9385
9405
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9386
9406
  </xsl:attribute>
9387
- <xsl:apply-templates mode="index_add_id"/>
9407
+ <xsl:apply-templates mode="index_add_id">
9408
+ <xsl:with-param name="docid" select="$docid"/>
9409
+ </xsl:apply-templates>
9388
9410
  </xsl:copy>
9389
9411
  </xsl:if>
9390
9412
  </xsl:template>
@@ -9421,12 +9443,33 @@
9421
9443
  </xsl:when>
9422
9444
  <xsl:when test="self::* and local-name(.) = 'xref'">
9423
9445
  <xsl:variable name="id" select="@id"/>
9424
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9425
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9426
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9427
9446
 
9447
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9428
9448
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9429
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9449
+
9450
+ <xsl:variable name="pages_">
9451
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9452
+ <xsl:choose>
9453
+ <xsl:when test="@id = $id">
9454
+ <page><xsl:value-of select="."/></page>
9455
+ </xsl:when>
9456
+ <xsl:when test="@id = $id_next">
9457
+ <page_next><xsl:value-of select="."/></page_next>
9458
+ </xsl:when>
9459
+ <xsl:when test="@id = $id_prev">
9460
+ <page_prev><xsl:value-of select="."/></page_prev>
9461
+ </xsl:when>
9462
+ </xsl:choose>
9463
+ </xsl:for-each>
9464
+ </xsl:variable>
9465
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9466
+
9467
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9468
+ <xsl:variable name="page" select="$pages/page"/>
9469
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9470
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9471
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9472
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9430
9473
 
9431
9474
  <xsl:choose>
9432
9475
  <!-- 2nd pass -->
@@ -9486,16 +9529,20 @@
9486
9529
  </xsl:template>
9487
9530
 
9488
9531
  <xsl:template name="generateIndexXrefId">
9532
+ <xsl:param name="docid"/>
9533
+
9489
9534
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9490
9535
 
9491
- <xsl:variable name="docid">
9492
- <xsl:call-template name="getDocumentId"/>
9536
+ <xsl:variable name="docid_curr">
9537
+ <xsl:value-of select="$docid"/>
9538
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9493
9539
  </xsl:variable>
9540
+
9494
9541
  <xsl:variable name="item_number">
9495
9542
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9496
9543
  </xsl:variable>
9497
9544
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9498
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9545
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9499
9546
  </xsl:template>
9500
9547
 
9501
9548
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -4,7 +4,7 @@ require "twitter_cldr"
4
4
  module IsoDoc
5
5
  module ITU
6
6
  class Metadata < IsoDoc::Metadata
7
- def initialize(lang, script, labels)
7
+ def initialize(lang, script, locale, labels)
8
8
  super
9
9
  n = "International_Telecommunication_Union_Logo.svg"
10
10
  set(:logo_html, fileloc(n))
@@ -175,13 +175,12 @@ module IsoDoc
175
175
  end
176
176
 
177
177
  def annex1(elem)
178
- return super unless elem&.at(ns("//bibdata/ext/doctype"))&.text ==
178
+ return super unless elem.at(ns("//bibdata/ext/doctype"))&.text ==
179
179
  "resolution"
180
180
 
181
181
  lbl = @xrefs.anchor(elem["id"], :label)
182
- subhead = (@i18n.l10n("(#{@i18n.get['to']} ") +
183
- elem.at(ns("//bibdata/title[@type = 'resolution']"))
184
- .children.to_xml + @i18n.l10n(")"))
182
+ res = elem.at(ns("//bibdata/title[@type = 'resolution']"))
183
+ subhead = @i18n.l10n("(#{@i18n.get['to']} #{res.children.to_xml})")
185
184
  elem.elements.first.previous =
186
185
  "<p class='supertitle'>#{lbl}<br/>#{subhead}</p>"
187
186
  t = elem.at(ns("./title")) and
@@ -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,31 @@ 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, klass)
101
+ label = counter.print
102
+ label &&= label +
103
+ (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
104
+ @anchors[block["id"]] = anchor_struct(
105
+ label, nil, @labels[klass] || klass.capitalize, klass,
106
+ block["unnumbered"]
107
+ )
117
108
  end
118
109
 
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?
110
+ def hierarchical_figure_body(num, subfignum, counter, block, klass)
111
+ label = "#{num}#{hiersep}#{counter.print}" +
112
+ (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
130
113
 
131
- @anchors[t["id"]] =
132
- anchor_struct(label, nil, @labels["figure"], "figure",
133
- t["unnumbered"])
134
- end
114
+ @anchors[block["id"]] = anchor_struct(
115
+ label, nil, @labels[klass] || klass.capitalize,
116
+ klass, block["unnumbered"]
117
+ )
135
118
  end
136
119
 
137
120
  def sequential_formula_names(clause)
138
- clause&.first&.xpath(ns(middle_sections))&.each do |c|
121
+ clause.first&.xpath(ns(middle_sections))&.each do |c|
139
122
  if c["id"] && @anchors[c["id"]]
140
- hierarchical_formula_names(c,
141
- @anchors[c["id"]][:label] || @anchors[c["id"]][:xref] || "???")
123
+ hierarchical_formula_names(c, @anchors[c["id"]][:label] ||
124
+ @anchors[c["id"]][:xref] || "???")
142
125
  else
143
126
  hierarchical_formula_names(c, "???")
144
127
  end
@@ -147,9 +130,7 @@ module IsoDoc
147
130
 
148
131
  def hierarchical_formula_names(clause, num)
149
132
  c = Counter.new
150
- clause.xpath(ns(".//formula")).reject do |n|
151
- blank?(n["id"])
152
- end.each do |t|
133
+ clause.xpath(ns(".//formula")).noblank.each do |t|
153
134
  @anchors[t["id"]] = anchor_struct(
154
135
  "#{num}-#{c.increment(t).print}", nil,
155
136
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
@@ -168,7 +149,7 @@ module IsoDoc
168
149
  docxml.xpath(ns("//term[termnote]")).each do |t|
169
150
  c = Counter.new
170
151
  notes = t.xpath(ns("./termnote"))
171
- notes.reject { |n| blank?(n["id"]) }.each do |n|
152
+ notes.noblank.each do |n|
172
153
  idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
173
154
  @anchors[n["id"]] =
174
155
  { 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>
@@ -205,6 +205,15 @@
205
205
  <data type="boolean"/>
206
206
  </attribute>
207
207
  </optional>
208
+ <optional>
209
+ <attribute name="style">
210
+ <choice>
211
+ <value>basic</value>
212
+ <value>full</value>
213
+ <value>short</value>
214
+ </choice>
215
+ </attribute>
216
+ </optional>
208
217
  <ref name="XrefBody"/>
209
218
  </element>
210
219
  </define>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.1.8.1".freeze
3
+ VERSION = "2.1.10".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.10
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-10-10 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