metanorma-itu 1.3.8 → 1.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/itu/cleanup.rb +64 -59
- data/lib/asciidoctor/itu/converter.rb +3 -7
- data/lib/asciidoctor/itu/front.rb +38 -98
- data/lib/asciidoctor/itu/front_id.rb +67 -0
- data/lib/asciidoctor/itu/isodoc.rng +49 -11
- data/lib/asciidoctor/itu/reqt.rng +15 -4
- data/lib/isodoc/itu/html/htmlstyle.css +6 -0
- data/lib/isodoc/itu/html/htmlstyle.scss +7 -0
- data/lib/isodoc/itu/itu.implementers-guide.xsl +502 -201
- data/lib/isodoc/itu/itu.in-force.xsl +502 -201
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +502 -201
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +502 -201
- data/lib/isodoc/itu/itu.recommendation.xsl +502 -201
- data/lib/isodoc/itu/itu.resolution.xsl +502 -201
- data/lib/isodoc/itu/itu.service-publication.xsl +502 -201
- data/lib/isodoc/itu/itu.technical-paper.xsl +502 -201
- data/lib/isodoc/itu/itu.technical-report.xsl +502 -201
- data/lib/isodoc/itu/metadata.rb +23 -12
- data/lib/isodoc/itu/presentation_xml_convert.rb +86 -75
- data/lib/isodoc/itu/word_cleanup.rb +30 -21
- data/lib/metanorma/itu/processor.rb +1 -1
- data/lib/metanorma/itu/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bee1431e0c6b0cd88e3a8a835f2cc912c30e6541a8e5c00400c869f215d9c0af
|
4
|
+
data.tar.gz: 2a591666e4d19a0c787610832d2fb6412223870b1811252894a611e73859f9a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87f1e8df611c7b3b7c8d2c5d240373c8b6e716f84729432a36c1370e9aa025a6b8949618c5689f16963ff4336c8cd2745d7a49d60223c83cb534dd68ecb84268
|
7
|
+
data.tar.gz: 565ddfa0f32450b576592feb7e54aed6fbb99ece041c83b412f6627ec16b8bf534e3b82d1b0ff71668ca69123ec14a3046895f0dd20a9f00de273b993eed1779
|
@@ -1,17 +1,19 @@
|
|
1
1
|
module Asciidoctor
|
2
2
|
module ITU
|
3
3
|
class Converter < Standoc::Converter
|
4
|
-
def sections_cleanup(
|
4
|
+
def sections_cleanup(xml)
|
5
5
|
super
|
6
|
-
insert_missing_sections(
|
7
|
-
insert_empty_clauses(
|
8
|
-
resolution_inline_header(
|
6
|
+
insert_missing_sections(xml) unless @no_insert_missing_sections
|
7
|
+
insert_empty_clauses(xml)
|
8
|
+
resolution_inline_header(xml)
|
9
9
|
end
|
10
10
|
|
11
|
-
def resolution_inline_header(
|
12
|
-
return unless
|
13
|
-
|
14
|
-
|
11
|
+
def resolution_inline_header(xml)
|
12
|
+
return unless xml&.at("//bibdata/ext/doctype")&.text == "resolution"
|
13
|
+
|
14
|
+
xml.xpath("//clause//clause").each do |c|
|
15
|
+
next if (title = c.at("./title")) && !title&.text&.empty?
|
16
|
+
|
15
17
|
c["inline-header"] = true
|
16
18
|
end
|
17
19
|
end
|
@@ -36,67 +38,67 @@ module Asciidoctor
|
|
36
38
|
%(id="_#{UUIDTools::UUID.random_create}")
|
37
39
|
end
|
38
40
|
|
39
|
-
def insert_scope(
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
ins =
|
45
|
-
|
41
|
+
def insert_scope(xml)
|
42
|
+
xml.at("./*/sections") or
|
43
|
+
xml.at("./*/preface | ./*/boilerplate | ./*/bibdata").next =
|
44
|
+
"<sections><sentinel/></sections>"
|
45
|
+
xml.at("./*/sections/*") or xml.at("./*/sections") << "<sentinel/>"
|
46
|
+
ins = xml.at("//sections").elements.first
|
47
|
+
xml.at("//sections/clause[@type = 'scope']") or
|
46
48
|
ins.previous =
|
47
49
|
"<clause type='scope' #{add_id}><title>#{@i18n.scope}</title><p>"\
|
48
50
|
"#{@i18n.clause_empty}</p></clause>"
|
49
|
-
|
51
|
+
xml&.at("//sentinel")&.remove
|
50
52
|
end
|
51
53
|
|
52
|
-
def insert_norm_ref(
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
ins =
|
57
|
-
|
54
|
+
def insert_norm_ref(xml)
|
55
|
+
xml.at("//bibliography") or
|
56
|
+
xml.at("./*/annex[last()] | ./*/sections").next =
|
57
|
+
"<bibliography><sentinel/></bibliography>"
|
58
|
+
ins = xml.at("//bibliography").elements.first
|
59
|
+
xml.at("//bibliography/references[@normative = 'true']") or
|
58
60
|
ins.previous = "<references #{add_id} normative='true'>"\
|
59
|
-
|
60
|
-
|
61
|
+
"<title>#{@i18n.normref}</title></references>"
|
62
|
+
xml&.at("//sentinel")&.remove
|
61
63
|
end
|
62
64
|
|
63
|
-
def insert_terms(
|
64
|
-
ins =
|
65
|
-
|
65
|
+
def insert_terms(xml)
|
66
|
+
ins = xml.at("//sections/clause[@type = 'scope']")
|
67
|
+
xml.at("//sections//terms") or
|
66
68
|
ins.next = "<terms #{add_id}><title>#{@i18n.termsdef}</title></terms>"
|
67
69
|
end
|
68
70
|
|
69
|
-
def insert_symbols(
|
70
|
-
ins =
|
71
|
-
|
72
|
-
unless
|
71
|
+
def insert_symbols(xml)
|
72
|
+
ins = xml.at("//sections/terms") ||
|
73
|
+
xml.at("//sections/clause[descendant::terms]")
|
74
|
+
unless xml.at("//sections//definitions")
|
73
75
|
ins.next = "<definitions #{add_id}>"\
|
74
|
-
|
76
|
+
"<title>#{@i18n.symbolsabbrev}</title></definitions>"
|
75
77
|
end
|
76
78
|
end
|
77
79
|
|
78
|
-
def insert_conventions(
|
79
|
-
ins =
|
80
|
-
|
81
|
-
unless
|
80
|
+
def insert_conventions(xml)
|
81
|
+
ins = xml.at("//sections//definitions") ||
|
82
|
+
xml.at("//sections/clause[descendant::definitions]")
|
83
|
+
unless xml.at("//sections/clause[@type = 'conventions']")
|
82
84
|
ins.next = "<clause #{add_id} type='conventions'>"\
|
83
|
-
|
84
|
-
|
85
|
+
"<title>#{@i18n.conventions}</title><p>"\
|
86
|
+
"#{@i18n.clause_empty}</p></clause>"
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
88
|
-
def insert_empty_clauses(
|
89
|
-
|
90
|
+
def insert_empty_clauses(xml)
|
91
|
+
xml.xpath("//terms[not(./term)][not(.//terms)]").each do |c|
|
90
92
|
insert_empty_clauses1(c, @i18n.clause_empty)
|
91
93
|
end
|
92
|
-
|
94
|
+
xml.xpath("//definitions[not(./dl)]").each do |c|
|
93
95
|
insert_empty_clauses1(c, @i18n.clause_empty)
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
97
|
-
def insert_empty_clauses1(
|
98
|
-
|
99
|
-
ins =
|
99
|
+
def insert_empty_clauses1(clause, text)
|
100
|
+
clause.at("./p") and return
|
101
|
+
ins = clause.at("./title") or return
|
100
102
|
ins.next = "<p>#{text}</p>"
|
101
103
|
end
|
102
104
|
|
@@ -114,14 +116,14 @@ module Asciidoctor
|
|
114
116
|
next unless n.text?
|
115
117
|
|
116
118
|
n.replace(HTMLEntities.new.encode(
|
117
|
-
|
118
|
-
|
119
|
+
n.text.gsub(/\u2019|\u2018|\u201a|\u201b/, "'")
|
120
|
+
.gsub(/\u201c|\u201d|\u201e|\u201f/, '"'), :basic
|
121
|
+
))
|
119
122
|
end
|
120
123
|
xmldoc
|
121
124
|
end
|
122
125
|
|
123
|
-
def termdef_boilerplate_cleanup(xmldoc)
|
124
|
-
end
|
126
|
+
def termdef_boilerplate_cleanup(xmldoc); end
|
125
127
|
|
126
128
|
def terms_extract(div)
|
127
129
|
internal = div.at("./terms[@type = 'internal']/title")
|
@@ -129,7 +131,7 @@ module Asciidoctor
|
|
129
131
|
[internal, external]
|
130
132
|
end
|
131
133
|
|
132
|
-
def term_defs_boilerplate(div,
|
134
|
+
def term_defs_boilerplate(div, _source, _term, _preface, _isodoc)
|
133
135
|
internal, external = terms_extract(div.parent)
|
134
136
|
internal&.next_element&.name == "term" and
|
135
137
|
internal.next = "<p>#{@i18n.internal_terms_boilerplate}</p>"
|
@@ -144,16 +146,20 @@ module Asciidoctor
|
|
144
146
|
div.next = "<p>#{@i18n.term_def_boilerplate}</p>"
|
145
147
|
end
|
146
148
|
|
147
|
-
def section_names_terms_cleanup(
|
149
|
+
def section_names_terms_cleanup(xml)
|
148
150
|
super
|
149
151
|
replace_title(
|
150
|
-
|
151
|
-
|
152
|
-
|
152
|
+
xml, "//terms[@type = 'internal'] | "\
|
153
|
+
"//clause[./terms[@type = 'internal']]"\
|
154
|
+
"[not(./terms[@type = 'external'])]",
|
155
|
+
@i18n&.internal_termsdef
|
156
|
+
)
|
153
157
|
replace_title(
|
154
|
-
|
155
|
-
|
156
|
-
|
158
|
+
xml, "//terms[@type = 'external'] | "\
|
159
|
+
"//clause[./terms[@type = 'external']]"\
|
160
|
+
"[not(./terms[@type = 'internal'])]",
|
161
|
+
@i18n&.external_termsdef
|
162
|
+
)
|
157
163
|
end
|
158
164
|
|
159
165
|
def symbols_cleanup(xmldoc)
|
@@ -193,12 +199,11 @@ module Asciidoctor
|
|
193
199
|
# then title
|
194
200
|
def sort_biblio_key(bib)
|
195
201
|
pubclass = pub_class(bib)
|
196
|
-
num = bib&.at("./docnumber")&.text
|
197
202
|
id = bib&.at("./docidentifier[not(@type = 'DOI' or @type = "\
|
198
203
|
"'metanorma' or @type = 'ISSN' or @type = 'ISBN')]")
|
199
204
|
metaid = bib&.at("./docidentifier[@type = 'metanorma']")&.text
|
200
|
-
abbrid = metaid unless /^\[\d+\]$/.match(metaid)
|
201
|
-
type = id[
|
205
|
+
abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
|
206
|
+
type = id["type"] if id
|
202
207
|
title = bib&.at("./title[@type = 'main']")&.text ||
|
203
208
|
bib&.at("./title")&.text || bib&.at("./formattedref")&.text
|
204
209
|
"#{pubclass} :: #{type} :: #{id&.text || metaid} :: #{title}"
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "asciidoctor"
|
2
2
|
require "asciidoctor/standoc/converter"
|
3
3
|
require "fileutils"
|
4
|
+
require "metanorma-utils"
|
4
5
|
require_relative "./front"
|
5
6
|
require_relative "./validate"
|
6
7
|
require_relative "./cleanup"
|
@@ -107,16 +108,11 @@ module Asciidoctor
|
|
107
108
|
return unless node.attr("keywords")
|
108
109
|
|
109
110
|
node.attr("keywords").split(/, */).sort.each_with_index do |kw, i|
|
110
|
-
|
111
|
+
kw_out = i.zero? ? Metanorma::Utils.strict_capitalize_first(kw) : kw
|
112
|
+
xml.keyword kw_out
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
114
|
-
def strict_capitalize(str)
|
115
|
-
letters = str.split("")
|
116
|
-
letters.first.upcase!
|
117
|
-
letters.join
|
118
|
-
end
|
119
|
-
|
120
116
|
def clause_parse(attrs, xml, node)
|
121
117
|
node.option?("unnumbered") and attrs[:unnumbered] = true
|
122
118
|
case sectiontype1(node)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require "asciidoctor"
|
2
2
|
require "asciidoctor/standoc/converter"
|
3
3
|
require "fileutils"
|
4
|
+
require_relative "./front_id"
|
4
5
|
|
5
6
|
module Asciidoctor
|
6
7
|
module ITU
|
@@ -13,17 +14,21 @@ module Asciidoctor
|
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
17
|
+
def relaton_relations
|
18
|
+
super + %w(complements)
|
19
|
+
end
|
20
|
+
|
16
21
|
def title_attr(type, lang = "en")
|
17
22
|
{ language: lang, format: "text/plain", type: type }
|
18
23
|
end
|
19
24
|
|
20
|
-
def
|
21
|
-
a = node.attr("title") || node.attr("title
|
22
|
-
xml.title **attr_code(title_attr("main")) do |t|
|
25
|
+
def title_defaultlang(node, xml)
|
26
|
+
a = node.attr("title") || node.attr("title-#{@lang}")
|
27
|
+
xml.title **attr_code(title_attr("main", @lang)) do |t|
|
23
28
|
t << (Metanorma::Utils::asciidoc_sub(a) || node.title)
|
24
29
|
end
|
25
|
-
if a = node.attr("annextitle") || node.attr("annextitle
|
26
|
-
xml.title **attr_code(title_attr("annex")) do |t|
|
30
|
+
if a = node.attr("annextitle") || node.attr("annextitle-#{@lang}")
|
31
|
+
xml.title **attr_code(title_attr("annex", @lang)) do |t|
|
27
32
|
t << Metanorma::Utils::asciidoc_sub(a)
|
28
33
|
end
|
29
34
|
end
|
@@ -32,7 +37,7 @@ module Asciidoctor
|
|
32
37
|
def title_otherlangs(node, xml)
|
33
38
|
node.attributes.each do |k, v|
|
34
39
|
next unless /^(annex)?title-(?<lang>.+)$/ =~ k
|
35
|
-
next if lang ==
|
40
|
+
next if lang == @lang
|
36
41
|
|
37
42
|
type = /^annex/.match?(k) ? "annex" : "main"
|
38
43
|
xml.title **attr_code(title_attr(type, lang)) do |t|
|
@@ -42,16 +47,17 @@ module Asciidoctor
|
|
42
47
|
end
|
43
48
|
|
44
49
|
def title(node, xml)
|
45
|
-
|
50
|
+
title_defaultlang(node, xml)
|
51
|
+
title_otherlangs(node, xml)
|
46
52
|
%w(subtitle amendment-title corrigendum-title).each do |t|
|
47
|
-
|
53
|
+
other_title_defaultlang(node, xml, t)
|
48
54
|
other_title_otherlangs(node, xml, t)
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
52
|
-
def
|
53
|
-
a = node.attr(type) || node.attr("#{type}
|
54
|
-
xml.title **attr_code(title_attr(type.sub(/-title/, ""))) do |t|
|
58
|
+
def other_title_defaultlang(node, xml, type)
|
59
|
+
a = node.attr(type) || node.attr("#{type}-#{@lang}")
|
60
|
+
xml.title **attr_code(title_attr(type.sub(/-title/, ""), @lang)) do |t|
|
55
61
|
t << Metanorma::Utils::asciidoc_sub(a)
|
56
62
|
end
|
57
63
|
end
|
@@ -59,7 +65,7 @@ module Asciidoctor
|
|
59
65
|
def other_title_otherlangs(node, xml, type)
|
60
66
|
node.attributes.each do |k, v|
|
61
67
|
next unless m = /^#{type}-(?<lang>.+)$/.match(k)
|
62
|
-
next if m[:lang] ==
|
68
|
+
next if m[:lang] == @lang
|
63
69
|
|
64
70
|
xml.title **attr_code(title_attr(type.sub(/-title/, ""),
|
65
71
|
m[:lang])) do |t|
|
@@ -84,30 +90,23 @@ module Asciidoctor
|
|
84
90
|
def metadata_committee1(node, xml, suffix)
|
85
91
|
xml.editorialgroup do |a|
|
86
92
|
a.bureau ( node.attr("bureau#{suffix}") || "T")
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
a.subgroup **attr_code(type: node.attr("subgrouptype#{suffix}")) do |g|
|
94
|
-
metadata_committee2(node, g, suffix, "sub")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
if node.attr("workgroup#{suffix}")
|
98
|
-
a.workgroup **attr_code(type: node.attr("workgrouptype#{suffix}")) do |g|
|
99
|
-
metadata_committee2(node, g, suffix, "work")
|
93
|
+
["", "sub", "work"].each do |p|
|
94
|
+
next unless node.attr("#{p}group#{suffix}")
|
95
|
+
|
96
|
+
type = node.attr("#{p}grouptype#{suffix}")
|
97
|
+
a.send "#{p}group", **attr_code(type: type) do |g|
|
98
|
+
metadata_committee2(node, g, suffix, p)
|
100
99
|
end
|
101
100
|
end
|
102
101
|
end
|
103
102
|
end
|
104
103
|
|
105
|
-
def metadata_committee2(node,
|
106
|
-
|
104
|
+
def metadata_committee2(node, group, suffix, prefix)
|
105
|
+
group.name node.attr("#{prefix}group#{suffix}")
|
107
106
|
node.attr("#{prefix}groupacronym#{suffix}") and
|
108
|
-
|
107
|
+
group.acronym node.attr("#{prefix}groupacronym#{suffix}")
|
109
108
|
if node.attr("#{prefix}groupyearstart#{suffix}")
|
110
|
-
|
109
|
+
group.period do |p|
|
111
110
|
p.start node.attr("#{prefix}groupyearstart#{suffix}")
|
112
111
|
node.attr("#{prefix}groupacronym#{suffix}") and
|
113
112
|
p.end node.attr("#{prefix}groupyearend#{suffix}")
|
@@ -115,66 +114,19 @@ module Asciidoctor
|
|
115
114
|
end
|
116
115
|
end
|
117
116
|
|
118
|
-
def metadata_id(node, xml)
|
119
|
-
provisional_id(node, xml)
|
120
|
-
itu_id(node, xml)
|
121
|
-
recommendation_id(node, xml)
|
122
|
-
end
|
123
|
-
|
124
|
-
def provisional_id(node, xml)
|
125
|
-
return unless node.attr("provisional-name")
|
126
|
-
|
127
|
-
xml.docidentifier **{ type: "ITU-provisional" } do |i|
|
128
|
-
i << node.attr("provisional-name")
|
129
|
-
end
|
130
|
-
end
|
131
|
-
|
132
|
-
ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
|
133
|
-
"zh" => "C", "ru" => "R" }.freeze
|
134
|
-
|
135
|
-
def itu_id1(node, lang)
|
136
|
-
bureau = node.attr("bureau") || "T"
|
137
|
-
id = doctype(node) == "service-publication" ?
|
138
|
-
@i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber")) :
|
139
|
-
"ITU-#{bureau} #{node.attr('docnumber')}"
|
140
|
-
id + (lang ? "-#{ITULANG[@lang]}" : "")
|
141
|
-
end
|
142
|
-
|
143
|
-
def itu_id(node, xml)
|
144
|
-
return unless node.attr("docnumber")
|
145
|
-
|
146
|
-
xml.docidentifier **{ type: "ITU" } do |i|
|
147
|
-
i << itu_id1(node, false)
|
148
|
-
end
|
149
|
-
xml.docidentifier **{ type: "ITU-lang" } do |i|
|
150
|
-
i << itu_id1(node, true)
|
151
|
-
end
|
152
|
-
xml.docnumber { |i| i << node.attr("docnumber") }
|
153
|
-
end
|
154
|
-
|
155
|
-
def recommendation_id(node, xml)
|
156
|
-
return unless node.attr("recommendationnumber")
|
157
|
-
|
158
|
-
node.attr("recommendationnumber").split("/").each do |s|
|
159
|
-
xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
|
160
|
-
i << s
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
117
|
def metadata_series(node, xml)
|
166
118
|
node.attr("series") and
|
167
119
|
xml.series **{ type: "main" } do |s|
|
168
|
-
|
169
|
-
|
120
|
+
s.title node.attr("series")
|
121
|
+
end
|
170
122
|
node.attr("series1") and
|
171
123
|
xml.series **{ type: "secondary" } do |s|
|
172
|
-
|
173
|
-
|
124
|
+
s.title node.attr("series1")
|
125
|
+
end
|
174
126
|
node.attr("series2") and
|
175
127
|
xml.series **{ type: "tertiary" } do |s|
|
176
|
-
|
177
|
-
|
128
|
+
s.title node.attr("series2")
|
129
|
+
end
|
178
130
|
end
|
179
131
|
|
180
132
|
def metadata_recommendationstatus(node, xml)
|
@@ -195,18 +147,6 @@ module Asciidoctor
|
|
195
147
|
xml.ip_notice_received (node.attr("ip-notice-received") || "false")
|
196
148
|
end
|
197
149
|
|
198
|
-
def structured_id(node, xml)
|
199
|
-
return unless node.attr("docnumber")
|
200
|
-
|
201
|
-
xml.structuredidentifier do |i|
|
202
|
-
i.bureau node.attr("bureau") || "T"
|
203
|
-
i.docnumber node.attr("docnumber")
|
204
|
-
a = node.attr("annexid") and i.annexid a
|
205
|
-
a = node.attr("amendment-number") and i.amendment a
|
206
|
-
a = node.attr("corrigendum-number") and i.corrigendum a
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
150
|
def metadata_techreport(node, xml)
|
211
151
|
a = node.attr("meeting") and
|
212
152
|
metadata_meeting(a, node.attr("meeting-acronym"), xml)
|
@@ -222,9 +162,9 @@ module Asciidoctor
|
|
222
162
|
end
|
223
163
|
end
|
224
164
|
|
225
|
-
def metadata_meeting_date(
|
165
|
+
def metadata_meeting_date(val, xml)
|
226
166
|
xml.meeting_date do |m|
|
227
|
-
d =
|
167
|
+
d = val.split("/")
|
228
168
|
if d.size > 1
|
229
169
|
m.from d[0]
|
230
170
|
m.to d[1]
|
@@ -234,9 +174,9 @@ module Asciidoctor
|
|
234
174
|
end
|
235
175
|
end
|
236
176
|
|
237
|
-
def personal_role(node,
|
177
|
+
def personal_role(node, contrib, suffix)
|
238
178
|
if node.attr("role#{suffix}")&.downcase == "rapporteur"
|
239
|
-
|
179
|
+
contrib.role "raporteur", **{ type: "editor" }
|
240
180
|
else
|
241
181
|
super
|
242
182
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module ITU
|
3
|
+
class Converter < Standoc::Converter
|
4
|
+
def metadata_id(node, xml)
|
5
|
+
provisional_id(node, xml)
|
6
|
+
itu_id(node, xml)
|
7
|
+
recommendation_id(node, xml)
|
8
|
+
end
|
9
|
+
|
10
|
+
def provisional_id(node, xml)
|
11
|
+
return unless node.attr("provisional-name")
|
12
|
+
|
13
|
+
xml.docidentifier **{ type: "ITU-provisional" } do |i|
|
14
|
+
i << node.attr("provisional-name")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
|
19
|
+
"zh" => "C", "ru" => "R" }.freeze
|
20
|
+
|
21
|
+
def itu_id1(node, lang)
|
22
|
+
bureau = node.attr("bureau") || "T"
|
23
|
+
id = if doctype(node) == "service-publication"
|
24
|
+
@i18n.annex_to_itu_ob_abbrev.sub(/%/,
|
25
|
+
node.attr("docnumber"))
|
26
|
+
else
|
27
|
+
"ITU-#{bureau} #{node.attr('docnumber')}"
|
28
|
+
end
|
29
|
+
id + (lang ? "-#{ITULANG[@lang]}" : "")
|
30
|
+
end
|
31
|
+
|
32
|
+
def itu_id(node, xml)
|
33
|
+
return unless node.attr("docnumber")
|
34
|
+
|
35
|
+
xml.docidentifier **{ type: "ITU" } do |i|
|
36
|
+
i << itu_id1(node, false)
|
37
|
+
end
|
38
|
+
xml.docidentifier **{ type: "ITU-lang" } do |i|
|
39
|
+
i << itu_id1(node, true)
|
40
|
+
end
|
41
|
+
xml.docnumber { |i| i << node.attr("docnumber") }
|
42
|
+
end
|
43
|
+
|
44
|
+
def recommendation_id(node, xml)
|
45
|
+
return unless node.attr("recommendationnumber")
|
46
|
+
|
47
|
+
node.attr("recommendationnumber").split("/").each do |s|
|
48
|
+
xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
|
49
|
+
i << s
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def structured_id(node, xml)
|
55
|
+
return unless node.attr("docnumber")
|
56
|
+
|
57
|
+
xml.structuredidentifier do |i|
|
58
|
+
i.bureau node.attr("bureau") || "T"
|
59
|
+
i.docnumber node.attr("docnumber")
|
60
|
+
a = node.attr("annexid") and i.annexid a
|
61
|
+
a = node.attr("amendment-number") and i.amendment a
|
62
|
+
a = node.attr("corrigendum-number") and i.corrigendum a
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -32,6 +32,18 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="section-title">
|
36
|
+
<element name="title">
|
37
|
+
<zeroOrMore>
|
38
|
+
<ref name="TextElement"/>
|
39
|
+
</zeroOrMore>
|
40
|
+
</element>
|
41
|
+
<zeroOrMore>
|
42
|
+
<element name="variant-title">
|
43
|
+
<ref name="TypedTitleString"/>
|
44
|
+
</element>
|
45
|
+
</zeroOrMore>
|
46
|
+
</define>
|
35
47
|
<define name="hyperlink">
|
36
48
|
<element name="link">
|
37
49
|
<attribute name="target">
|
@@ -158,15 +170,17 @@
|
|
158
170
|
<data type="boolean"/>
|
159
171
|
</attribute>
|
160
172
|
</optional>
|
161
|
-
<
|
162
|
-
<
|
163
|
-
<
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
173
|
+
<optional>
|
174
|
+
<attribute name="type">
|
175
|
+
<choice>
|
176
|
+
<value>roman</value>
|
177
|
+
<value>alphabet</value>
|
178
|
+
<value>arabic</value>
|
179
|
+
<value>roman_upper</value>
|
180
|
+
<value>alphabet_upper</value>
|
181
|
+
</choice>
|
182
|
+
</attribute>
|
183
|
+
</optional>
|
170
184
|
<oneOrMore>
|
171
185
|
<ref name="li"/>
|
172
186
|
</oneOrMore>
|
@@ -976,6 +990,16 @@
|
|
976
990
|
<data type="boolean"/>
|
977
991
|
</attribute>
|
978
992
|
</optional>
|
993
|
+
<optional>
|
994
|
+
<attribute name="linkmention">
|
995
|
+
<data type="boolean"/>
|
996
|
+
</attribute>
|
997
|
+
</optional>
|
998
|
+
<optional>
|
999
|
+
<attribute name="linkref">
|
1000
|
+
<data type="boolean"/>
|
1001
|
+
</attribute>
|
1002
|
+
</optional>
|
979
1003
|
<optional>
|
980
1004
|
<element name="refterm">
|
981
1005
|
<zeroOrMore>
|
@@ -1012,6 +1036,7 @@
|
|
1012
1036
|
<ref name="svgmap"/>
|
1013
1037
|
<ref name="inputform"/>
|
1014
1038
|
<ref name="toc"/>
|
1039
|
+
<ref name="passthrough"/>
|
1015
1040
|
</choice>
|
1016
1041
|
</define>
|
1017
1042
|
<define name="toc">
|
@@ -1019,6 +1044,14 @@
|
|
1019
1044
|
<ref name="ul"/>
|
1020
1045
|
</element>
|
1021
1046
|
</define>
|
1047
|
+
<define name="passthrough">
|
1048
|
+
<element name="passthrough">
|
1049
|
+
<optional>
|
1050
|
+
<attribute name="formats"/>
|
1051
|
+
</optional>
|
1052
|
+
<text/>
|
1053
|
+
</element>
|
1054
|
+
</define>
|
1022
1055
|
<define name="inputform">
|
1023
1056
|
<element name="form">
|
1024
1057
|
<attribute name="id">
|
@@ -1686,7 +1719,9 @@
|
|
1686
1719
|
<zeroOrMore>
|
1687
1720
|
<ref name="termgrammar"/>
|
1688
1721
|
</zeroOrMore>
|
1689
|
-
<
|
1722
|
+
<oneOrMore>
|
1723
|
+
<ref name="termdefinition"/>
|
1724
|
+
</oneOrMore>
|
1690
1725
|
<zeroOrMore>
|
1691
1726
|
<ref name="termnote"/>
|
1692
1727
|
</zeroOrMore>
|
@@ -1749,7 +1784,7 @@
|
|
1749
1784
|
</oneOrMore>
|
1750
1785
|
</element>
|
1751
1786
|
</define>
|
1752
|
-
<define name="
|
1787
|
+
<define name="termdefinition">
|
1753
1788
|
<element name="definition">
|
1754
1789
|
<oneOrMore>
|
1755
1790
|
<choice>
|
@@ -1758,6 +1793,9 @@
|
|
1758
1793
|
<ref name="formula"/>
|
1759
1794
|
</choice>
|
1760
1795
|
</oneOrMore>
|
1796
|
+
<zeroOrMore>
|
1797
|
+
<ref name="termsource"/>
|
1798
|
+
</zeroOrMore>
|
1761
1799
|
</element>
|
1762
1800
|
</define>
|
1763
1801
|
<define name="termnote">
|