metanorma-itu 1.2.9 → 1.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +11 -22
- data/.rubocop.yml +0 -4
- data/lib/asciidoctor/itu/basicdoc.rng +20 -3
- data/lib/asciidoctor/itu/boilerplate.xml +5 -2
- data/lib/asciidoctor/itu/cleanup.rb +9 -0
- data/lib/asciidoctor/itu/converter.rb +2 -1
- data/lib/asciidoctor/itu/front.rb +19 -20
- data/lib/asciidoctor/itu/isodoc.rng +118 -4
- data/lib/asciidoctor/itu/itu.rng +76 -0
- data/lib/asciidoctor/itu/validate.rb +13 -5
- data/lib/isodoc/itu/base_convert.rb +70 -52
- data/lib/isodoc/itu/cleanup.rb +55 -0
- data/lib/isodoc/itu/html/header.html +12 -8
- data/lib/isodoc/itu/html/html_itu_intro.html +1 -1
- data/lib/isodoc/itu/html/html_itu_titlepage.html +15 -3
- data/lib/isodoc/itu/html/htmlstyle.css +59 -12
- data/lib/isodoc/itu/html/htmlstyle.scss +26 -5
- data/lib/isodoc/itu/html/word_itu_intro.html +8 -2
- data/lib/isodoc/itu/html/word_itu_titlepage.html +29 -6
- data/lib/isodoc/itu/html/wordstyle.css +34 -0
- data/lib/isodoc/itu/html/wordstyle.scss +33 -0
- data/lib/isodoc/itu/html_convert.rb +2 -2
- data/lib/isodoc/itu/i18n-en.yaml +4 -0
- data/lib/isodoc/itu/itu.implementers-guide.xsl +5705 -0
- data/lib/isodoc/itu/itu.in-force.xsl +5705 -0
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +897 -376
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +5705 -0
- data/lib/isodoc/itu/itu.recommendation.xsl +897 -376
- data/lib/isodoc/itu/itu.resolution.xsl +897 -376
- data/lib/isodoc/itu/itu.technical-paper.xsl +897 -376
- data/lib/isodoc/itu/itu.technical-report.xsl +897 -376
- data/lib/isodoc/itu/metadata.rb +41 -7
- data/lib/isodoc/itu/pdf_convert.rb +5 -8
- data/lib/isodoc/itu/presentation_xml_convert.rb +49 -3
- data/lib/isodoc/itu/word_convert.rb +2 -2
- data/lib/isodoc/itu/xref.rb +101 -43
- data/lib/metanorma/itu/processor.rb +11 -0
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +2 -2
- metadata +11 -8
- data/lib/metanorma/itu/fonts_manifest.yaml +0 -4
data/lib/isodoc/itu/metadata.rb
CHANGED
@@ -149,21 +149,55 @@ module IsoDoc
|
|
149
149
|
def ddMMMYYYY(isodate)
|
150
150
|
m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match isodate
|
151
151
|
return isodate unless m && m[:yr] && m[:mo] && m[:dd]
|
152
|
-
mmm = DateTime.parse(isodate).localize(@lang.to_sym)
|
153
|
-
to_additional_s("MMM")
|
152
|
+
mmm = DateTime.parse(isodate).localize(@lang.to_sym).to_additional_s("MMM")
|
154
153
|
@i18n.l10n("#{m[:dd]} #{mmm} #{m[:yr]}")
|
155
154
|
end
|
156
155
|
|
156
|
+
def ddMMMMYYYY(date1, date2)
|
157
|
+
m1 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date1
|
158
|
+
m2 = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match date2
|
159
|
+
if m1 && m1[:yr] && m1[:mo] && m1[:dd]
|
160
|
+
dd1 = m1[:dd].sub(/^0/, "")
|
161
|
+
if m2 && m2[:yr] && m2[:mo] && m2[:dd]
|
162
|
+
dd2 = m2[:dd].sub(/^0/, "")
|
163
|
+
if m1[:yr] == m2[:yr]
|
164
|
+
if m1[:mo] == m2[:mo]
|
165
|
+
@i18n.l10n("#{dd1}–#{dd2} #{months[m1[:mo].to_sym]} #{m1[:yr]}")
|
166
|
+
else
|
167
|
+
@i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} – "\
|
168
|
+
"#{dd2} #{months[m2[:mo].to_sym]} #{m1[:yr]}")
|
169
|
+
end
|
170
|
+
else
|
171
|
+
@i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]} – "\
|
172
|
+
"#{dd2} #{months[m2[:mo].to_sym]} #{m2[:yr]}")
|
173
|
+
end
|
174
|
+
else
|
175
|
+
date2.nil? ? @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]}") : "#{date1}/#{date2}"
|
176
|
+
end
|
177
|
+
else
|
178
|
+
date2.nil? ? date1 : "#{date1}/#{date2}"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
157
182
|
def techreport(isoxml, _out)
|
158
|
-
a = isoxml&.at(ns("//bibdata/ext/meeting"))&.text
|
159
|
-
|
160
|
-
set(:
|
183
|
+
if a = isoxml&.at(ns("//bibdata/ext/meeting"))&.text
|
184
|
+
set(:meeting, a)
|
185
|
+
set(:meeting_acronym, a)
|
186
|
+
end
|
187
|
+
a = isoxml&.at(ns("//bibdata/ext/meeting/@acronym"))&.text and set(:meeting_acronym, a)
|
188
|
+
a = isoxml&.at(ns("//bibdata/ext/meeting-place"))&.text and set(:meeting_place, a)
|
189
|
+
a = isoxml&.at(ns("//bibdata/ext/intended-type"))&.text and set(:intended_type, a)
|
161
190
|
a = isoxml&.at(ns("//bibdata/ext/source"))&.text and set(:source, a)
|
191
|
+
meeting(isoxml)
|
192
|
+
end
|
193
|
+
|
194
|
+
def meeting(isoxml)
|
195
|
+
resolution = isoxml&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
162
196
|
if o = isoxml&.at(ns("//bibdata/ext/meeting-date/on"))&.text
|
163
|
-
set(:meeting_date, ddMMMYYYY(o))
|
197
|
+
set(:meeting_date, resolution ? ddMMMMYYYY(o, nil) : ddMMMYYYY(o))
|
164
198
|
elsif f = isoxml&.at(ns("//bibdata/ext/meeting-date/from"))&.text
|
165
199
|
t = isoxml&.at(ns("//bibdata/ext/meeting-date/to"))&.text
|
166
|
-
set(:meeting_date, "#{ddMMMYYYY(f)}/#{ddMMMYYYY(t)}")
|
200
|
+
set(:meeting_date, resolution ? ddMMMMYYYY(f, t) : "#{ddMMMYYYY(f)}/#{ddMMMYYYY(t)}")
|
167
201
|
end
|
168
202
|
end
|
169
203
|
end
|
@@ -13,14 +13,11 @@ module IsoDoc
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def pdf_stylesheet(docxml)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
else
|
22
|
-
"itu.recommendation.xsl"
|
23
|
-
end
|
16
|
+
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
17
|
+
|
18
|
+
"itu.#{doctype}.xsl" if File.exist?(File.join(@libdir, "itu.#{doctype}.xsl"))
|
19
|
+
|
20
|
+
"itu.recommendation.xsl"
|
24
21
|
end
|
25
22
|
end
|
26
23
|
end
|
@@ -36,6 +36,11 @@ module IsoDoc
|
|
36
36
|
get_eref_linkend(f)
|
37
37
|
end
|
38
38
|
|
39
|
+
def note1(f)
|
40
|
+
return if f["type"] == "title-footnote"
|
41
|
+
super
|
42
|
+
end
|
43
|
+
|
39
44
|
def get_eref_linkend(node)
|
40
45
|
contents = non_locality_elems(node).select do |c|
|
41
46
|
!c.text? || /\S/.match(c)
|
@@ -43,8 +48,7 @@ module IsoDoc
|
|
43
48
|
return unless contents.empty?
|
44
49
|
link = anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))
|
45
50
|
link && !/^\[.*\]$/.match(link) and link = "[#{link}]"
|
46
|
-
link += eref_localities(node.xpath(ns("./locality | ./localityStack")),
|
47
|
-
link)
|
51
|
+
link += eref_localities(node.xpath(ns("./locality | ./localityStack")), link)
|
48
52
|
non_locality_elems(node).each { |n| n.remove }
|
49
53
|
node.add_child(link)
|
50
54
|
end
|
@@ -65,7 +69,28 @@ module IsoDoc
|
|
65
69
|
end
|
66
70
|
|
67
71
|
def bibdata_title(b)
|
68
|
-
b&.at(ns("./ext/doctype"))&.text
|
72
|
+
case b&.at(ns("./ext/doctype"))&.text
|
73
|
+
when "service-publication" then bibdata_title_service_population(b)
|
74
|
+
when "resolution" then bibdata_title_resolution(b)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def bibdata_title_resolution(b)
|
79
|
+
num = b&.at(ns("./docnumber"))&.text
|
80
|
+
place = b&.at(ns("./ext/meeting-place"))&.text
|
81
|
+
ed = b&.at(ns("./edition"))&.text
|
82
|
+
rev = (ed && ed != "1") ? "#{@i18n.get["revision_abbreviation"]} " : ""
|
83
|
+
year = b&.at(ns("./ext/meeting-date/from | ./ext/meeting-date/on"))&.text&.gsub(/-.*$/, "")
|
84
|
+
num = b&.at(ns("./docnumber"))&.text
|
85
|
+
text = @i18n.l10n("#{@i18n.get['doctype_dict']['resolution'].upcase} #{num} (#{rev}#{place}, #{year})")
|
86
|
+
ins = b.at(ns("./title"))
|
87
|
+
ins.next = <<~END
|
88
|
+
<title language="#{@lang}" format="text/plain" type="resolution">#{text}</title>
|
89
|
+
<title language="#{@lang}" format="text/plain" type="resolution-placedate">#{place}, #{year}</title>
|
90
|
+
END
|
91
|
+
end
|
92
|
+
|
93
|
+
def bibdata_title_service_population(b)
|
69
94
|
date = b&.at(ns("./date[@type = 'published']"))&.text or return
|
70
95
|
text = l10n(@i18n.get["position_on"].sub(/%/, ddmmmmyyyy(date)))
|
71
96
|
ins = b.at(ns("./title"))
|
@@ -116,6 +141,27 @@ module IsoDoc
|
|
116
141
|
{group: "'"}
|
117
142
|
end
|
118
143
|
|
144
|
+
def clause1(f)
|
145
|
+
return super unless f&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
146
|
+
return super unless %w(sections bibliography).include? f.parent.name
|
147
|
+
return if @suppressheadingnumbers || f["unnumbered"]
|
148
|
+
t = f.at(ns("./title")) and t["depth"] = "1"
|
149
|
+
lbl = @xrefs.anchor(f['id'], :label, false) or return
|
150
|
+
f.elements.first.previous =
|
151
|
+
"<p keep-with-next='true' class='supertitle'>#{@i18n.get['section'].upcase} #{lbl}</p>"
|
152
|
+
end
|
153
|
+
|
154
|
+
def annex1(f)
|
155
|
+
return super unless f&.at(ns("//bibdata/ext/doctype"))&.text == "resolution"
|
156
|
+
lbl = @xrefs.anchor(f['id'], :label)
|
157
|
+
subhead = (@i18n.l10n("(#{@i18n.get['to']} ") +
|
158
|
+
f.at(ns("//bibdata/title[@type = 'resolution']")).children.to_xml + @i18n.l10n(")"))
|
159
|
+
f.elements.first.previous = "<p class='supertitle'>#{lbl}<br/>#{subhead}</p>"
|
160
|
+
if t = f.at(ns("./title"))
|
161
|
+
t.children = "<strong>#{t.children.to_xml}</strong>"
|
162
|
+
end
|
163
|
+
end
|
164
|
+
|
119
165
|
include Init
|
120
166
|
end
|
121
167
|
end
|
@@ -74,9 +74,9 @@ module IsoDoc
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def default_fonts(options)
|
77
|
-
{ bodyfont: (options[:script] == "Hans" ? '"
|
77
|
+
{ bodyfont: (options[:script] == "Hans" ? '"Source Han Sans",serif' :
|
78
78
|
'"Times New Roman",serif'),
|
79
|
-
headerfont: (options[:script] == "Hans" ? '"
|
79
|
+
headerfont: (options[:script] == "Hans" ? '"Source Han Sans",sans-serif' :
|
80
80
|
'"Times New Roman",serif'),
|
81
81
|
monospacefont: '"Courier New",monospace',
|
82
82
|
normalfontsize: "12.0pt",
|
data/lib/isodoc/itu/xref.rb
CHANGED
@@ -3,6 +3,13 @@ require "fileutils"
|
|
3
3
|
|
4
4
|
module IsoDoc
|
5
5
|
module ITU
|
6
|
+
class Counter < IsoDoc::XrefGen::Counter
|
7
|
+
def print
|
8
|
+
super.sub(/([0-9])(bis|ter|quater|quinquies|sexies|septies|octies|nonies)$/,
|
9
|
+
"\\1<em>\\2</em>")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
6
13
|
class Xref < IsoDoc::Xref
|
7
14
|
def initialize(lang, script, klass, labels, options)
|
8
15
|
super
|
@@ -10,23 +17,24 @@ module IsoDoc
|
|
10
17
|
end
|
11
18
|
|
12
19
|
def annex_name_lbl(clause, num)
|
13
|
-
lbl = clause["obligation"] == "informative" ?
|
14
|
-
|
15
|
-
|
20
|
+
lbl = clause["obligation"] == "informative" ? @labels["appendix"] : @labels["annex"]
|
21
|
+
@doctype == "resolution" ? l10n("#{lbl.upcase} #{num}") :
|
22
|
+
l10n("<strong>#{lbl} #{num}</strong>")
|
16
23
|
end
|
17
24
|
|
18
25
|
def annex_names(clause, num)
|
19
26
|
lbl = clause["obligation"] == "informative" ?
|
20
27
|
@labels["appendix"] : @labels["annex"]
|
21
28
|
@anchors[clause["id"]] =
|
22
|
-
{ label: annex_name_lbl(clause, num), type: "clause",
|
23
|
-
xref: l10n("#{lbl} #{num}"), level: 1, value: num }
|
29
|
+
{ label: annex_name_lbl(clause, num), type: "clause", xref: l10n("#{lbl} #{num}"), level: 1, value: num }
|
24
30
|
if a = single_annex_special_section(clause)
|
25
31
|
annex_names1(a, "#{num}", 1)
|
26
32
|
else
|
33
|
+
i = Counter.new
|
27
34
|
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
|
28
|
-
|
29
|
-
|
35
|
+
each do |c|
|
36
|
+
i.increment(c)
|
37
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
30
38
|
end
|
31
39
|
end
|
32
40
|
hierarchical_asset_names(clause, num)
|
@@ -34,42 +42,49 @@ module IsoDoc
|
|
34
42
|
|
35
43
|
def back_anchor_names(docxml)
|
36
44
|
super
|
37
|
-
if annexid =
|
38
|
-
docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
45
|
+
if annexid = docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
39
46
|
docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
|
40
47
|
else
|
48
|
+
i = Counter.new(0, numerals: :roman)
|
41
49
|
docxml.xpath(ns("//annex[@obligation = 'informative']"))
|
42
|
-
.each_with_index do |c
|
43
|
-
|
50
|
+
.each_with_index do |c|
|
51
|
+
i.increment(c)
|
52
|
+
annex_names(c, i.print.upcase)
|
44
53
|
end
|
54
|
+
i = Counter.new("@")
|
45
55
|
docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
|
46
|
-
.
|
47
|
-
|
56
|
+
.each do |c|
|
57
|
+
i.increment(c)
|
58
|
+
i.increment(c) if i.print == "I"
|
59
|
+
annex_names(c, i.print)
|
48
60
|
end
|
49
61
|
end
|
50
62
|
end
|
51
63
|
|
52
64
|
def annex_names1(clause, num, level)
|
53
65
|
@anchors[clause["id"]] =
|
54
|
-
{ label: num, xref: l10n("#{@labels["annex_subclause"]} #{num}"),
|
66
|
+
{ label: num, xref: @doctype == "resolution" ? num : l10n("#{@labels["annex_subclause"]} #{num}"),
|
55
67
|
level: level, type: "clause" }
|
68
|
+
i = Counter.new
|
56
69
|
clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
|
57
|
-
.
|
58
|
-
|
70
|
+
.each do |c|
|
71
|
+
i.increment(c)
|
72
|
+
annex_names1(c, "#{num}.#{i.print}", level + 1)
|
59
73
|
end
|
60
74
|
end
|
61
75
|
|
62
76
|
def initial_anchor_names(d)
|
77
|
+
@doctype = d&.at(ns("//bibdata/ext/doctype"))&.text
|
63
78
|
d.xpath(ns("//boilerplate//clause")).each { |c| preface_names(c) }
|
64
79
|
d.xpath("//xmlns:preface/child::*").each { |c| preface_names(c) }
|
65
80
|
@hierarchical_assets ?
|
66
81
|
hierarchical_asset_names(d.xpath("//xmlns:preface/child::*"),
|
67
82
|
"Preface") :
|
68
83
|
sequential_asset_names(d.xpath("//xmlns:preface/child::*"))
|
69
|
-
n =
|
84
|
+
n = Counter.new
|
85
|
+
n = section_names(d.at(ns("//clause[@type = 'scope']")), n, 1)
|
70
86
|
n = section_names(d.at(ns(@klass.norm_ref_xpath)), n, 1)
|
71
|
-
n = section_names(d.at(ns("//sections/terms | "
|
72
|
-
"//sections/clause[descendant::terms]")), n, 1)
|
87
|
+
n = section_names(d.at(ns("//sections/terms | //sections/clause[descendant::terms]")), n, 1)
|
73
88
|
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
74
89
|
clause_names(d, n)
|
75
90
|
middle_section_asset_names(d)
|
@@ -93,7 +108,7 @@ module IsoDoc
|
|
93
108
|
end
|
94
109
|
|
95
110
|
def sequential_figure_names(clause)
|
96
|
-
c =
|
111
|
+
c = Counter.new
|
97
112
|
j = 0
|
98
113
|
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).each do |t|
|
99
114
|
if t.parent.name == "figure" then j += 1
|
@@ -103,35 +118,29 @@ module IsoDoc
|
|
103
118
|
end
|
104
119
|
label = c.print + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
105
120
|
next if t["id"].nil? || t["id"].empty?
|
106
|
-
@anchors[t["id"]] =
|
107
|
-
anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
121
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
108
122
|
end
|
109
123
|
end
|
110
124
|
|
111
125
|
def hierarchical_figure_names(clause, num)
|
112
|
-
c =
|
126
|
+
c = Counter.new
|
113
127
|
j = 0
|
114
|
-
clause.xpath(ns(".//figure | "
|
115
|
-
".//sourcecode[not(ancestor::example)]")).each do |t|
|
128
|
+
clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).each do |t|
|
116
129
|
if t.parent.name == "figure" then j += 1
|
117
130
|
else
|
118
131
|
j = 0
|
119
132
|
c.increment(t)
|
120
133
|
end
|
121
|
-
label = "#{num}#{hiersep}#{c.print}" +
|
122
|
-
(j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
134
|
+
label = "#{num}#{hiersep}#{c.print}" + (j.zero? ? "" : "#{hierfigsep}#{(96 + j).chr.to_s}")
|
123
135
|
next if t["id"].nil? || t["id"].empty?
|
124
|
-
@anchors[t["id"]] =
|
125
|
-
anchor_struct(label, nil, @labels["figure"], "figure",
|
126
|
-
t["unnumbered"])
|
136
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @labels["figure"], "figure", t["unnumbered"])
|
127
137
|
end
|
128
138
|
end
|
129
139
|
|
130
140
|
def sequential_formula_names(clause)
|
131
141
|
clause&.first&.xpath(ns(middle_sections))&.each do |c|
|
132
142
|
if c["id"] && @anchors[c["id"]]
|
133
|
-
hierarchical_formula_names(c, @anchors[c["id"]][:label] ||
|
134
|
-
@anchors[c["id"]][:xref] || "???")
|
143
|
+
hierarchical_formula_names(c, @anchors[c["id"]][:label] || @anchors[c["id"]][:xref] || "???")
|
135
144
|
else
|
136
145
|
hierarchical_formula_names(c, "???")
|
137
146
|
end
|
@@ -139,38 +148,87 @@ module IsoDoc
|
|
139
148
|
end
|
140
149
|
|
141
150
|
def hierarchical_formula_names(clause, num)
|
142
|
-
c =
|
151
|
+
c = Counter.new
|
143
152
|
clause.xpath(ns(".//formula")).each do |t|
|
144
153
|
next if t["id"].nil? || t["id"].empty?
|
145
154
|
@anchors[t["id"]] = anchor_struct(
|
146
155
|
"#{num}-#{c.increment(t).print}", nil,
|
147
|
-
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
148
|
-
"formula", t["unnumbered"])
|
156
|
+
t["inequality"] ? @labels["inequality"] : @labels["formula"], "formula", t["unnumbered"])
|
149
157
|
end
|
150
158
|
end
|
151
159
|
|
152
160
|
def reference_names(ref)
|
153
161
|
super
|
154
|
-
@anchors[ref["id"]] =
|
155
|
-
{ xref: @anchors[ref["id"]][:xref].sub(/^\[/, '').sub(/\]$/, '') }
|
162
|
+
@anchors[ref["id"]] = { xref: @anchors[ref["id"]][:xref].sub(/^\[/, '').sub(/\]$/, '') }
|
156
163
|
end
|
157
164
|
|
158
165
|
def termnote_anchor_names(docxml)
|
159
166
|
docxml.xpath(ns("//term[descendant::termnote]")).each do |t|
|
160
|
-
c =
|
167
|
+
c = Counter.new
|
161
168
|
notes = t.xpath(ns(".//termnote"))
|
162
169
|
notes.each do |n|
|
163
170
|
return if n["id"].nil? || n["id"].empty?
|
164
171
|
idx = notes.size == 1 ? "" : " #{c.increment(n).print}"
|
165
172
|
@anchors[n["id"]] =
|
166
|
-
{ label: termnote_label(idx).strip, type: "termnote",
|
167
|
-
|
168
|
-
xref: l10n("#{anchor(t['id'], :xref)}, "\
|
169
|
-
"#{@labels["note_xref"]} #{c.print}") }
|
170
|
-
|
173
|
+
{ label: termnote_label(idx).strip, type: "termnote", value: idx,
|
174
|
+
xref: l10n("#{anchor(t['id'], :xref)}, #{@labels["note_xref"]} #{c.print}") }
|
171
175
|
end
|
172
176
|
end
|
173
177
|
end
|
178
|
+
|
179
|
+
def clause_names(docxml, sect_num)
|
180
|
+
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')][not(@type = 'scope')][not(descendant::terms)]")).
|
181
|
+
each do |c|
|
182
|
+
section_names(c, sect_num, 1)
|
183
|
+
end
|
184
|
+
docxml.xpath(ns("//sections/clause[@unnumbered = 'true']")).each do |c|
|
185
|
+
unnumbered_section_names(c, 1)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
def section_names(clause, num, lvl)
|
190
|
+
return num if clause.nil?
|
191
|
+
num.increment(clause)
|
192
|
+
lbl = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
|
193
|
+
@anchors[clause["id"]] =
|
194
|
+
{ label: num.print, xref: l10n("#{lbl} #{num.print}"), level: lvl, type: "clause" }
|
195
|
+
i = Counter.new()
|
196
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
197
|
+
i.increment(c)
|
198
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
199
|
+
end
|
200
|
+
num
|
201
|
+
end
|
202
|
+
|
203
|
+
def section_names1(clause, num, level)
|
204
|
+
@anchors[clause["id"]] =
|
205
|
+
{ label: num, level: level,
|
206
|
+
xref: @doctype == "resolution" ? num : l10n("#{@labels["clause"]} #{num}") }
|
207
|
+
i = Counter.new()
|
208
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
209
|
+
i.increment(c)
|
210
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
def unnumbered_section_names(clause, lvl)
|
215
|
+
return if clause.nil?
|
216
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
217
|
+
@anchors[clause["id"]] =
|
218
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl, type: "clause" }
|
219
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
220
|
+
unnumbered_section_names1(c, lvl + 1)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
|
224
|
+
def unnumbered_section_names1(clause, level)
|
225
|
+
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
226
|
+
@anchors[clause["id"]] =
|
227
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level, type: "clause" }
|
228
|
+
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
229
|
+
unnumbered_section_names1(c, level + 1)
|
230
|
+
end
|
231
|
+
end
|
174
232
|
end
|
175
233
|
end
|
176
234
|
end
|
@@ -18,6 +18,17 @@ module Metanorma
|
|
18
18
|
)
|
19
19
|
end
|
20
20
|
|
21
|
+
def fonts_manifest
|
22
|
+
{
|
23
|
+
"Arial" => nil,
|
24
|
+
"Courier" => nil,
|
25
|
+
"Courier New" => nil,
|
26
|
+
"Times New Roman" => nil,
|
27
|
+
"Source Han Sans" => nil,
|
28
|
+
"STIX Two Math" => nil,
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
21
32
|
def version
|
22
33
|
"Metanorma::ITU #{Metanorma::ITU::VERSION}"
|
23
34
|
end
|