metanorma-itu 2.5.6 → 2.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/base_convert.rb +12 -30
  3. data/lib/isodoc/itu/cleanup.rb +1 -1
  4. data/lib/isodoc/itu/i18n-ar.yaml +2 -2
  5. data/lib/isodoc/itu/i18n-de.yaml +2 -2
  6. data/lib/isodoc/itu/i18n-en.yaml +2 -2
  7. data/lib/isodoc/itu/i18n-es.yaml +2 -2
  8. data/lib/isodoc/itu/i18n-fr.yaml +2 -2
  9. data/lib/isodoc/itu/i18n-ru.yaml +2 -2
  10. data/lib/isodoc/itu/i18n-zh-Hans.yaml +2 -2
  11. data/lib/isodoc/itu/init.rb +2 -2
  12. data/lib/isodoc/itu/itu.implementers-guide.xsl +727 -196
  13. data/lib/isodoc/itu/itu.in-force.xsl +727 -196
  14. data/lib/isodoc/itu/itu.recommendation-annex.xsl +727 -196
  15. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +727 -196
  16. data/lib/isodoc/itu/itu.recommendation.xsl +727 -196
  17. data/lib/isodoc/itu/itu.resolution.xsl +727 -196
  18. data/lib/isodoc/itu/itu.service-publication.xsl +727 -196
  19. data/lib/isodoc/itu/itu.technical-paper.xsl +727 -196
  20. data/lib/isodoc/itu/itu.technical-report.xsl +727 -196
  21. data/lib/isodoc/itu/presentation_contribution.rb +1 -0
  22. data/lib/isodoc/itu/presentation_preface.rb +2 -1
  23. data/lib/isodoc/itu/presentation_ref.rb +29 -2
  24. data/lib/isodoc/itu/presentation_xml_convert.rb +85 -25
  25. data/lib/isodoc/itu/ref.rb +5 -33
  26. data/lib/isodoc/itu/terms.rb +4 -17
  27. data/lib/isodoc/itu/word_cleanup.rb +2 -2
  28. data/lib/isodoc/itu/word_convert.rb +5 -5
  29. data/lib/isodoc/itu/xref.rb +47 -17
  30. data/lib/isodoc/itu/xref_section.rb +42 -20
  31. data/lib/metanorma/itu/biblio.rng +13 -1
  32. data/lib/metanorma/itu/isodoc.rng +6 -6
  33. data/lib/metanorma/itu/version.rb +1 -1
  34. data/lib/nokogiri/xml.rb +10 -0
  35. data/metanorma-itu.gemspec +1 -1
  36. metadata +5 -4
@@ -74,6 +74,7 @@ module IsoDoc
74
74
  x = clause.at(ns("./clause[@type = '#{type}']")) or return
75
75
  ret = x.dup
76
76
  ret.at(ns("./title"))&.remove
77
+ ret.at(ns("./fmt-title"))&.remove
77
78
  ret.children.to_xml
78
79
  end
79
80
 
@@ -85,6 +85,7 @@ module IsoDoc
85
85
  abstract or return
86
86
  @doctype == "contribution" or return
87
87
  abstract.at(ns("./title"))&.remove
88
+ abstract.at(ns("./fmt-title"))&.remove
88
89
  abstract.children = <<~TABLE
89
90
  <table class="abstract" unnumbered="true" width="100%">
90
91
  <colgroup><col width="11.8%"/><col width="78.2%"/></colgroup>
@@ -98,7 +99,7 @@ module IsoDoc
98
99
  def keywords(_docxml)
99
100
  kw = @meta.get[:keywords]
100
101
  kw.nil? || kw.empty? || @doctype == "contribution" and return
101
- "<clause type='keyword'><title>#{@i18n.keywords}</title>" \
102
+ "<clause type='keyword'><fmt-title>#{@i18n.keywords}</fmt-title>" \
102
103
  "<p>#{@i18n.l10n(kw.join(', '))}.</p>"
103
104
  end
104
105
 
