metanorma-itu 0.2.8 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/macos.yml +3 -2
- data/.github/workflows/ubuntu.yml +3 -2
- data/.github/workflows/windows.yml +3 -2
- data/README.adoc +6 -7
- data/lib/asciidoctor/itu/basicdoc.rng +28 -14
- data/lib/asciidoctor/itu/biblio.rng +13 -3
- data/lib/asciidoctor/itu/cleanup.rb +118 -0
- data/lib/asciidoctor/itu/converter.rb +17 -53
- data/lib/asciidoctor/itu/isodoc.rng +6 -6
- data/lib/asciidoctor/itu/isostandard.rng +10 -5
- data/lib/asciidoctor/itu/itu.rng +48 -0
- data/lib/asciidoctor/itu/itu_intro.xml +48 -0
- data/lib/asciidoctor/itu/macros.rb +22 -14
- data/lib/asciidoctor/itu/validate.rb +14 -0
- data/lib/isodoc/itu/base_convert.rb +93 -77
- data/lib/isodoc/itu/html/_coverpage.scss +172 -0
- data/lib/isodoc/itu/html/html_itu_intro.html +2 -34
- data/lib/isodoc/itu/html/html_itu_titlepage.html +26 -49
- data/lib/isodoc/itu/html/htmlstyle.scss +295 -918
- data/lib/isodoc/itu/html/itu.scss +49 -21
- data/lib/isodoc/itu/html/word_itu_intro.html +61 -174
- data/lib/isodoc/itu/html/word_itu_titlepage.html +4 -18
- data/lib/isodoc/itu/html/wordstyle.scss +151 -157
- data/lib/isodoc/itu/html_convert.rb +21 -7
- data/lib/isodoc/itu/i18n-en.yaml +1 -0
- data/lib/isodoc/itu/metadata.rb +12 -3
- data/lib/isodoc/itu/pdf_convert.rb +25 -5
- data/lib/isodoc/itu/terms.rb +87 -0
- data/lib/isodoc/itu/word_convert.rb +83 -15
- data/lib/isodoc/itu/xref.rb +4 -5
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +2 -2
- metadata +34 -30
@@ -207,9 +207,9 @@
|
|
207
207
|
</optional>
|
208
208
|
<choice>
|
209
209
|
<group>
|
210
|
-
<
|
210
|
+
<zeroOrMore>
|
211
211
|
<ref name="BasicBlock"/>
|
212
|
-
</
|
212
|
+
</zeroOrMore>
|
213
213
|
<zeroOrMore>
|
214
214
|
<ref name="note"/>
|
215
215
|
</zeroOrMore>
|
@@ -244,9 +244,9 @@
|
|
244
244
|
</optional>
|
245
245
|
<choice>
|
246
246
|
<group>
|
247
|
-
<
|
247
|
+
<zeroOrMore>
|
248
248
|
<ref name="BasicBlock"/>
|
249
|
-
</
|
249
|
+
</zeroOrMore>
|
250
250
|
<zeroOrMore>
|
251
251
|
<ref name="note"/>
|
252
252
|
</zeroOrMore>
|
@@ -289,9 +289,9 @@
|
|
289
289
|
</optional>
|
290
290
|
<choice>
|
291
291
|
<group>
|
292
|
-
<
|
292
|
+
<zeroOrMore>
|
293
293
|
<ref name="BasicBlock"/>
|
294
|
-
</
|
294
|
+
</zeroOrMore>
|
295
295
|
<zeroOrMore>
|
296
296
|
<ref name="note"/>
|
297
297
|
</zeroOrMore>
|
@@ -6,7 +6,9 @@
|
|
6
6
|
</start>
|
7
7
|
<define name="organization">
|
8
8
|
<element name="organization">
|
9
|
-
<
|
9
|
+
<oneOrMore>
|
10
|
+
<ref name="orgname"/>
|
11
|
+
</oneOrMore>
|
10
12
|
<optional>
|
11
13
|
<ref name="abbreviation"/>
|
12
14
|
</optional>
|
@@ -74,10 +76,12 @@
|
|
74
76
|
<define name="sections">
|
75
77
|
<element name="sections">
|
76
78
|
<ref name="clause"/>
|
77
|
-
<
|
78
|
-
<
|
79
|
-
|
80
|
-
|
79
|
+
<optional>
|
80
|
+
<choice>
|
81
|
+
<ref name="term-clause"/>
|
82
|
+
<ref name="terms"/>
|
83
|
+
</choice>
|
84
|
+
</optional>
|
81
85
|
<optional>
|
82
86
|
<ref name="definitions"/>
|
83
87
|
</optional>
|
@@ -395,6 +399,7 @@
|
|
395
399
|
</optional>
|
396
400
|
<choice>
|
397
401
|
<ref name="image"/>
|
402
|
+
<ref name="pre"/>
|
398
403
|
<oneOrMore>
|
399
404
|
<ref name="subfigure"/>
|
400
405
|
</oneOrMore>
|
data/lib/asciidoctor/itu/itu.rng
CHANGED
@@ -49,6 +49,24 @@
|
|
49
49
|
</choice>
|
50
50
|
</element>
|
51
51
|
</define>
|
52
|
+
<define name="ol">
|
53
|
+
<element name="ol">
|
54
|
+
<attribute name="id">
|
55
|
+
<data type="ID"/>
|
56
|
+
</attribute>
|
57
|
+
<optional>
|
58
|
+
<attribute name="class">
|
59
|
+
<value>steps</value>
|
60
|
+
</attribute>
|
61
|
+
</optional>
|
62
|
+
<oneOrMore>
|
63
|
+
<ref name="li"/>
|
64
|
+
</oneOrMore>
|
65
|
+
<zeroOrMore>
|
66
|
+
<ref name="note"/>
|
67
|
+
</zeroOrMore>
|
68
|
+
</element>
|
69
|
+
</define>
|
52
70
|
<define name="DocumentType">
|
53
71
|
<choice>
|
54
72
|
<value>recommendation</value>
|
@@ -130,6 +148,36 @@
|
|
130
148
|
</element>
|
131
149
|
</define>
|
132
150
|
</include>
|
151
|
+
<define name="TextElement" combine="choice">
|
152
|
+
<choice>
|
153
|
+
<ref name="add"/>
|
154
|
+
<ref name="del"/>
|
155
|
+
</choice>
|
156
|
+
</define>
|
157
|
+
<define name="add">
|
158
|
+
<element name="add">
|
159
|
+
<choice>
|
160
|
+
<ref name="PureTextElement"/>
|
161
|
+
<ref name="eref"/>
|
162
|
+
<ref name="stem"/>
|
163
|
+
<ref name="keyword"/>
|
164
|
+
<ref name="xref"/>
|
165
|
+
<ref name="hyperlink"/>
|
166
|
+
</choice>
|
167
|
+
</element>
|
168
|
+
</define>
|
169
|
+
<define name="del">
|
170
|
+
<element name="del">
|
171
|
+
<choice>
|
172
|
+
<ref name="PureTextElement"/>
|
173
|
+
<ref name="eref"/>
|
174
|
+
<ref name="stem"/>
|
175
|
+
<ref name="keyword"/>
|
176
|
+
<ref name="xref"/>
|
177
|
+
<ref name="hyperlink"/>
|
178
|
+
</choice>
|
179
|
+
</element>
|
180
|
+
</define>
|
133
181
|
<define name="ipnoticereceived">
|
134
182
|
<element name="ip-notice-received">
|
135
183
|
<data type="boolean"/>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<boilerplate>
|
2
|
+
<legal-statement>
|
3
|
+
<clause>
|
4
|
+
<title>FOREWORD</title>
|
5
|
+
<p>The International Telecommunication Union (ITU) is the United Nations specialized agency in the field of telecommunications , information and communication technologies (ICTs). The ITU Telecommunication Standardization Sector (ITU-T) is a permanent organ of ITU. ITU-T is responsible for studying technical, operating and tariff questions and issuing Recommendations on them with a view to standardizing telecommunications on a worldwide basis.</p>
|
6
|
+
<p>The World Telecommunication Standardization Assembly (WTSA), which meets every four years, establishes the topics for study by the ITU T study groups which, in turn, produce Recommendations on these topics.</p>
|
7
|
+
<p>The approval of ITU-T Recommendations is covered by the procedure laid down in WTSA Resolution 1 .</p>
|
8
|
+
<p>In some areas of information technology which fall within ITU-T's purview, the necessary standards are prepared on a collaborative basis with ISO and IEC.</p>
|
9
|
+
|
10
|
+
|
11
|
+
<clause>
|
12
|
+
<title>NOTE</title>
|
13
|
+
<p>In this Recommendation, the expression "Administration" is used for conciseness to indicate both a telecommunication administration and a recognized operating agency .</p>
|
14
|
+
<p>Compliance with this Recommendation is voluntary. However, the Recommendation may contain certain mandatory provisions (to ensure, e.g., interoperability or applicability) and compliance with the Recommendation is achieved when all of these mandatory provisions are met. The words "shall" or some other obligatory language such as "must" and the negative equivalents are used to express requirements. The use of such words does not suggest that compliance with the Recommendation is required of any party .</p>
|
15
|
+
</clause>
|
16
|
+
</clause>
|
17
|
+
|
18
|
+
{% if unpublished %}
|
19
|
+
<clause id="draft-warning">
|
20
|
+
<title>CAUTION! PREPUBLISHED {{ doctype | upcase }}</title>
|
21
|
+
<p>This
|
22
|
+
prepublication is an unedited version of a recently approved {{doctype}}.
|
23
|
+
It will be replaced by the published version after editing. Therefore,
|
24
|
+
there will be differences between this prepublication and the published
|
25
|
+
version.</p>
|
26
|
+
</clause>
|
27
|
+
{% endif %}
|
28
|
+
</legal-statement>
|
29
|
+
|
30
|
+
<copyright-statement>
|
31
|
+
<clause>
|
32
|
+
<p>© ITU {{ docyear }}</p>
|
33
|
+
<p>All rights reserved. No part of this publication may be reproduced, by any means whatsoever, without the prior written permission of ITU.</p>
|
34
|
+
</clause>
|
35
|
+
</copyright-statement>
|
36
|
+
|
37
|
+
<license-statement>
|
38
|
+
<clause>
|
39
|
+
<title>INTELLECTUAL PROPERTY RIGHTS</title>
|
40
|
+
<p>ITU draws attention to the possibility that the practice or implementation of this Recommendation may involve the use of a claimed Intellectual Property Right. ITU takes no position concerning the evidence, validity or applicability of claimed Intellectual Property Rights, whether asserted by ITU members or others outside of the Recommendation development process.</p>
|
41
|
+
<p>As of the date of approval of this Recommendation, ITU had {% if ip_notice_received %}{% else %}not{% endif %} received notice of intellectual property, protected by patents, which may be required to implement this Recommendation. However, implementers are cautioned that this may not represent the latest information and are therefore strongly urged to consult the TSB patent database at <link target="http://www.itu.int/ITU-T/ipr/"/>.
|
42
|
+
</p>
|
43
|
+
</clause>
|
44
|
+
</license-statement>
|
45
|
+
</boilerplate>
|
46
|
+
|
47
|
+
|
48
|
+
|
@@ -1,19 +1,27 @@
|
|
1
|
-
|
1
|
+
module Asciidoctor
|
2
|
+
module ITU
|
3
|
+
class AddMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
4
|
+
use_dsl
|
5
|
+
named :add
|
6
|
+
parse_content_as :text
|
7
|
+
using_format :short
|
2
8
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
9
|
+
def process(parent, _target, attrs)
|
10
|
+
out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
|
11
|
+
%{<add>#{out}</add>}
|
12
|
+
end
|
13
|
+
end
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
15
|
+
class DelMacro < Asciidoctor::Extensions::InlineMacroProcessor
|
16
|
+
use_dsl
|
17
|
+
named :del
|
18
|
+
parse_content_as :text
|
19
|
+
using_format :short
|
13
20
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
def process(parent, _target, attrs)
|
22
|
+
out = Asciidoctor::Inline.new(parent, :quoted, attrs["text"]).convert
|
23
|
+
%{<del>#{out}</del>}
|
24
|
+
end
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
@@ -26,6 +26,7 @@ module Asciidoctor
|
|
26
26
|
approval_validate(doc)
|
27
27
|
itu_identifier_validate(doc)
|
28
28
|
bibdata_validate(doc.root)
|
29
|
+
termdef_style(doc.root)
|
29
30
|
end
|
30
31
|
|
31
32
|
def approval_validate(xmldoc)
|
@@ -46,6 +47,19 @@ module Asciidoctor
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
def termdef_style(xmldoc)
|
51
|
+
xmldoc.xpath("//term").each do |t|
|
52
|
+
para = t.at("./definition") || return
|
53
|
+
term = t.at("./preferred").text
|
54
|
+
termdef_warn(term, /^[A-Z][a-z]+/, term, "term is not lowercase")
|
55
|
+
termdef_warn(para.text, /^[a-z]/, term, "term definition does not start with capital")
|
56
|
+
termdef_warn(para.text, /[^.]$/, term, "term definition does not end with period")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def termdef_warn(text, re, term, msg)
|
61
|
+
re.match(text) && warn("ITU style: #{term}: #{msg}")
|
62
|
+
end
|
49
63
|
end
|
50
64
|
end
|
51
65
|
end
|
@@ -3,6 +3,7 @@ require_relative "metadata"
|
|
3
3
|
require "fileutils"
|
4
4
|
require_relative "./ref.rb"
|
5
5
|
require_relative "./xref.rb"
|
6
|
+
require_relative "./terms.rb"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module ITU
|
@@ -40,21 +41,32 @@ module IsoDoc
|
|
40
41
|
""
|
41
42
|
end
|
42
43
|
|
43
|
-
def
|
44
|
-
|
45
|
-
|
44
|
+
def note_label(node)
|
45
|
+
n = get_anchors[node["id"]]
|
46
|
+
return "#{@note_lbl} – " if n.nil? || n[:label].nil? || n[:label].empty?
|
47
|
+
l10n("#{@note_lbl} #{n[:label]} – ")
|
46
48
|
end
|
47
49
|
|
48
|
-
def
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
50
|
+
def formula_where(dl, out)
|
51
|
+
return unless dl
|
52
|
+
out.p { |p| p << l10n("#{@where_lbl}:") }
|
53
|
+
parse(dl, out)
|
54
|
+
end
|
55
|
+
|
56
|
+
def prefix_container(container, linkend, _target)
|
57
|
+
l10n("#{linkend} #{@labels["in"]} #{anchor(container, :xref)}")
|
58
|
+
end
|
59
|
+
|
60
|
+
def ol_depth(node)
|
61
|
+
return super unless node["class"] == "steps" or
|
62
|
+
node.at(".//ancestor::xmlns:ol[@class = 'steps']")
|
63
|
+
depth = node.ancestors("ul, ol").size + 1
|
64
|
+
type = :arabic
|
65
|
+
type = :alphabet if [2, 7].include? depth
|
66
|
+
type = :roman if [3, 8].include? depth
|
67
|
+
type = :alphabet_upper if [4, 9].include? depth
|
68
|
+
type = :roman_upper if [5, 10].include? depth
|
69
|
+
ol_style(type)
|
58
70
|
end
|
59
71
|
|
60
72
|
def annex_name(annex, name, div)
|
@@ -112,70 +124,6 @@ module IsoDoc
|
|
112
124
|
super
|
113
125
|
end
|
114
126
|
|
115
|
-
def terms_defs_title(node)
|
116
|
-
t = node.at(ns("./title")) and return t.text
|
117
|
-
super
|
118
|
-
end
|
119
|
-
|
120
|
-
def terms_defs(node, out, num)
|
121
|
-
f = node.at(ns(IsoDoc::Convert::TERM_CLAUSE)) or return num
|
122
|
-
out.div **attr_code(id: f["id"]) do |div|
|
123
|
-
num = num + 1
|
124
|
-
clause_name(num, terms_defs_title(f), div, nil)
|
125
|
-
if f.at(ns("./clause | ./terms | ./term")).nil? then out.p "None."
|
126
|
-
else
|
127
|
-
f.children.reject { |c1| c1.name == "title" }.each do |c1|
|
128
|
-
parse(c1, div)
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
num
|
133
|
-
end
|
134
|
-
|
135
|
-
def terms_parse(node, out)
|
136
|
-
out.div **attr_code(id: node["id"]) do |div|
|
137
|
-
clause_parse_title(node, div, node.at(ns("./title")), out)
|
138
|
-
title = node.at(ns("./title"))&.text&.downcase
|
139
|
-
title == "terms defined elsewhere" and
|
140
|
-
out.p @labels["elsewhere_terms"]
|
141
|
-
title == "terms defined in this recommendation" and
|
142
|
-
out.p @labels["here_terms"]
|
143
|
-
if node.at(ns("./clause | ./term")).nil? then out.p "None."
|
144
|
-
else
|
145
|
-
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
146
|
-
parse(c1, div)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
151
|
-
|
152
|
-
def termdef_parse1(node, div, term, defn, source)
|
153
|
-
div.p **{ class: "TermNum", id: node["id"] } do |p|
|
154
|
-
p.b do |b|
|
155
|
-
b << anchor(node["id"], :label)
|
156
|
-
insert_tab(b, 1)
|
157
|
-
term.children.each { |n| parse(n, b) }
|
158
|
-
end
|
159
|
-
source and p << " [#{source.value}]"
|
160
|
-
p << ": "
|
161
|
-
end
|
162
|
-
defn and defn.children.each { |n| parse(n, div) }
|
163
|
-
end
|
164
|
-
|
165
|
-
def termdef_parse(node, out)
|
166
|
-
term = node.at(ns("./preferred"))
|
167
|
-
defn = node.at(ns("./definition"))
|
168
|
-
source = node.at(ns("./termsource/origin/@citeas"))
|
169
|
-
out.div **attr_code(id: node["id"]) do |div|
|
170
|
-
termdef_parse1(node, div, term, defn, source)
|
171
|
-
set_termdomain("")
|
172
|
-
node.children.each do |n|
|
173
|
-
next if %w(preferred definition termsource title).include? n.name
|
174
|
-
parse(n, out)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
127
|
def get_eref_linkend(node)
|
180
128
|
link = "[#{anchor_linkend(node, docid_l10n(node["target"] || node["citeas"]))}]"
|
181
129
|
link += eref_localities(node.xpath(ns("./locality")), link)
|
@@ -211,6 +159,74 @@ module IsoDoc
|
|
211
159
|
insert_tab(s, 1)
|
212
160
|
end
|
213
161
|
end
|
162
|
+
|
163
|
+
def add_parse(node, out)
|
164
|
+
out.span **{class: "addition"} do |e|
|
165
|
+
node.children.each { |n| parse(n, e) }
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def del_parse(node, out)
|
170
|
+
out.span **{class: "deletion"} do |e|
|
171
|
+
node.children.each { |n| parse(n, e) }
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
def error_parse(node, out)
|
176
|
+
case node.name
|
177
|
+
when "add" then add_parse(node, out)
|
178
|
+
when "del" then del_parse(node, out)
|
179
|
+
when "copyright-statement"
|
180
|
+
out.div **{class: "copyright"} do |div|
|
181
|
+
node.children.each { |n| parse(n, div) }
|
182
|
+
end
|
183
|
+
when "license-statement"
|
184
|
+
out.div **{class: "license"} do |div|
|
185
|
+
node.children.each { |n| parse(n, out) }
|
186
|
+
end
|
187
|
+
when "legal-statement"
|
188
|
+
out.div **{class: "legal"} do |div|
|
189
|
+
node.children.each { |n| parse(n, out) }
|
190
|
+
end
|
191
|
+
else
|
192
|
+
super
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def note_p_parse(node, div)
|
197
|
+
div.p do |p|
|
198
|
+
p.span **{ class: "note_label" } do |s|
|
199
|
+
s << note_label(node)
|
200
|
+
end
|
201
|
+
node.first_element_child.children.each { |n| parse(n, p) }
|
202
|
+
end
|
203
|
+
node.element_children[1..-1].each { |n| parse(n, div) }
|
204
|
+
end
|
205
|
+
|
206
|
+
def note_parse1(node, div)
|
207
|
+
div.p do |p|
|
208
|
+
p.span **{ class: "note_label" } do |s|
|
209
|
+
s << note_label(node)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
node.children.each { |n| parse(n, div) }
|
213
|
+
end
|
214
|
+
|
215
|
+
def boilerplate(node, out)
|
216
|
+
boilerplate = node.at(ns("//boilerplate")) or return
|
217
|
+
out.div **{class: "authority"} do |s|
|
218
|
+
boilerplate.children.each do |n|
|
219
|
+
if n.name == "title"
|
220
|
+
s.h1 do |h|
|
221
|
+
n.children.each { |nn| parse(nn, h) }
|
222
|
+
end
|
223
|
+
else
|
224
|
+
parse(n, s)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
214
230
|
end
|
215
231
|
end
|
216
232
|
end
|