metanorma-itu 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/asciidoctor/itu/converter.rb +8 -0
- data/lib/asciidoctor/itu/front.rb +6 -0
- data/lib/asciidoctor/itu/itu.rng +1 -0
- data/lib/asciidoctor/itu/validate.rb +1 -1
- data/lib/isodoc/itu/base_convert.rb +25 -112
- data/lib/isodoc/itu/html/html_itu_titlepage.html +1 -1
- data/lib/isodoc/itu/html/htmlstyle.scss +1 -1
- data/lib/isodoc/itu/html/itu.scss +88 -12
- data/lib/isodoc/itu/html/word_itu_titlepage.html +4 -4
- data/lib/isodoc/itu/html/wordstyle.scss +38 -24
- data/lib/isodoc/itu/html_convert.rb +1 -0
- data/lib/isodoc/itu/metadata.rb +1 -1
- data/lib/isodoc/itu/pdf_convert.rb +1 -0
- data/lib/isodoc/itu/ref.rb +96 -0
- data/lib/isodoc/itu/word_convert.rb +52 -22
- data/lib/isodoc/itu/xref.rb +117 -0
- data/lib/metanorma/itu/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc42b5f0ce3f11b23b8bcd171e19342c3f2c237742e8084cb6545af5a56e954f
|
4
|
+
data.tar.gz: 73ae3b1e5cf914b8e715e1ccb14b0492819cbe811334cbfe7c5b24787490f5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f72656f8c80c6bff4e48aba41f45d0342fb6fc5e542eb0410908efb465862ba7f3b9dee3cc6ef4ef5175fa60fdb05570339d9718b99193f56d6b2e4818734b0
|
7
|
+
data.tar.gz: 13071d691ced638d57cb4085835b359e00a7851c6198739159ccb5e675b491e34983fba7a89c16e6a090a3172a9e6ef577b46c2df4948125b279d7b510223c61
|
@@ -234,6 +234,14 @@ module Asciidoctor
|
|
234
234
|
super
|
235
235
|
end
|
236
236
|
|
237
|
+
def html_extract_attributes(node)
|
238
|
+
super.merge(hierarchical_assets: node.attr("hierarchical-assets"))
|
239
|
+
end
|
240
|
+
|
241
|
+
def doc_extract_attributes(node)
|
242
|
+
super.merge(hierarchical_assets: node.attr("hierarchical-assets"))
|
243
|
+
end
|
244
|
+
|
237
245
|
def html_converter(node)
|
238
246
|
IsoDoc::ITU::HtmlConvert.new(html_extract_attributes(node))
|
239
247
|
end
|
@@ -9,6 +9,12 @@ module Asciidoctor
|
|
9
9
|
# schema encapsulation of the document for validation
|
10
10
|
#
|
11
11
|
class Converter < Standoc::Converter
|
12
|
+
def metadata_status(node, xml)
|
13
|
+
xml.status do |s|
|
14
|
+
s.stage (node.attributes.has_key?("draft") ? "draft" :
|
15
|
+
(node.attr("status") || node.attr("docstage") || "published" ))
|
16
|
+
end
|
17
|
+
end
|
12
18
|
|
13
19
|
def title_english(node, xml)
|
14
20
|
["en"].each do |lang|
|
data/lib/asciidoctor/itu/itu.rng
CHANGED
@@ -17,7 +17,7 @@ module Asciidoctor
|
|
17
17
|
|
18
18
|
def stage_validate(xmldoc)
|
19
19
|
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
20
|
-
%w(in-force superseded in-force-prepublished withdrawn).include? stage or
|
20
|
+
%w(in-force superseded in-force-prepublished withdrawn draft).include? stage or
|
21
21
|
warn "Document Attributes: #{stage} is not a recognised status"
|
22
22
|
end
|
23
23
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require_relative "metadata"
|
3
3
|
require "fileutils"
|
4
|
+
require_relative "./ref.rb"
|
5
|
+
require_relative "./xref.rb"
|
4
6
|
|
5
7
|
module IsoDoc
|
6
8
|
module ITU
|
@@ -50,7 +52,7 @@ module IsoDoc
|
|
50
52
|
node.children.each do |n|
|
51
53
|
parse(n, div) unless n.name == "name"
|
52
54
|
end
|
53
|
-
|
55
|
+
sourcecode_name_parse(node, div, name) if name
|
54
56
|
end
|
55
57
|
@in_figure = false
|
56
58
|
end
|
@@ -64,46 +66,16 @@ module IsoDoc
|
|
64
66
|
name&.children&.each { |c2| parse(c2, b) }
|
65
67
|
end
|
66
68
|
end
|
67
|
-
|
68
|
-
type = type.split(" ").map {|w| w.capitalize }.join(" ")
|
69
|
-
info = annex["obligation"] == "informative"
|
70
|
-
div.p { |p| p << (info ? @inform_annex_lbl : @norm_annex_lbl).sub(/%/, type) }
|
71
|
-
end
|
72
|
-
|
73
|
-
def annex_name_lbl(clause, num)
|
74
|
-
lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl
|
75
|
-
l10n("<b>#{lbl} #{num}</b>")
|
69
|
+
annex_obligation_subtitle(annex, div)
|
76
70
|
end
|
77
71
|
|
78
|
-
def
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
hierarchical_asset_names(clause, num)
|
86
|
-
end
|
87
|
-
|
88
|
-
def back_anchor_names(docxml)
|
89
|
-
super
|
90
|
-
if annexid = docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
91
|
-
docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
|
92
|
-
else
|
93
|
-
docxml.xpath(ns("//annex[@obligation = 'informative']")).each_with_index do |c, i|
|
94
|
-
annex_names(c, RomanNumerals.to_roman(i + 1))
|
95
|
-
end
|
96
|
-
docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).each_with_index do |c, i|
|
97
|
-
annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def annex_names1(clause, num, level)
|
103
|
-
@anchors[clause["id"]] = { label: num, xref: "#{@labels["annex_subclause"]} #{num}",
|
104
|
-
level: level, type: "clause" }
|
105
|
-
clause.xpath(ns("./clause")).each_with_index do |c, i|
|
106
|
-
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
72
|
+
def annex_obligation_subtitle(annex, div)
|
73
|
+
type = annex&.document&.root&.at("//bibdata/ext/doctype")&.text ||
|
74
|
+
"recommendation"
|
75
|
+
type = type.split(" ").map {|w| w.capitalize }.join(" ")
|
76
|
+
info = annex["obligation"] == "informative"
|
77
|
+
div.p **{class: "annex_obligation" } do |p|
|
78
|
+
p << (info ? @inform_annex_lbl : @norm_annex_lbl).sub(/%/, type)
|
107
79
|
end
|
108
80
|
end
|
109
81
|
|
@@ -140,77 +112,6 @@ module IsoDoc
|
|
140
112
|
super
|
141
113
|
end
|
142
114
|
|
143
|
-
def initial_anchor_names(d)
|
144
|
-
d.xpath("//xmlns:preface/child::*").each do |c|
|
145
|
-
preface_names(c)
|
146
|
-
end
|
147
|
-
sequential_asset_names(d.xpath("//xmlns:preface/child::*"))
|
148
|
-
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
149
|
-
n = section_names(d.at(ns("//bibliography/clause[title = 'References'] | "\
|
150
|
-
"//bibliography/references[title = 'References']")), n, 1)
|
151
|
-
n = section_names(d.at(ns("//sections/terms | "\
|
152
|
-
"//sections/clause[descendant::terms]")), n, 1)
|
153
|
-
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
154
|
-
clause_names(d, n)
|
155
|
-
middle_section_asset_names(d)
|
156
|
-
termnote_anchor_names(d)
|
157
|
-
termexample_anchor_names(d)
|
158
|
-
end
|
159
|
-
|
160
|
-
def norm_ref(isoxml, out, num)
|
161
|
-
q = "//bibliography/references[title = 'References']"
|
162
|
-
f = isoxml.at(ns(q)) or return num
|
163
|
-
out.div do |div|
|
164
|
-
num = num + 1
|
165
|
-
clause_name(num, @normref_lbl, div, nil)
|
166
|
-
f.elements.reject do |e|
|
167
|
-
%w(reference title bibitem note).include? e.name
|
168
|
-
end.each { |e| parse(e, div) }
|
169
|
-
biblio_list(f, div, false)
|
170
|
-
end
|
171
|
-
num
|
172
|
-
end
|
173
|
-
|
174
|
-
def nonstd_bibitem(list, b, ordinal, biblio)
|
175
|
-
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
176
|
-
ref << "[#{render_identifier(bibitem_ref_code(b))}]"
|
177
|
-
date_note_process(b, ref)
|
178
|
-
insert_tab(ref, 1)
|
179
|
-
reference_format(b, ref)
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def std_bibitem_entry(list, b, ordinal, biblio)
|
184
|
-
nonstd_bibitem(list, b, ordinal, biblio)
|
185
|
-
end
|
186
|
-
|
187
|
-
def reference_format(b, r)
|
188
|
-
reference_format_start(b, r)
|
189
|
-
reference_format_title(b, r)
|
190
|
-
end
|
191
|
-
|
192
|
-
def reference_format_start(b, r)
|
193
|
-
id = bibitem_ref_code(b)
|
194
|
-
r << "Recommendation " if id["type"] == "ITU"
|
195
|
-
r << render_identifier(id)
|
196
|
-
if date = b.at(ns("./date[@type = 'published']"))
|
197
|
-
r << " (#{date.text.sub(/-.*$/, '')})"
|
198
|
-
end
|
199
|
-
r << ", "
|
200
|
-
end
|
201
|
-
|
202
|
-
def reference_format_title(b, r)
|
203
|
-
if ftitle = b.at(ns("./formattedref"))
|
204
|
-
ftitle&.children&.each { |n| parse(n, r) }
|
205
|
-
/\.$/.match(ftitle&.text) or r << "."
|
206
|
-
elsif title = iso_title(b)
|
207
|
-
r.i do |i|
|
208
|
-
title&.children&.each { |n| parse(n, i) }
|
209
|
-
end
|
210
|
-
/\.$/.match(title&.text) or r << "."
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
115
|
def terms_defs_title(node)
|
215
116
|
t = node.at(ns("./title")) and return t.text
|
216
117
|
super
|
@@ -235,8 +136,10 @@ module IsoDoc
|
|
235
136
|
out.div **attr_code(id: node["id"]) do |div|
|
236
137
|
clause_parse_title(node, div, node.at(ns("./title")), out)
|
237
138
|
title = node.at(ns("./title"))&.text&.downcase
|
238
|
-
title == "terms defined elsewhere" and
|
239
|
-
|
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"]
|
240
143
|
if node.at(ns("./clause | ./term")).nil? then out.p "None."
|
241
144
|
else
|
242
145
|
node.children.reject { |c1| c1.name == "title" }.each do |c1|
|
@@ -298,6 +201,16 @@ module IsoDoc
|
|
298
201
|
end
|
299
202
|
out.p(**{ class: "zzSTDTitle2" }) { |p| p << @meta.get[:doctitle] }
|
300
203
|
end
|
204
|
+
|
205
|
+
def make_table_footnote_target(out, fnid, fnref)
|
206
|
+
attrs = { id: fnid, class: "TableFootnoteRef" }
|
207
|
+
out.span do |s|
|
208
|
+
out.span **attrs do |a|
|
209
|
+
a << fnref + ")"
|
210
|
+
end
|
211
|
+
insert_tab(s, 1)
|
212
|
+
end
|
213
|
+
end
|
301
214
|
end
|
302
215
|
end
|
303
216
|
end
|
@@ -71,7 +71,7 @@
|
|
71
71
|
</div>
|
72
72
|
{% endif %}
|
73
73
|
<div>
|
74
|
-
|
74
|
+
<span class="doc-type">{% if stage == "Draft" %}Draft {% endif %}{{ doctype }}</span>
|
75
75
|
<span class="ITU-sector">ITU-{{ bureau }}</span>
|
76
76
|
<span class="doc-identifier">{{ docnumber }}</span>
|
77
77
|
</div>
|
@@ -14,6 +14,25 @@ p.Sourcecode, li.Sourcecode, div.Sourcecode, pre.Sourcecode, pre
|
|
14
14
|
mso-fareast-font-family:Calibri;
|
15
15
|
mso-bidi-font-family:"Courier New";
|
16
16
|
mso-ansi-language:EN-GB;}
|
17
|
+
p.annex_obligation, li.annex_obligation, div.annex_obligation
|
18
|
+
{mso-style-unhide:no;
|
19
|
+
mso-style-qformat:yes;
|
20
|
+
mso-style-parent:"";
|
21
|
+
margin-top:6.0pt;
|
22
|
+
margin-right:0cm;
|
23
|
+
margin-bottom:0cm;
|
24
|
+
margin-left:0cm;
|
25
|
+
margin-bottom:.0001pt;
|
26
|
+
text-align:center;
|
27
|
+
mso-pagination:widow-orphan;
|
28
|
+
tab-stops:39.7pt 59.55pt 79.4pt 99.25pt;
|
29
|
+
mso-layout-grid-align:none;
|
30
|
+
punctuation-wrap:simple;
|
31
|
+
text-autospace:none;
|
32
|
+
font-size:12pt;
|
33
|
+
font-family:$bodyfont;
|
34
|
+
mso-fareast-font-family:"Times New Roman";
|
35
|
+
mso-ansi-language:EN-US;}
|
17
36
|
p.Biblio, li.Biblio, div.Biblio, p.NormRef, li.NormRef, div.NormRef
|
18
37
|
{mso-style-unhide:no;
|
19
38
|
mso-style-qformat:yes;
|
@@ -122,7 +141,7 @@ p.TableTitle
|
|
122
141
|
mso-fareast-font-family:$bodyfont;
|
123
142
|
mso-bidi-font-family:$bodyfont;
|
124
143
|
mso-ansi-language:EN-GB;}
|
125
|
-
p.Note, div.Note, li.Note
|
144
|
+
p.Note, div.Note, li.Note
|
126
145
|
{mso-style-unhide:no;
|
127
146
|
mso-style-qformat:yes;
|
128
147
|
margin-top:4.0pt;
|
@@ -143,6 +162,28 @@ p.Note, div.Note, li.Note, p.TableFootnote, div.TableFootnote, li.TableFootnote
|
|
143
162
|
mso-fareast-font-family:$bodyfont;
|
144
163
|
mso-bidi-font-family:$bodyfont;
|
145
164
|
mso-ansi-language:EN-GB;}
|
165
|
+
p.TableFootnote, div.TableFootnote, li.TableFootnote
|
166
|
+
{mso-style-unhide:no;
|
167
|
+
mso-style-qformat:yes;
|
168
|
+
margin-top:2.0pt;
|
169
|
+
margin-right:0cm;
|
170
|
+
margin-bottom:2.0pt;
|
171
|
+
margin-left:14.2pt;
|
172
|
+
text-indent:-14.2pt;
|
173
|
+
margin-bottom:.0001pt;
|
174
|
+
text-align:justify;
|
175
|
+
text-justify:inter-ideograph;
|
176
|
+
mso-pagination:widow-orphan;
|
177
|
+
tab-stops:39.7pt 59.55pt 79.4pt 99.25pt;
|
178
|
+
mso-layout-grid-align:none;
|
179
|
+
punctuation-wrap:simple;
|
180
|
+
text-autospace:none;
|
181
|
+
font-size:11.0pt;
|
182
|
+
mso-bidi-font-size:10.0pt;
|
183
|
+
font-family:$bodyfont;
|
184
|
+
mso-fareast-font-family:$bodyfont;
|
185
|
+
mso-bidi-font-family:$bodyfont;
|
186
|
+
mso-ansi-language:EN-GB;}
|
146
187
|
p.FooterQP, li.FooterQP, div.FooterQP
|
147
188
|
{mso-style-name:Footer_QP;
|
148
189
|
mso-style-unhide:no;
|
@@ -205,6 +246,28 @@ p.ANNEX, li.ANNEX, div.ANNEX
|
|
205
246
|
mso-fareast-language:JA;
|
206
247
|
font-weight:bold;
|
207
248
|
mso-bidi-font-weight:normal;}
|
249
|
+
p.Normalaftertitle, li.Normalaftertitle, div.Normalaftertitle
|
250
|
+
{mso-style-name:Normal_after_title;
|
251
|
+
mso-style-unhide:no;
|
252
|
+
mso-style-next:Normal;
|
253
|
+
margin-top:18.0pt;
|
254
|
+
margin-right:0cm;
|
255
|
+
margin-bottom:0cm;
|
256
|
+
margin-left:0cm;
|
257
|
+
margin-bottom:.0001pt;
|
258
|
+
text-align:justify;
|
259
|
+
text-justify:inter-ideograph;
|
260
|
+
mso-pagination:widow-orphan;
|
261
|
+
tab-stops:39.7pt 59.55pt 79.4pt 99.25pt;
|
262
|
+
mso-layout-grid-align:none;
|
263
|
+
punctuation-wrap:simple;
|
264
|
+
text-autospace:none;
|
265
|
+
font-size:12.0pt;
|
266
|
+
mso-bidi-font-size:10.0pt;
|
267
|
+
font-family:$bodyfont;
|
268
|
+
mso-fareast-font-family:$bodyfont;
|
269
|
+
mso-ansi-language:EN-GB;
|
270
|
+
mso-fareast-language:EN-US;}
|
208
271
|
p.BiblioTitle, li.BiblioTitle, div.BiblioTitle
|
209
272
|
{mso-style-name:"Biblio Title";
|
210
273
|
mso-style-noshow:yes;
|
@@ -352,9 +415,13 @@ p.TermNum, li.TermNum, div.TermNum
|
|
352
415
|
mso-style-priority:7;
|
353
416
|
mso-style-unhide:no;
|
354
417
|
mso-style-next:"Term\(s\)";
|
355
|
-
margin:
|
356
|
-
margin-
|
418
|
+
margin-top:6.0pt;
|
419
|
+
margin-right:0cm;
|
420
|
+
margin-bottom:0cm;
|
421
|
+
margin-left:0cm;
|
357
422
|
line-height:12.0pt;
|
423
|
+
text-align:justify;
|
424
|
+
text-justify:inter-ideograph;
|
358
425
|
mso-pagination:widow-orphan;
|
359
426
|
page-break-after:avoid;
|
360
427
|
tab-stops:20.15pt;
|
@@ -793,8 +860,8 @@ span.stem
|
|
793
860
|
mso-ascii-font-family:"Cambria Math";
|
794
861
|
font-style:
|
795
862
|
italic;}
|
796
|
-
div.formula
|
797
|
-
{tab-stops:right
|
863
|
+
div.Zormula, div.formula p
|
864
|
+
{tab-stops:39.7pt center 241.0pt right 17.0cm;}
|
798
865
|
body
|
799
866
|
{tab-interval:36.0pt;}
|
800
867
|
dt
|
@@ -823,8 +890,9 @@ div.coverpage_warning
|
|
823
890
|
{color:#485094;
|
824
891
|
font-size:10.0pt;}
|
825
892
|
|
826
|
-
a.TableFootnoteRef
|
893
|
+
a.TableFootnoteRef, span.TableFootnoteRef
|
827
894
|
{mso-style-priority:99;
|
895
|
+
mso-style-parent:"Footnote Reference";
|
828
896
|
vertical-align:super;}
|
829
897
|
|
830
898
|
aside {
|
@@ -833,18 +901,26 @@ div.coverpage_warning
|
|
833
901
|
|
834
902
|
.example-title {
|
835
903
|
font-weight: bold;
|
836
|
-
margin-left:
|
904
|
+
margin-left: 0pt;
|
837
905
|
}
|
838
906
|
|
839
907
|
p.example, li.example, div.example, td.example {
|
840
|
-
margin-top: 0cm;
|
841
|
-
margin-right: 36.0pt;
|
842
|
-
margin-bottom: 0cm;
|
843
|
-
margin-left: 36.0pt;
|
844
908
|
mso-pagination:none;
|
845
909
|
font-size:10.0pt;
|
846
910
|
font-family:$bodyfont;}
|
847
911
|
|
912
|
+
div.example {
|
913
|
+
margin-right: 0pt;
|
914
|
+
margin-left: 0pt;
|
915
|
+
margin-top: 0cm;
|
916
|
+
margin-bottom: 0cm;
|
917
|
+
}
|
918
|
+
|
919
|
+
p.example, li.example {
|
920
|
+
margin-right: 0pt;
|
921
|
+
margin-left: 0pt;
|
922
|
+
}
|
923
|
+
|
848
924
|
td.example p.MsoListParagraph {
|
849
925
|
font-size: 10.0pt;
|
850
926
|
}
|
@@ -865,5 +941,5 @@ table.dl
|
|
865
941
|
mso-table-layout-alt: auto;
|
866
942
|
margin-right:0cm;
|
867
943
|
margin-bottom:11.0pt;
|
868
|
-
margin-left:
|
944
|
+
margin-left:0cm;}
|
869
945
|
|
@@ -27,7 +27,7 @@
|
|
27
27
|
<o:lock v:ext="edit" aspectratio="t"/>
|
28
28
|
</v:shapetype><v:shape id="Picture_x0020_2" o:spid="_x0000_s1026" type="#_x0000_t75"
|
29
29
|
alt="Fond-Rec_e" style='position:absolute;left:0;text-align:left;
|
30
|
-
margin-left:-75.7pt;margin-top:-
|
30
|
+
margin-left:-75.7pt;margin-top:-60.0pt;width:123.6pt;height:848.15pt;
|
31
31
|
z-index:251659264;visibility:visible;mso-wrap-style:square;
|
32
32
|
mso-width-percent:0;mso-height-percent:0;mso-wrap-distance-left:9pt;
|
33
33
|
mso-wrap-distance-top:0;mso-wrap-distance-right:9pt;
|
@@ -229,9 +229,9 @@
|
|
229
229
|
normal'><span lang="EN-GB" style='font-size:16.0pt;mso-bidi-font-size:10.0pt'>PREPUBLISHED</span></i></b></span><b
|
230
230
|
style='mso-bidi-font-weight:normal'><i style='mso-bidi-font-style:normal'><span
|
231
231
|
lang="EN-GB" style='font-size:16.0pt;mso-bidi-font-size:10.0pt'><span
|
232
|
-
style='mso-spacerun:yes'> </span>
|
232
|
+
style='mso-spacerun:yes'> </span>{{ doctype | upcase }}<o:p></o:p></span></i></b></p>
|
233
233
|
<p class="MsoNormal" style='tab-stops:right 17.0cm'><span lang="EN-GB">This
|
234
|
-
|
234
|
+
prepublication is an unedited version of a recently approved {{doctype}}.
|
235
235
|
It will be replaced by the published version after editing. Therefore,
|
236
236
|
there will be differences between this prepublication and the published
|
237
237
|
version.</span><span lang="EN-GB" style='font-size:9.0pt;mso-bidi-font-size:
|
@@ -263,7 +263,7 @@
|
|
263
263
|
margin-bottom:12.0pt;margin-left:0cm;text-align:left;tab-stops:39.7pt 59.55pt 79.4pt 99.25pt right 17.0cm'><span
|
264
264
|
style='mso-bookmark:_Hlk526346232'><a name="dnum2e"></a><span lang="EN-US"
|
265
265
|
style='font-size:16.0pt;mso-bidi-font-size:10.0pt;font-family:"Arial",sans-serif;
|
266
|
-
mso-ansi-language:EN-US'>
|
266
|
+
mso-ansi-language:EN-US'>{% if stage == "Draft" %}Draft {% endif %}{{ doctype }}<span style='mso-spacerun:yes'>
|
267
267
|
</span>ITU‑{{ bureau }}<span style='mso-spacerun:yes'> </span>{{ docnumber }}<o:p></o:p></span></span></p>
|
268
268
|
<span style='mso-bookmark:_Hlk526346232'></span>
|
269
269
|
<p class="MsoNormal" align="left" style='margin-top:3.0pt;text-align:left;
|
@@ -92,6 +92,8 @@ p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
|
|
92
92
|
margin-top:0cm;
|
93
93
|
margin-right:0cm;
|
94
94
|
margin-bottom:6.0pt;
|
95
|
+
text-align:justify;
|
96
|
+
text-justify:inter-ideograph;
|
95
97
|
/* do not put in margin-left, it is specific to list level */
|
96
98
|
mso-add-space:auto;
|
97
99
|
mso-pagination:widow-orphan;
|
@@ -107,6 +109,8 @@ p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphC
|
|
107
109
|
margin-top:0cm;
|
108
110
|
margin-right:0cm;
|
109
111
|
margin-bottom:6.0pt;
|
112
|
+
text-align:justify;
|
113
|
+
text-justify:inter-ideograph;
|
110
114
|
/* do not put in margin-left, it is specific to list level */
|
111
115
|
mso-add-space:auto;
|
112
116
|
mso-pagination:widow-orphan;
|
@@ -122,6 +126,8 @@ p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagrap
|
|
122
126
|
margin-top:0cm;
|
123
127
|
margin-right:0cm;
|
124
128
|
margin-bottom:6.0pt;
|
129
|
+
text-align:justify;
|
130
|
+
text-justify:inter-ideograph;
|
125
131
|
/* do not put in margin-left, it is specific to list level */
|
126
132
|
mso-add-space:auto;
|
127
133
|
mso-pagination:widow-orphan;
|
@@ -137,6 +143,8 @@ p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxS
|
|
137
143
|
margin-top:0cm;
|
138
144
|
margin-right:0cm;
|
139
145
|
margin-bottom:6.0pt;
|
146
|
+
text-align:justify;
|
147
|
+
text-justify:inter-ideograph;
|
140
148
|
/* do not put in margin-left, it is specific to list level */
|
141
149
|
mso-add-space:auto;
|
142
150
|
mso-pagination:widow-orphan;
|
@@ -288,11 +296,15 @@ a:link, span.MsoHyperlink
|
|
288
296
|
{mso-style-unhide:no;
|
289
297
|
mso-style-parent:"";
|
290
298
|
color:blue;
|
299
|
+
font-family:"Arial",sans-serif;
|
300
|
+
font-size:8pt;
|
291
301
|
text-decoration:underline;
|
292
302
|
text-underline:single;}
|
293
303
|
a:visited, span.MsoHyperlinkFollowed
|
294
304
|
{mso-style-unhide:no;
|
295
305
|
mso-style-parent:"";
|
306
|
+
font-family:"Arial",sans-serif;
|
307
|
+
font-size:8pt;
|
296
308
|
color:purple;
|
297
309
|
text-decoration:underline;
|
298
310
|
text-underline:single;}
|
@@ -369,7 +381,7 @@ p.MsoRMPane, li.MsoRMPane, div.MsoRMPane
|
|
369
381
|
mso-fareast-theme-font:minor-fareast;
|
370
382
|
mso-ansi-language:EN-GB;
|
371
383
|
mso-fareast-language:EN-US;}
|
372
|
-
div.figure
|
384
|
+
div.figure, p.figure
|
373
385
|
{text-align: center;}
|
374
386
|
div.pseudocode
|
375
387
|
{
|
@@ -392,7 +404,7 @@ h1
|
|
392
404
|
mso-style-next:Normal;
|
393
405
|
margin-top:18.0pt;
|
394
406
|
margin-right:0cm;
|
395
|
-
margin-bottom:
|
407
|
+
margin-bottom:6pt;
|
396
408
|
margin-left:39.7pt;
|
397
409
|
margin-bottom:.0001pt;
|
398
410
|
text-indent:-39.7pt;
|
@@ -421,8 +433,9 @@ margin-top:36.0pt;
|
|
421
433
|
margin-right:0cm;
|
422
434
|
margin-bottom:0cm;
|
423
435
|
margin-left:0cm;
|
424
|
-
margin-bottom
|
436
|
+
margin-bottom:6pt;
|
425
437
|
text-align:center;
|
438
|
+
text-indent:0cm;
|
426
439
|
mso-pagination:widow-orphan lines-together;
|
427
440
|
page-break-after:avoid;
|
428
441
|
mso-outline-level:1;
|
@@ -447,7 +460,7 @@ p.h1Preface
|
|
447
460
|
mso-style-next:Normal;
|
448
461
|
margin-top:18.0pt;
|
449
462
|
margin-right:0cm;
|
450
|
-
margin-bottom:
|
463
|
+
margin-bottom:6pt;
|
451
464
|
margin-left:39.7pt;
|
452
465
|
margin-bottom:.0001pt;
|
453
466
|
text-indent:-39.7pt;
|
@@ -476,9 +489,10 @@ h1.Annex
|
|
476
489
|
mso-style-next:Normal;
|
477
490
|
margin-top:36.0pt;
|
478
491
|
margin-right:0cm;
|
479
|
-
margin-bottom:
|
492
|
+
margin-bottom:6pt;
|
480
493
|
margin-left:0cm;
|
481
494
|
margin-bottom:.0001pt;
|
495
|
+
text-indent:0cm;
|
482
496
|
text-align:center;
|
483
497
|
mso-pagination:widow-orphan lines-together;
|
484
498
|
page-break-after:avoid;
|
@@ -509,10 +523,10 @@ h1.Annex
|
|
509
523
|
mso-style-next:Normal;
|
510
524
|
margin-top:12.0pt;
|
511
525
|
margin-right:0cm;
|
512
|
-
margin-bottom:
|
526
|
+
margin-bottom:6pt;
|
513
527
|
margin-left:39.7pt;
|
514
528
|
margin-bottom:.0001pt;
|
515
|
-
text-indent
|
529
|
+
text-indent:0cm;
|
516
530
|
mso-pagination:widow-orphan lines-together;
|
517
531
|
page-break-after:avoid;
|
518
532
|
mso-outline-level:2;
|
@@ -539,7 +553,7 @@ h2
|
|
539
553
|
mso-style-next:Normal;
|
540
554
|
margin-top:12.0pt;
|
541
555
|
margin-right:0cm;
|
542
|
-
margin-bottom:
|
556
|
+
margin-bottom:6pt;
|
543
557
|
margin-left:39.7pt;
|
544
558
|
margin-bottom:.0001pt;
|
545
559
|
text-indent:-39.7pt;
|
@@ -569,7 +583,7 @@ h3
|
|
569
583
|
mso-style-next:Normal;
|
570
584
|
margin-top:8.0pt;
|
571
585
|
margin-right:0cm;
|
572
|
-
margin-bottom:
|
586
|
+
margin-bottom:6pt;
|
573
587
|
margin-left:39.7pt;
|
574
588
|
margin-bottom:.0001pt;
|
575
589
|
text-indent:-39.7pt;
|
@@ -597,7 +611,7 @@ h4
|
|
597
611
|
mso-style-next:Normal;
|
598
612
|
margin-top:8.0pt;
|
599
613
|
margin-right:0cm;
|
600
|
-
margin-bottom:
|
614
|
+
margin-bottom:6pt;
|
601
615
|
margin-left:51.05pt;
|
602
616
|
margin-bottom:.0001pt;
|
603
617
|
text-indent:-51.05pt;
|
@@ -628,7 +642,7 @@ h5
|
|
628
642
|
mso-style-next:Normal;
|
629
643
|
margin-top:8.0pt;
|
630
644
|
margin-right:0cm;
|
631
|
-
margin-bottom:
|
645
|
+
margin-bottom:6pt;
|
632
646
|
margin-left:51.05pt;
|
633
647
|
margin-bottom:.0001pt;
|
634
648
|
text-indent:-51.05pt;
|
@@ -659,7 +673,7 @@ h6
|
|
659
673
|
mso-style-next:Normal;
|
660
674
|
margin-top:8.0pt;
|
661
675
|
margin-right:0cm;
|
662
|
-
margin-bottom:
|
676
|
+
margin-bottom:6pt;
|
663
677
|
margin-left:79.4pt;
|
664
678
|
margin-bottom:.0001pt;
|
665
679
|
text-indent:-79.4pt;
|
@@ -688,7 +702,7 @@ p.MsoHeading7, li.MsoHeading7, div.MsoHeading7
|
|
688
702
|
mso-style-next:Normal;
|
689
703
|
margin-top:8.0pt;
|
690
704
|
margin-right:0cm;
|
691
|
-
margin-bottom:
|
705
|
+
margin-bottom:6pt;
|
692
706
|
margin-left:79.4pt;
|
693
707
|
margin-bottom:.0001pt;
|
694
708
|
text-indent:-79.4pt;
|
@@ -714,7 +728,7 @@ p.MsoHeading8, li.MsoHeading8, div.MsoHeading8
|
|
714
728
|
mso-style-next:Normal;
|
715
729
|
margin-top:8.0pt;
|
716
730
|
margin-right:0cm;
|
717
|
-
margin-bottom:
|
731
|
+
margin-bottom:6pt;
|
718
732
|
margin-left:79.4pt;
|
719
733
|
margin-bottom:.0001pt;
|
720
734
|
text-indent:-79.4pt;
|
@@ -740,7 +754,7 @@ p.MsoHeading9, li.MsoHeading9, div.MsoHeading9
|
|
740
754
|
mso-style-next:Βασικό;
|
741
755
|
margin-top:8.0pt;
|
742
756
|
margin-right:0cm;
|
743
|
-
margin-bottom:
|
757
|
+
margin-bottom:6pt;
|
744
758
|
margin-left:79.4pt;
|
745
759
|
margin-bottom:.0001pt;
|
746
760
|
text-indent:-79.4pt;
|
@@ -1517,7 +1531,7 @@ p.ListContLevel1, li.ListContLevel1, div.ListContLevel1
|
|
1517
1531
|
margin-right:0cm;
|
1518
1532
|
margin-bottom:6.0pt;
|
1519
1533
|
mso-pagination:widow-orphan;
|
1520
|
-
font-size:
|
1534
|
+
font-size:12.0pt;
|
1521
1535
|
font-family:$bodyfont;
|
1522
1536
|
mso-ansi-language:EN-AU;
|
1523
1537
|
mso-fareast-language:EN-US;}
|
@@ -1528,7 +1542,7 @@ p.ListContLevel2, li.ListContLevel2, div.ListContLevel2
|
|
1528
1542
|
margin-right:0cm;
|
1529
1543
|
margin-bottom:6.0pt;
|
1530
1544
|
mso-pagination:widow-orphan;
|
1531
|
-
font-size:
|
1545
|
+
font-size:12.0pt;
|
1532
1546
|
font-family:$bodyfont;
|
1533
1547
|
mso-ansi-language:EN-AU;
|
1534
1548
|
mso-fareast-language:EN-US;}
|
@@ -1539,7 +1553,7 @@ p.ListContLevel3, li.ListContLevel3, div.ListContLevel3
|
|
1539
1553
|
margin-right:0cm;
|
1540
1554
|
margin-bottom:6.0pt;
|
1541
1555
|
mso-pagination:widow-orphan;
|
1542
|
-
font-size:
|
1556
|
+
font-size:12.0pt;
|
1543
1557
|
font-family:$bodyfont;
|
1544
1558
|
mso-ansi-language:EN-AU;
|
1545
1559
|
mso-fareast-language:EN-US;}
|
@@ -1550,7 +1564,7 @@ p.ListContLevel4, li.ListContLevel4, div.ListContLevel4
|
|
1550
1564
|
margin-right:0cm;
|
1551
1565
|
margin-bottom:6.0pt;
|
1552
1566
|
mso-pagination:widow-orphan;
|
1553
|
-
font-size:
|
1567
|
+
font-size:12.0pt;
|
1554
1568
|
font-family:$bodyfont;
|
1555
1569
|
mso-ansi-language:EN-AU;
|
1556
1570
|
mso-fareast-language:EN-US;}
|
@@ -1561,7 +1575,7 @@ p.ListContLevel5, li.ListContLevel5, div.ListContLevel5
|
|
1561
1575
|
margin-right:0cm;
|
1562
1576
|
margin-bottom:6.0pt;
|
1563
1577
|
mso-pagination:widow-orphan;
|
1564
|
-
font-size:
|
1578
|
+
font-size:12.0pt;
|
1565
1579
|
font-family:$bodyfont;
|
1566
1580
|
mso-ansi-language:EN-AU;
|
1567
1581
|
mso-fareast-language:EN-US;}
|
@@ -1572,7 +1586,7 @@ p.ListContLevel6, li.ListContLevel6, div.ListContLevel6
|
|
1572
1586
|
margin-right:0cm;
|
1573
1587
|
margin-bottom:6.0pt;
|
1574
1588
|
mso-pagination:widow-orphan;
|
1575
|
-
font-size:
|
1589
|
+
font-size:12.0pt;
|
1576
1590
|
font-family:$bodyfont;
|
1577
1591
|
mso-ansi-language:EN-AU;
|
1578
1592
|
mso-fareast-language:EN-US;}
|
@@ -1583,7 +1597,7 @@ p.ListContLevel7, li.ListContLevel7, div.ListContLevel7
|
|
1583
1597
|
margin-right:0cm;
|
1584
1598
|
margin-bottom:6.0pt;
|
1585
1599
|
mso-pagination:widow-orphan;
|
1586
|
-
font-size:
|
1600
|
+
font-size:12.0pt;
|
1587
1601
|
font-family:$bodyfont;
|
1588
1602
|
mso-ansi-language:EN-AU;
|
1589
1603
|
mso-fareast-language:EN-US;}
|
@@ -1594,7 +1608,7 @@ p.ListContLevel8, li.ListContLevel8, div.ListContLevel8
|
|
1594
1608
|
margin-right:0cm;
|
1595
1609
|
margin-bottom:6.0pt;
|
1596
1610
|
mso-pagination:widow-orphan;
|
1597
|
-
font-size:
|
1611
|
+
font-size:12.0pt;
|
1598
1612
|
font-family:$bodyfont;
|
1599
1613
|
mso-ansi-language:EN-AU;
|
1600
1614
|
mso-fareast-language:EN-US;}
|
@@ -1605,7 +1619,7 @@ p.ListContLevel9, li.ListContLevel9, div.ListContLevel9
|
|
1605
1619
|
margin-right:0cm;
|
1606
1620
|
margin-bottom:6.0pt;
|
1607
1621
|
mso-pagination:widow-orphan;
|
1608
|
-
font-size:
|
1622
|
+
font-size:12.0pt;
|
1609
1623
|
font-family:$bodyfont;
|
1610
1624
|
mso-ansi-language:EN-AU;
|
1611
1625
|
mso-fareast-language:EN-US;}
|
data/lib/isodoc/itu/metadata.rb
CHANGED
@@ -0,0 +1,96 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module ITU
|
7
|
+
module BaseConvert
|
8
|
+
def norm_ref(isoxml, out, num)
|
9
|
+
q = "//bibliography/references[title = 'References']"
|
10
|
+
f = isoxml.at(ns(q)) or return num
|
11
|
+
out.div do |div|
|
12
|
+
num = num + 1
|
13
|
+
clause_name(num, @normref_lbl, div, nil)
|
14
|
+
f.elements.reject do |e|
|
15
|
+
%w(reference title bibitem note).include? e.name
|
16
|
+
end.each { |e| parse(e, div) }
|
17
|
+
biblio_list(f, div, false)
|
18
|
+
end
|
19
|
+
num
|
20
|
+
end
|
21
|
+
|
22
|
+
def nonstd_bibitem(list, b, ordinal, biblio)
|
23
|
+
list.p **attr_code(iso_bibitem_entry_attrs(b, biblio)) do |ref|
|
24
|
+
ref << "[#{render_identifier(bibitem_ref_code(b))}]"
|
25
|
+
date_note_process(b, ref)
|
26
|
+
insert_tab(ref, 1)
|
27
|
+
reference_format(b, ref)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def std_bibitem_entry(list, b, ordinal, biblio)
|
32
|
+
nonstd_bibitem(list, b, ordinal, biblio)
|
33
|
+
end
|
34
|
+
|
35
|
+
def reference_format(b, r)
|
36
|
+
reference_format_start(b, r)
|
37
|
+
reference_format_title(b, r)
|
38
|
+
end
|
39
|
+
|
40
|
+
def titlecase(s)
|
41
|
+
s.gsub(/ |\_|\-/, " ").split(/ /).map(&:capitalize).join(" ")
|
42
|
+
end
|
43
|
+
|
44
|
+
def bibitem_ref_code(b)
|
45
|
+
id = b.at(ns("./docidentifier[@type = 'ITU']"))
|
46
|
+
id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'metanorma' "\
|
47
|
+
"or @type = 'ISSN' or @type = 'ISBN')]"))
|
48
|
+
id ||= b.at(ns("./docidentifier[not(@type = 'DOI' or @type = 'ISSN' or "\
|
49
|
+
"@type = 'ISBN')]"))
|
50
|
+
id ||= b.at(ns("./docidentifier"))
|
51
|
+
return id if id
|
52
|
+
id = Nokogiri::XML::Node.new("docidentifier", b.document)
|
53
|
+
id.text = "(NO ID)"
|
54
|
+
id
|
55
|
+
end
|
56
|
+
|
57
|
+
def multi_bibitem_ref_code(b)
|
58
|
+
id = b.xpath(ns("./docidentifier[not(@type = 'DOI' or @type = "\
|
59
|
+
"'metanorma' or @type = 'ISSN' or @type = 'ISBN')]"))
|
60
|
+
id.empty? and id = b.xpath(ns("./docidentifier[not(@type = 'DOI' or "\
|
61
|
+
"@type = 'ISSN' or @type = 'ISBN')]"))
|
62
|
+
id.empty? and id = b.xpath(ns("./docidentifier"))
|
63
|
+
return ["(NO ID)"] if id.empty?
|
64
|
+
id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
|
65
|
+
end
|
66
|
+
|
67
|
+
def render_identifiers(ids)
|
68
|
+
ids.map do |id|
|
69
|
+
(id["type"] == "ITU" ? titlecase(id.parent&.at(ns("./ext/doctype"))&.text ||
|
70
|
+
"recommendation") + " " : "") +
|
71
|
+
docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
|
72
|
+
end.join(" | ")
|
73
|
+
end
|
74
|
+
|
75
|
+
def reference_format_start(b, r)
|
76
|
+
id = multi_bibitem_ref_code(b)
|
77
|
+
r << render_identifiers(id)
|
78
|
+
date = b.at(ns("./date[@type = 'published']")) and
|
79
|
+
r << " (#{date.text.sub(/-.*$/, '')})"
|
80
|
+
r << ", "
|
81
|
+
end
|
82
|
+
|
83
|
+
def reference_format_title(b, r)
|
84
|
+
if ftitle = b.at(ns("./formattedref"))
|
85
|
+
ftitle&.children&.each { |n| parse(n, r) }
|
86
|
+
/\.$/.match(ftitle&.text) or r << "."
|
87
|
+
elsif title = iso_title(b)
|
88
|
+
r.i do |i|
|
89
|
+
title&.children&.each { |n| parse(n, i) }
|
90
|
+
end
|
91
|
+
/\.$/.match(title&.text) or r << "."
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -10,6 +10,7 @@ module IsoDoc
|
|
10
10
|
class WordConvert < IsoDoc::WordConvert
|
11
11
|
def initialize(options)
|
12
12
|
@libdir = File.dirname(__FILE__)
|
13
|
+
@hierarchical_assets = options[:hierarchical_assets]
|
13
14
|
super
|
14
15
|
end
|
15
16
|
|
@@ -21,7 +22,7 @@ module IsoDoc
|
|
21
22
|
make_body3(body, docxml)
|
22
23
|
end
|
23
24
|
end
|
24
|
-
|
25
|
+
|
25
26
|
def make_body2(body, docxml)
|
26
27
|
body.div **{ class: "WordSection2" } do |div2|
|
27
28
|
info docxml, div2
|
@@ -59,17 +60,43 @@ module IsoDoc
|
|
59
60
|
end
|
60
61
|
|
61
62
|
def word_term_cleanup(docxml)
|
62
|
-
|
63
|
-
|
63
|
+
docxml.xpath("//p[@class = 'TermNum']").each do |t|
|
64
|
+
end
|
64
65
|
end
|
65
66
|
|
66
67
|
def word_cleanup(docxml)
|
68
|
+
word_footnote_cleanup(docxml)
|
69
|
+
word_title_cleanup(docxml)
|
67
70
|
word_preface_cleanup(docxml)
|
68
71
|
word_term_cleanup(docxml)
|
72
|
+
word_history_cleanup(docxml)
|
69
73
|
super
|
70
74
|
docxml
|
71
75
|
end
|
72
76
|
|
77
|
+
def word_footnote_cleanup(docxml)
|
78
|
+
docxml.xpath("//aside").each do |a|
|
79
|
+
a.first_element_child.children.first.previous =
|
80
|
+
'<span style="mso-tab-count:1"/>'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def word_title_cleanup(docxml)
|
85
|
+
docxml.xpath("p[@class = 'h1Preface'] | p[@class = 'h2Annex'] | "\
|
86
|
+
"//h1 | //h2 | //h3 | //h4 | //h5 | //h6 | "\
|
87
|
+
"//p[@class = 'annex_obligation']").each do |h|
|
88
|
+
h&.next_element&.name == "p" or next
|
89
|
+
h.next_element["class"] ||= "Normalaftertitle"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def word_history_cleanup(docxml)
|
94
|
+
docxml.xpath("//div[@id='_history']//table").each do |t|
|
95
|
+
t["class"] = "MsoNormalTable"
|
96
|
+
t.xpath(".//td").each { |td| td["style"] = nil }
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
73
100
|
def word_preface(docxml)
|
74
101
|
super
|
75
102
|
abstractbox = docxml.at("//div[@id='abstractbox']")
|
@@ -84,21 +111,22 @@ module IsoDoc
|
|
84
111
|
end
|
85
112
|
|
86
113
|
def formula_parse1(node, out)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
114
|
+
out.div **attr_code(id: node["id"], class: "formula") do |div|
|
115
|
+
div.p **attr_code(class: "formula") do |p|
|
116
|
+
insert_tab(div, 2)
|
117
|
+
parse(node.at(ns("./stem")), div)
|
118
|
+
lbl = anchor(node['id'], :label, false)
|
119
|
+
unless lbl.nil?
|
120
|
+
insert_tab(div, 1)
|
121
|
+
div << "(#{lbl})"
|
122
|
+
end
|
95
123
|
end
|
96
124
|
end
|
97
125
|
end
|
98
|
-
end
|
99
126
|
|
100
127
|
def convert1(docxml, filename, dir)
|
101
|
-
FileUtils.cp html_doc_path('itu-document-comb.png'),
|
128
|
+
FileUtils.cp html_doc_path('itu-document-comb.png'),
|
129
|
+
File.join(@localdir, "itu-document-comb.png")
|
102
130
|
FileUtils.cp html_doc_path('logo.png'), File.join(@localdir, "logo.png")
|
103
131
|
@files_to_delete << File.join(@localdir, "itu-document-comb.png")
|
104
132
|
@files_to_delete << File.join(@localdir, "logo.png")
|
@@ -106,23 +134,21 @@ module IsoDoc
|
|
106
134
|
end
|
107
135
|
|
108
136
|
def default_fonts(options)
|
109
|
-
{
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
137
|
+
{ bodyfont: (options[:script] == "Hans" ? '"SimSun",serif' :
|
138
|
+
'"Times New Roman",serif'),
|
139
|
+
headerfont: (options[:script] == "Hans" ? '"SimHei",sans-serif' :
|
140
|
+
'"Times New Roman",serif'),
|
141
|
+
monospacefont: '"Courier New",monospace' }
|
114
142
|
end
|
115
143
|
|
116
144
|
def default_file_locations(options)
|
117
|
-
{
|
118
|
-
wordstylesheet: html_doc_path("wordstyle.scss"),
|
145
|
+
{ wordstylesheet: html_doc_path("wordstyle.scss"),
|
119
146
|
standardstylesheet: html_doc_path("itu.scss"),
|
120
147
|
header: html_doc_path("header.html"),
|
121
148
|
wordcoverpage: html_doc_path("word_itu_titlepage.html"),
|
122
149
|
wordintropage: html_doc_path("word_itu_intro.html"),
|
123
150
|
ulstyle: "l3",
|
124
|
-
olstyle: "l2",
|
125
|
-
}
|
151
|
+
olstyle: "l2", }
|
126
152
|
end
|
127
153
|
|
128
154
|
def word_example_cleanup(docxml)
|
@@ -132,6 +158,10 @@ module IsoDoc
|
|
132
158
|
end
|
133
159
|
end
|
134
160
|
|
161
|
+
def make_tr_attr(td, row, totalrows, header)
|
162
|
+
super.merge(valign: "top")
|
163
|
+
end
|
164
|
+
|
135
165
|
include BaseConvert
|
136
166
|
end
|
137
167
|
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
module IsoDoc
|
6
|
+
module ITU
|
7
|
+
module BaseConvert
|
8
|
+
def annex_name_lbl(clause, num)
|
9
|
+
lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl
|
10
|
+
l10n("<b>#{lbl} #{num}</b>")
|
11
|
+
end
|
12
|
+
|
13
|
+
def annex_names(clause, num)
|
14
|
+
lbl = clause["obligation"] == "informative" ? @appendix_lbl : @annex_lbl
|
15
|
+
@anchors[clause["id"]] =
|
16
|
+
{ label: annex_name_lbl(clause, num), type: "clause",
|
17
|
+
xref: "#{lbl} #{num}", level: 1 }
|
18
|
+
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).
|
19
|
+
each_with_index do |c, i|
|
20
|
+
annex_names1(c, "#{num}.#{i + 1}", 2)
|
21
|
+
end
|
22
|
+
hierarchical_asset_names(clause, num)
|
23
|
+
end
|
24
|
+
|
25
|
+
def back_anchor_names(docxml)
|
26
|
+
super
|
27
|
+
if annexid = docxml&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
28
|
+
docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
|
29
|
+
else
|
30
|
+
docxml.xpath(ns("//annex[@obligation = 'informative']")).each_with_index do |c, i|
|
31
|
+
annex_names(c, RomanNumerals.to_roman(i + 1))
|
32
|
+
end
|
33
|
+
docxml.xpath(ns("//annex[not(@obligation = 'informative')]")).each_with_index do |c, i|
|
34
|
+
annex_names(c, (65 + i + (i > 7 ? 1 : 0)).chr.to_s)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def annex_names1(clause, num, level)
|
40
|
+
@anchors[clause["id"]] =
|
41
|
+
{ label: num, xref: "#{@labels["annex_subclause"]} #{num}",
|
42
|
+
level: level, type: "clause" }
|
43
|
+
clause.xpath(ns("./clause | ./references | ./terms | ./definitions")).each_with_index do |c, i|
|
44
|
+
annex_names1(c, "#{num}.#{i + 1}", level + 1)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def initial_anchor_names(d)
|
49
|
+
d.xpath("//xmlns:preface/child::*").each do |c|
|
50
|
+
preface_names(c)
|
51
|
+
end
|
52
|
+
@hierarchical_assets ?
|
53
|
+
hierarchical_asset_names(d.xpath("//xmlns:preface/child::*"), "Preface") :
|
54
|
+
sequential_asset_names(d.xpath("//xmlns:preface/child::*"))
|
55
|
+
n = section_names(d.at(ns("//clause[title = 'Scope']")), 0, 1)
|
56
|
+
n = section_names(d.at(ns("//bibliography/clause[title = 'References'] | "\
|
57
|
+
"//bibliography/references[title = 'References']")), n, 1)
|
58
|
+
n = section_names(d.at(ns("//sections/terms | "\
|
59
|
+
"//sections/clause[descendant::terms]")), n, 1)
|
60
|
+
n = section_names(d.at(ns("//sections/definitions")), n, 1)
|
61
|
+
clause_names(d, n)
|
62
|
+
middle_section_asset_names(d)
|
63
|
+
termnote_anchor_names(d)
|
64
|
+
termexample_anchor_names(d)
|
65
|
+
end
|
66
|
+
|
67
|
+
def hiersep
|
68
|
+
"-"
|
69
|
+
end
|
70
|
+
|
71
|
+
def middle_section_asset_names(d)
|
72
|
+
return super unless @hierarchical_assets
|
73
|
+
middle_sections = "//clause[title = 'Scope'] | "\
|
74
|
+
"//foreword | //introduction | "\
|
75
|
+
"//references[title = 'References' or title = 'references'] | "\
|
76
|
+
"//sections/terms | "\
|
77
|
+
"//sections/definitions | //clause[parent::sections]"
|
78
|
+
d.xpath(ns(middle_sections)).each do |c|
|
79
|
+
hierarchical_asset_names(c, @anchors[c["id"]][:label])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def sequential_figure_names(clause)
|
84
|
+
c = IsoDoc::Function::XrefGen::Counter.new
|
85
|
+
j = 0
|
86
|
+
clause.xpath(ns(".//figure[not(@type = 'pseudocode')]")).each do |t|
|
87
|
+
if t.parent.name == "figure" then j += 1
|
88
|
+
else
|
89
|
+
j = 0
|
90
|
+
c.increment(t)
|
91
|
+
end
|
92
|
+
label = c.print + (j.zero? ? "" : "-#{(97 + j).chr.to_s}")
|
93
|
+
next if t["id"].nil? || t["id"].empty?
|
94
|
+
@anchors[t["id"]] =
|
95
|
+
anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def hierarchical_figure_names(clause, num)
|
100
|
+
c = IsoDoc::Function::XrefGen::Counter.new
|
101
|
+
j = 0
|
102
|
+
clause.xpath(ns(".//figure[not(@type = 'pseudocode')]")).each do |t|
|
103
|
+
if t.parent.name == "figure" then j += 1
|
104
|
+
else
|
105
|
+
j = 0
|
106
|
+
c.increment(t)
|
107
|
+
end
|
108
|
+
label = "#{num}#{hiersep}#{c.print}" +
|
109
|
+
(j.zero? ? "" : "#{hierfigsep}#{(97 + j).chr.to_s}")
|
110
|
+
next if t["id"].nil? || t["id"].empty?
|
111
|
+
@anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
|
112
|
+
t["unnumbered"])
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
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: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|
@@ -288,7 +288,9 @@ files:
|
|
288
288
|
- lib/isodoc/itu/i18n-en.yaml
|
289
289
|
- lib/isodoc/itu/metadata.rb
|
290
290
|
- lib/isodoc/itu/pdf_convert.rb
|
291
|
+
- lib/isodoc/itu/ref.rb
|
291
292
|
- lib/isodoc/itu/word_convert.rb
|
293
|
+
- lib/isodoc/itu/xref.rb
|
292
294
|
- lib/metanorma-itu.rb
|
293
295
|
- lib/metanorma/itu.rb
|
294
296
|
- lib/metanorma/itu/processor.rb
|