@@ -11,7 +11,7 @@ module IsoDoc
11
11
  def bibrender_formattedref(formattedref, _xml)
12
12
  formattedref << "." unless /\.$/.match?(formattedref.text)
13
13
  id = reference_format_start(formattedref.parent) and
14
- formattedref.children.first.previous = id
14
+ formattedref.add_first_child id
15
15
  end
16
16
 
17
17
  def bibrender_relaton(xml, renderings)
@@ -73,7 +73,7 @@ module IsoDoc
73
73
  end
74
74
 
75
75
  def bibliography_bibitem_number_skip(bibitem)
76
- @xrefs.klass.implicit_reference(bibitem) ||
76
+ implicit_reference(bibitem) ||
77
77
  bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
78
78
  end
79
79
 
@@ -92,6 +92,33 @@ module IsoDoc
92
92
  ret.empty? and return ret
93
93
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
94
94
  end
95
+
96
+ def bracket_if_num(num)
97
+ return nil if num.nil?
98
+
99
+ num = num.text.sub(/^\[/, "").sub(/\]$/, "")
100
+ "[#{num}]"
101
+ end
102
+
103
+ def pref_ref_code(bibitem)
104
+ ret = bibitem.xpath(ns("./docidentifier[@type = 'ITU']"))
105
+ ret.empty? and ret = super
106
+ ret
107
+ end
108
+
109
+ def unbracket(ident)
110
+ if ident.respond_to?(:size)
111
+ ident.map { |x| unbracket1(x) }.join("&#xA0;| ")
112
+ else
113
+ unbracket1(ident)
114
+ end
115
+ end
116
+
117
+ def reference_name(ref)
118
+ super
119
+ @xrefs.get[ref["id"]] =
120
+ { xref: @xrefs.get[ref["id"]][:xref].sub(/^\[/, "").sub(/\]$/, "") }
121
+ end
95
122
  end
96
123
  end
97
124
  end
@@ -6,17 +6,7 @@ require_relative "presentation_bibdata"
6
6
  require_relative "presentation_preface"
7
7
  require_relative "presentation_ref"
8
8
  require_relative "presentation_contribution"
9
-
10
- module Nokogiri
11
- module XML
12
- class Node
13
- def traverse_topdown(&block)
14
- yield(self)
15
- children.each { |j| j.traverse_topdown(&block) }
16
- end
17
- end
18
- end
19
- end
9
+ require_relative "../../nokogiri/xml"
20
10
 
21
11
  module IsoDoc
22
12
  module Itu
@@ -31,11 +21,33 @@ module IsoDoc
31
21
  end
32
22
 
33
23
  def origin(docxml)
34
- docxml.xpath(ns("//origin[not(termref)]")).each { |f| eref1(f) }
24
+ docxml.xpath(ns("//origin[not(termref)]")).each do |f|
25
+ f["citeas"] = bracket_opt(f["citeas"])
26
+ eref1(f)
27
+ end
35
28
  end
36
29
 
37
30
  def quotesource(docxml)
38
- docxml.xpath(ns("//quote/source")).each { |f| eref1(f) }
31
+ docxml.xpath(ns("//quote//source")).each { |f| eref1(f) }
32
+ end
33
+
34
+ def bracket_opt(text)
35
+ text.nil? and return
36
+ /^\[.+\]$/.match?(text) and return text
37
+ "[#{text}]"
38
+ end
39
+
40
+ def designation1(desgn)
41
+ super
42
+ desgn.name == "preferred" or return
43
+ desgn.children = l10n "#{to_xml desgn.children}:"
44
+ end
45
+
46
+ def termsource1(elem)
47
+ while elem&.next_element&.name == "termsource"
48
+ elem << "; #{to_xml(elem.next_element.remove.children)}"
49
+ end
50
+ elem.children = l10n(to_xml(elem.children).strip)
39
51
  end
40
52
 
41
53
  def eref1(elem)
@@ -47,11 +59,21 @@ module IsoDoc
47
59
  super
48
60
  end
49
61
 
62
+ def note_delim(elem)
63
+ if elem.at(ns("./*[local-name() != 'name'][1]"))&.name == "p"
64
+ "\u00a0\u2013\u00a0"
65
+ else ""
66
+ end
67
+ end
68
+
50
69
  def table1(elem)
51
- elem.xpath(ns("./name | ./thead/tr/th")).each do |n|
70
+ elem.xpath(ns("./thead/tr/th")).each do |n|
52
71
  capitalise_unless_text_transform(n)
53
72
  end
54
73
  super
74
+ elem.xpath(ns("./fmt-name//semx[@element = 'name']")).each do |n|
75
+ capitalise_unless_text_transform(n)
76
+ end
55
77
  end
56
78
 
57
79
  def capitalise_unless_text_transform(elem)
@@ -66,6 +88,10 @@ module IsoDoc
66
88
  end
67
89
  end
68
90
 
91
+ def table_fn1(_table, fnote, _idx)
92
+ fnote["reference"] += ")"
93
+ end
94
+
69
95
  def get_eref_linkend(node)
70
96
  non_locality_elems(node).select do |c|
71
97
  !c.text? || /\S/.match(c)
@@ -87,33 +113,67 @@ module IsoDoc
87
113
  { group: "'" }
88
114
  end
89
115
 
90
- def clause1(elem)
116
+ # KILL
117
+ def clause1x(elem)
91
118
  clause1_super?(elem) and return super
92
119
  @suppressheadingnumbers || elem["unnumbered"] and return
93
120
  t = elem.at(ns("./title")) and t["depth"] = "1"
94
- lbl = @xrefs.anchor(elem["id"], :label, false) or return
121
+ lbl = @xrefs.anchor(elem["id"], :label, false)
122
+ lbl.blank? and return
95
123
  elem.previous =
96
124
  "<p keep-with-next='true' class='supertitle'>" \
97
125
  "#{@i18n.get['section'].upcase} #{lbl}</p>"
98
126
  end
99
127
 
128
+ def clause1(elem)
129
+ clause1_super?(elem) and return super
130
+ lbl = @xrefs.anchor(elem["id"], :label, false)
131
+ oldsuppressheadingnumbers = @suppressheadingnumbers
132
+ @suppressheadingnumbers = true
133
+ super
134
+ @suppressheadingnumbers = oldsuppressheadingnumbers
135
+ lbl.blank? || elem["unnumbered"] and return
136
+ elem.previous =
137
+ "<p keep-with-next='true' class='supertitle'>" \
138
+ "#{labelled_autonum(@i18n.get['section'].upcase, elem["id"], lbl)}</p>"
139
+ #"<span element='fmt-element-name'>#{@i18n.get['section'].upcase}</span> #{autonum(elem['id'], lbl)}</p>"
140
+ end
141
+
100
142
  def clause1_super?(elem)
101
143
  @doctype != "resolution" ||
102
144
  !%w(sections bibliography).include?(elem.parent.name)
103
145
  end
104
146
 
105
147
  def annex1(elem)
106
- @doctype == "resolution" or return super
148
+ if @doctype == "resolution"
149
+ annex1_resolution(elem)
150
+ else
151
+ super
152
+ annex1_non_resolution(elem)
153
+ end
154
+ end
155
+
156
+ def annex1_resolution(elem)
107
157
  elem.elements.first.previous = annex1_supertitle(elem)
158
+ # TODO: do not alter title, alter semx/@element = title
108
159
  t = elem.at(ns("./title")) and
109
160
  t.children = "<strong>#{to_xml(t.children)}</strong>"
161
+ prefix_name(elem, {}, nil, "title")
162
+ end
163
+
164
+ def annex1_non_resolution(elem)
165
+ info = elem["obligation"] == "informative"
166
+ ins = elem.at(ns("./fmt-xref-label")) || elem.at(ns("./fmt-title"))
167
+ p = (info ? @i18n.inform_annex : @i18n.norm_annex)
168
+ .sub("%", @i18n.doctype_dict[@meta.get[:doctype_original]] || "")
169
+ ins.next = %(<p class="annex_obligation"><span class='fmt-obligation'>#{p}</span></p>)
110
170
  end
111
171
 
112
172
  def annex1_supertitle(elem)
113
173
  lbl = @xrefs.anchor(elem["id"], :label)
114
174
  res = elem.at(ns("//bibdata/title[@type = 'resolution']"))
115
175
  subhead = @i18n.l10n("(#{@i18n.get['to']} #{to_xml(res.children)})")
116
- "<p class='supertitle'>#{lbl}<br/>#{subhead}</p>"
176
+ "<p class='supertitle'>#{autonum(elem['id'], lbl)}<br/>#{subhead}</p>"
117
177
  end
118
178
 
119
179
  def ol_depth(node)
@@ -189,25 +249,25 @@ module IsoDoc
189
249
  ret
190
250
  end
191
251
 
192
- def block(docxml)
193
- super
194
- dl docxml
195
- end
196
-
197
252
  def dl(xml)
253
+ super
198
254
  (xml.xpath(ns("//dl")) -
199
255
  xml.xpath(ns("//table//dl | //figure//dl | //formula//dl")))
200
256
  .each do |d|
201
- dl1(d)
257
+ dl2(d)
202
258
  end
203
259
  end
204
260
 
205
- def dl1(dlist)
261
+ def dl2(dlist)
206
262
  ins = dlist.at(ns("./dt"))
207
263
  ins.previous =
208
264
  '<colgroup><col width="20%"/><col width="80%"/></colgroup>'
209
265
  end
210
266
 
267
+ def termnote_delim(_elem)
268
+ " &#x2013; "
269
+ end
270
+
211
271
  include Init
212
272
  end
213
273
  end
@@ -5,7 +5,7 @@ require "fileutils"
5
5
  module IsoDoc
6
6
  module Itu
7
7
  module BaseConvert
8
- def nonstd_bibitem(list, bibitem, _ordinal, biblio)
8
+ def bibitem_entry(list, bibitem, _ordinal, biblio)
9
9
  list.tr **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
10
10
  ref.td style: "vertical-align:top" do |td|
11
11
  tag = bibitem.at(ns("./biblio-tag"))
@@ -15,52 +15,24 @@ module IsoDoc
15
15
  end
16
16
  end
17
17
 
18
- def std_bibitem_entry(list, bibitem, ordinal, biblio)
19
- nonstd_bibitem(list, bibitem, ordinal, biblio)
20
- end
21
-
22
18
  def biblio_list(clause, div, biblio)
23
19
  div.table class: "biblio", border: "0" do |t|
24
20
  i = 0
25
21
  t.tbody do |tbody|
26
22
  clause.elements.each do |b|
27
23
  if b.name == "bibitem"
28
- next if implicit_reference(b)
29
-
24
+ b["hidden"] == "true" and next
30
25
  i += 1
31
- nonstd_bibitem(tbody, b, i, biblio)
26
+ bibitem_entry(tbody, b, i, biblio)
32
27
  else
33
- unless %w(title clause references).include? b.name
28
+ unless %w(title clause references fmt-title fmt-xref-label).include? b.name
34
29
  tbody.tx { |tx| parse(b, tx) }
35
30
  end
36
31
  end
37
32
  end
38
33
  end
39
34
  end
40
- clause.xpath(ns("./clause | ./references")).each do |x|
41
- parse(x, div)
42
- end
43
- end
44
-
45
- def bracket_if_num(num)
46
- return nil if num.nil?
47
-
48
- num = num.text.sub(/^\[/, "").sub(/\]$/, "")
49
- "[#{num}]"
50
- end
51
-
52
- def pref_ref_code(bibitem)
53
- ret = bibitem.xpath(ns("./docidentifier[@type = 'ITU']"))
54
- ret.empty? and ret = super
55
- ret
56
- end
57
-
58
- def unbracket(ident)
59
- if ident.respond_to?(:size)
60
- ident.map { |x| unbracket1(x) }.join("&#xA0;| ")
61
- else
62
- unbracket1(ident)
63
- end
35
+ clause.xpath(ns("./clause | ./references")).each { |x| parse(x, div) }
64
36
  end
65
37
  end
66
38
  end
@@ -4,12 +4,11 @@ module IsoDoc
4
4
  def termdef_parse1(node, div, defn, source)
5
5
  div.p **{ class: "TermNum", id: node["id"] } do |p|
6
6
  p.b do |b|
7
- node&.at(ns("./name"))&.children&.each { |n| parse(n, b) }
7
+ node&.at(ns("./fmt-name"))&.children&.each { |n| parse(n, b) }
8
8
  insert_tab(b, 1)
9
9
  node&.at(ns("./preferred"))&.children&.each { |n| parse(n, b) }
10
10
  end
11
- p << ": "
12
- source and p << "#{bracket_opt(source.value)} "
11
+ source and p << "#{source.value} "
13
12
  end
14
13
  defn&.children&.each { |n| parse(n, div) }
15
14
  end
@@ -19,26 +18,14 @@ module IsoDoc
19
18
  source = node.at(ns("./termsource/origin/@citeas"))
20
19
  out.div **attr_code(id: node["id"]) do |div|
21
20
  termdef_parse1(node, div, defn, source)
22
- set_termdomain("")
23
21
  node.children.each do |n|
24
- next if %w(preferred definition termsource title
25
- name).include? n.name
22
+ next if %w(preferred definition termsource fmt-title
23
+ fmt-name).include? n.name
26
24
 
27
25
  parse(n, out)
28
26
  end
29
27
  end
30
28
  end
31
-
32
- def bracket_opt(text)
33
- return text if text.nil?
34
- return text if /^\[.+\]$/.match?(text)
35
-
36
- "[#{text}]"
37
- end
38
-
39
- def termnote_delim
40
- " &#x2013; "
41
- end
42
29
  end
43
30
  end
44
31
  end
@@ -25,8 +25,8 @@ module IsoDoc
25
25
 
26
26
  def word_footnote_cleanup(docxml)
27
27
  docxml.xpath("//aside").each do |a|
28
- a.first_element_child.children.first.previous =
29
- '<span style="mso-tab-count:1"/>'
28
+ a.first_element_child.
29
+ add_first_child '<span style="mso-tab-count:1"/>'
30
30
  end
31
31
  end
32
32
 
@@ -39,7 +39,7 @@ module IsoDoc
39
39
  out.div **attr_code(id: clause["id"], class: "Abstract") do |s|
40
40
  @doctype == "contribution" or
41
41
  clause_name(clause, "Summary", s, class: "AbstractTitle")
42
- clause.elements.each { |e| parse(e, s) unless e.name == "title" }
42
+ clause.elements.each { |e| parse(e, s) unless e.name == "fmt-title" }
43
43
  end
44
44
  end
45
45
 
@@ -48,9 +48,9 @@ module IsoDoc
48
48
  div.p **attr_code(class: "formula") do |_p|
49
49
  insert_tab(div, 1)
50
50
  parse(node.at(ns("./stem")), div)
51
- if lbl = node&.at(ns("./name"))&.text
51
+ if lbl = node&.at(ns("./fmt-name"))&.text
52
52
  insert_tab(div, 1)
53
- div << "(#{lbl})"
53
+ div << lbl
54
54
  end
55
55
  end
56
56
  end
@@ -127,7 +127,7 @@ module IsoDoc
127
127
  page_break(out)
128
128
  out.div **attr_code(preface_attrs(clause)) do |div|
129
129
  div.p class: "zzContents" do |p|
130
- clause.at(ns("./title"))&.children&.each do |c|
130
+ clause.at(ns("./fmt-title"))&.children&.each do |c|
131
131
  parse(c, p)
132
132
  end
133
133
  end
@@ -136,7 +136,7 @@ module IsoDoc
136
136
  p << "<b>#{@i18n.page}</b>"
137
137
  end
138
138
  clause.elements.each do |e|
139
- parse(e, div) unless e.name == "title"
139
+ parse(e, div) unless e.name == "fmt-title"
140
140
  end
141
141
  end
142
142
  end
@@ -48,11 +48,16 @@ module IsoDoc
48
48
  end
49
49
 
50
50
  def subfigure_label(subfignum)
51
- subfignum.zero? and return ""
52
- "-#{(subfignum + 96).chr}"
51
+ subfignum.zero? and return
52
+ (subfignum + 96).chr
53
53
  end
54
54
 
55
- def sequential_figure_body(subfig, counter, elem, klass, container: false)
55
+ def subfigure_delim
56
+ ")"
57
+ end
58
+
59
+ # KILL
60
+ def sequential_figure_bodyx(subfig, counter, elem, klass, container: false)
56
61
  label = counter.print
57
62
  label &&= label + subfigure_label(subfig)
58
63
  @anchors[elem["id"]] = anchor_struct(
@@ -61,8 +66,39 @@ module IsoDoc
61
66
  )
62
67
  end
63
68
 
64
- def hierarchical_figure_body(num, subfignum, counter, block, klass)
65
- label = "#{num}#{hiersep}#{counter.print}" + subfigure_label(subfignum)
69
+ def figure_anchor(elem, sublabel, label, klass, container: false)
70
+ if sublabel
71
+ subfigure_anchor(elem, sublabel, label, klass, container: false)
72
+ else
73
+ @anchors[elem["id"]] = anchor_struct(
74
+ label, elem, @labels[klass] || klass.capitalize, klass,
75
+ { unnumb: elem["unnumbered"], container: }
76
+ )
77
+ end
78
+ end
79
+
80
+ def fig_subfig_label(label, sublabel)
81
+ "#{label}#{delim_wrap("-")}#{sublabel}"
82
+ end
83
+
84
+ def subfigure_anchor(elem, sublabel, label, klass, container: false)
85
+ figlabel = fig_subfig_label(semx(elem.parent, label), semx(elem, sublabel))
86
+ @anchors[elem["id"]] = anchor_struct(
87
+ figlabel, elem, @labels[klass] || klass.capitalize, klass,
88
+ { unnumb: elem["unnumbered"] }
89
+ )
90
+ if elem["unnumbered"] != "true"
91
+ #@anchors[elem["id"]][:label] = sublabel
92
+ @anchors[elem["id"]][:xref] = @anchors[elem.parent["id"]][:xref] +
93
+ delim_wrap("-") + semx(elem, sublabel)
94
+ x = @anchors[elem.parent["id"]][:container] and
95
+ @anchors[elem["id"]][:container] = x
96
+ end
97
+ end
98
+
99
+ # KILL
100
+ def hierarchical_figure_bodyx(num, subfignum, counter, block, klass)
101
+ label = "#{num}#{hier_separator}#{counter.print}" + subfigure_label(subfignum)
66
102
  @anchors[block["id"]] = anchor_struct(
67
103
  label, nil, @labels[klass] || klass.capitalize,
68
104
  klass, block["unnumbered"]
@@ -84,29 +120,23 @@ module IsoDoc
84
120
  c = Counter.new
85
121
  clause.xpath(ns(".//formula")).noblank.each do |t|
86
122
  @anchors[t["id"]] = anchor_struct(
87
- "#{num}-#{c.increment(t).print}", nil,
123
+ "#{semx(clause, num)}#{delim_wrap("-")}#{semx(t, c.increment(t).print)}", t,
88
124
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
89
- "formula", t["unnumbered"]
125
+ "formula", { unnumb:t["unnumbered"] }
90
126
  )
91
127
  end
92
128
  end
93
129
 
94
- def reference_names(ref)
95
- super
96
- @anchors[ref["id"]] =
97
- { xref: @anchors[ref["id"]][:xref].sub(/^\[/, "").sub(/\]$/, "") }
98
- end
99
-
100
130
  def termnote_anchor_names(docxml)
101
131
  docxml.xpath(ns("//term[termnote]")).each do |t|
102
132
  c = Counter.new
103
133
  notes = t.xpath(ns("./termnote"))
104
134
  notes.noblank.each do |n|
105
- idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
135
+ idx = notes.size == 1 ? "" : c.increment(n).print
136
+ idx.blank? or notenum = " #{semx(n, idx)}"
106
137
  @anchors[n["id"]] =
107
- { label: termnote_label(idx).strip, type: "termnote", value: idx,
108
- xref: l10n("#{anchor(t['id'], :xref)},
109
- #{@labels['note_xref']} #{c.print}") }
138
+ { label: termnote_label(n, idx).strip, type: "termnote", value: idx,
139
+ xref: l10n("#{semx(t, anchor(t['id'], :xref))}<span class='fmt-comma'>,</span> <span class='fmt-element-name'>#{@labels['note_xref']}</span>#{notenum}") }
110
140
  end
111
141
  end
112
142
  end
@@ -44,9 +44,9 @@ module IsoDoc
44
44
  def annex_name_lbl(clause, num)
45
45
  lbl = annextype(clause)
46
46
  if @doctype == "resolution"
47
- l10n("#{lbl.upcase} #{num}")
47
+ l10n("<span class='fmt-element-name'>#{lbl.upcase}</span> #{semx(clause, num)}")
48
48
  else
49
- l10n("<strong>#{lbl} #{num}</strong>")
49
+ l10n("<strong><span class='fmt-caption-label'><span class='fmt-element-name'>#{lbl}</span> #{semx(clause, num)}</span></strong>")
50
50
  end
51
51
  end
52
52
 
@@ -56,21 +56,35 @@ module IsoDoc
56
56
  { label: annex_name_lbl(clause, num),
57
57
  elem: lbl,
58
58
  type: "clause", value: num.to_s, level: level,
59
- xref: l10n("#{lbl} #{num}") }
59
+ #xref: l10n("#{lbl} #{num}") }
60
+ xref: labelled_autonum(lbl, num)
61
+ }
60
62
  end
61
63
 
62
- def annex_names1(clause, num, level)
64
+ # KILL
65
+ def annex_names1x(clause, parentnum, num, level)
66
+ lbl = clause_number_semx(parentnum, clause, num)
67
+ #require 'debug'; binding.b
63
68
  @anchors[clause["id"]] =
64
- { label: num, elem: @labels["annex_subclause"],
65
- xref: @doctype == "resolution" ? num : l10n("#{@labels['annex_subclause']} #{num}"),
69
+ { label: lbl, elem: @labels["annex_subclause"],
70
+ xref: @doctype == "resolution" ? lbl : labelled_autonum(@labels['annex_subclause'], lbl), # l10n("#{@labels['annex_subclause']} #{num}"),
66
71
  level: level, type: "clause" }
67
- i = Counter.new(0, prefix: num)
72
+ i = Counter.new(0)
68
73
  clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
69
74
  .each do |c|
70
- annex_names1(c, i.increment(c).print, level + 1)
75
+ #require 'debug'; binding.b
76
+ annex_names1(c, lbl, i.increment(c).print, level + 1)
71
77
  end
72
78
  end
73
79
 
80
+ def annex_name_anchors1(clause, lbl, level)
81
+ xref = labelled_autonum(@labels['annex_subclause'], lbl)
82
+ @doctype == "resolution" and xref = lbl
83
+ @anchors[clause["id"]] =
84
+ { label: lbl, elem: @labels["annex_subclause"],
85
+ xref: xref, level: level, type: "clause" }
86
+ end
87
+
74
88
  def main_anchor_names(xml)
75
89
  n = Counter.new
76
90
  clause_order_main(xml).each do |a|
@@ -88,26 +102,28 @@ module IsoDoc
88
102
  )
89
103
 
90
104
  num.increment(clause)
91
- lbl = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
105
+ elem = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
106
+ lbl = semx(clause, num.print)
92
107
  @anchors[clause["id"]] =
93
- { label: num.print, xref: l10n("#{lbl} #{num.print}"),
94
- level: lvl, type: "clause", elem: lbl }
95
- i = Counter.new(0, prefix: num.print)
108
+ { label: lbl, xref: labelled_autonum(elem, lbl),# l10n("#{lbl} #{num.print}"),
109
+ level: lvl, type: "clause", elem: elem }
110
+ i = Counter.new(0)
96
111
  clause.xpath(ns(SUBCLAUSES)).each do |c|
97
- section_names1(c, i.increment(c).print, lvl + 1)
112
+ section_names1(c, lbl, i.increment(c).print, lvl + 1)
98
113
  end
99
114
  num
100
115
  end
101
116
 
102
- def section_names1(clause, num, level)
103
- x = @doctype == "resolution" ? num : l10n("#{@labels['clause']} #{num}")
117
+ def section_names1(clause, parentnum, num, level)
118
+ lbl = clause_number_semx(parentnum, clause, num)
119
+ x = @doctype == "resolution" ? semx(clause, lbl) : labelled_autonum(@labels['clause'], lbl) #l10n("#{@labels['clause']} #{num}")
104
120
  @anchors[clause["id"]] =
105
- { label: num, level: level,
121
+ { label: lbl, level: level,
106
122
  elem: @doctype == "resolution" ? "" : @labels["clause"],
107
123
  xref: x }
108
- i = Counter.new(0, prefix: num)
124
+ i = Counter.new(0)
109
125
  clause.xpath(ns(SUBCLAUSES)).each do |c|
110
- section_names1(c, i.increment(c).print, level + 1)
126
+ section_names1(c, lbl, i.increment(c).print, level + 1)
111
127
  end
112
128
  end
113
129
 
@@ -115,7 +131,10 @@ module IsoDoc
115
131
  clause.nil? and return
116
132
  lbl = clause.at(ns("./title"))&.text || "[#{clause['id']}]"
117
133
  @anchors[clause["id"]] =
118
- { label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl,
134
+ { label: lbl,
135
+ # xref: l10n(%{"#{lbl}"}),
136
+ xref: semx(clause, lbl),
137
+ level: lvl,
119
138
  type: "clause" }
120
139
  clause.xpath(ns(SUBCLAUSES)).each do |c|
121
140
  unnumbered_section_names1(c, lvl + 1)
@@ -125,7 +144,10 @@ module IsoDoc
125
144
  def unnumbered_section_names1(clause, level)
126
145
  lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
127
146
  @anchors[clause["id"]] =
128
- { label: lbl, xref: l10n(%{"#{lbl}"}), level: level,
147
+ { label: lbl,
148
+ #xref: l10n(%{"#{lbl}"}),
149
+ xref: semx(clause, lbl),
150
+ level: level,
129
151
  type: "clause" }
130
152
  clause.xpath(ns(SUBCLAUSES)).each do |c|
131
153
  unnumbered_section_names1(c, level + 1)
@@ -1783,9 +1783,21 @@ that the `number` given for the series applies to the second iteration of number
1783
1783
  May be used to differentiate rendering of notes in bibliographies</a:documentation>
1784
1784
  </attribute>
1785
1785
  </optional>
1786
- <ref name="LocalizedMarkedUpString">
1786
+ <ref name="LocalizedStringAttributes">
1787
1787
  <a:documentation>The content of the note</a:documentation>
1788
1788
  </ref>
1789
+ <choice>
1790
+ <oneOrMore>
1791
+ <ref name="BasicBlockNoId">
1792
+ <a:documentation>Multiple blocks of content</a:documentation>
1793
+ </ref>
1794
+ </oneOrMore>
1795
+ <oneOrMore>
1796
+ <ref name="TextElement">
1797
+ <a:documentation>Single block of content</a:documentation>
1798
+ </ref>
1799
+ </oneOrMore>
1800
+ </choice>
1789
1801
  </element>
1790
1802
  </define>
1791
1803
  <define name="bibabstract">