metanorma-itu 2.0.2 → 2.0.5
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/isodoc/itu/html/itu.css +8 -2
- data/lib/isodoc/itu/html/itu.scss +7 -1
- data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +4 -3
- data/lib/isodoc/itu/html/wordstyle.css +28 -8
- data/lib/isodoc/itu/html/wordstyle.scss +27 -8
- data/lib/isodoc/itu/itu.implementers-guide.xsl +1189 -357
- data/lib/isodoc/itu/itu.in-force.xsl +1189 -357
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +1189 -357
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +1189 -357
- data/lib/isodoc/itu/itu.recommendation.xsl +1189 -357
- data/lib/isodoc/itu/itu.resolution.xsl +1189 -357
- data/lib/isodoc/itu/itu.service-publication.xsl +1189 -357
- data/lib/isodoc/itu/itu.technical-paper.xsl +1189 -357
- data/lib/isodoc/itu/itu.technical-report.xsl +1189 -357
- data/lib/isodoc/itu/metadata.rb +25 -24
- data/lib/isodoc/itu/presentation_xml_convert.rb +13 -0
- data/lib/isodoc/itu/ref.rb +28 -18
- data/lib/isodoc/itu/word_convert.rb +22 -17
- data/lib/isodoc/itu/xref_section.rb +12 -6
- data/lib/metanorma/itu/basicdoc.rng +5 -3
- data/lib/metanorma/itu/biblio.rng +5 -3
- data/lib/metanorma/itu/isodoc.rng +73 -3
- data/lib/metanorma/itu/version.rb +1 -1
- metadata +2 -2
data/lib/isodoc/itu/metadata.rb
CHANGED
@@ -11,6 +11,7 @@ module IsoDoc
|
|
11
11
|
set(:logo_comb, fileloc("itu-document-comb.png"))
|
12
12
|
set(:logo_word, fileloc(n))
|
13
13
|
set(:logo_sp, fileloc("logo-sp.png"))
|
14
|
+
@isodoc = IsoDoc::ITU::HtmlConvert.new({})
|
14
15
|
end
|
15
16
|
|
16
17
|
def fileloc(file)
|
@@ -19,30 +20,30 @@ module IsoDoc
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def title(isoxml, _out)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
set(
|
23
|
+
{ doctitle: "//bibdata/title[@language='#{@lang}'][@type = 'main']",
|
24
|
+
docsubtitle: "//bibdata/title[@language='#{@lang}']"\
|
25
|
+
"[@type = 'subtitle']",
|
26
|
+
amendmenttitle: "//bibdata/title[@language='#{@lang}']"\
|
27
|
+
"[@type = 'amendment']",
|
28
|
+
corrigendumtitle: "//bibdata/title[@language='#{@lang}']"\
|
29
|
+
"[@type = 'corrigendum']",
|
30
|
+
series: "//bibdata/series[@type='main']/title",
|
31
|
+
series1: "//bibdata/series[@type='secondary']/title",
|
32
|
+
series2: "//bibdata/series[@type='tertiary']/title",
|
33
|
+
annextitle: "//bibdata/title[@type='annex']",
|
34
|
+
positiontitle: "//bibdata/title[@type='position-sp']" }.each do |k, v|
|
35
|
+
titleset(isoxml, k, v)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def titleset(isoxml, key, xpath)
|
40
|
+
value = isoxml.at(ns(xpath)) or return
|
41
|
+
out = @isodoc.noko do |xml|
|
42
|
+
xml.span do |s|
|
43
|
+
value.children.each { |c| @isodoc.parse(c, s) }
|
44
|
+
end
|
45
|
+
end.join
|
46
|
+
set(key, out.sub(%r{^<span>}, "").sub(%r{</span>$}, ""))
|
46
47
|
end
|
47
48
|
|
48
49
|
def subtitle(_isoxml, _out)
|
@@ -174,6 +174,19 @@ module IsoDoc
|
|
174
174
|
t.children = "<strong>#{t.children.to_xml}</strong>"
|
175
175
|
end
|
176
176
|
|
177
|
+
def ol_depth(node)
|
178
|
+
return super unless node["class"] == "steps" ||
|
179
|
+
node.at(".//ancestor::xmlns:ol[@class = 'steps']")
|
180
|
+
|
181
|
+
depth = node.ancestors("ul, ol").size + 1
|
182
|
+
type = :arabic
|
183
|
+
type = :alphabet if [2, 7].include? depth
|
184
|
+
type = :roman if [3, 8].include? depth
|
185
|
+
type = :alphabet_upper if [4, 9].include? depth
|
186
|
+
type = :roman_upper if [5, 10].include? depth
|
187
|
+
type
|
188
|
+
end
|
189
|
+
|
177
190
|
include Init
|
178
191
|
end
|
179
192
|
end
|
data/lib/isodoc/itu/ref.rb
CHANGED
@@ -44,24 +44,26 @@ module IsoDoc
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def bracket_if_num(
|
48
|
-
return nil if
|
47
|
+
def bracket_if_num(num)
|
48
|
+
return nil if num.nil?
|
49
49
|
|
50
|
-
|
51
|
-
"[#{
|
50
|
+
num = num.text.sub(/^\[/, "").sub(/\]$/, "")
|
51
|
+
"[#{num}]"
|
52
52
|
end
|
53
53
|
|
54
|
-
def reference_format(
|
55
|
-
reference_format_start(
|
56
|
-
reference_format_title(
|
54
|
+
def reference_format(biblio, ref)
|
55
|
+
reference_format_start(biblio, ref)
|
56
|
+
reference_format_title(biblio, ref)
|
57
57
|
end
|
58
58
|
|
59
|
-
def titlecase(
|
60
|
-
|
59
|
+
def titlecase(str)
|
60
|
+
str.gsub(/ |_|-/, " ").split(/ /).map(&:capitalize).join(" ")
|
61
61
|
end
|
62
62
|
|
63
|
-
def pref_ref_code(
|
64
|
-
|
63
|
+
def pref_ref_code(bibitem)
|
64
|
+
ret = bibitem.xpath(ns("./docidentifier[@type = 'ITU']"))
|
65
|
+
ret.empty? and ret = super
|
66
|
+
ret
|
65
67
|
end
|
66
68
|
|
67
69
|
IGNORE_IDS = "@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN' or "\
|
@@ -84,7 +86,7 @@ module IsoDoc
|
|
84
86
|
else
|
85
87
|
docid_prefix(id["type"], id.text.sub(/^\[/, "").sub(/\]$/, ""))
|
86
88
|
end
|
87
|
-
end.join("
|
89
|
+
end.join(" | ")
|
88
90
|
end
|
89
91
|
|
90
92
|
def doctype_title(id)
|
@@ -98,20 +100,28 @@ module IsoDoc
|
|
98
100
|
end
|
99
101
|
end
|
100
102
|
|
101
|
-
def
|
102
|
-
|
103
|
+
def unbracket(ident)
|
104
|
+
if ident.respond_to?(:size)
|
105
|
+
ident.map { |x| unbracket1(x) }.join(" | ")
|
106
|
+
else
|
107
|
+
unbracket1(ident)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def reference_format_start(bib, r)
|
112
|
+
id = multi_bibitem_ref_code(bib)
|
103
113
|
id1 = render_multi_identifiers(id)
|
104
114
|
r << id1
|
105
|
-
date =
|
115
|
+
date = bib.at(ns("./date[@type = 'published']")) and
|
106
116
|
r << " (#{date.text.sub(/-.*$/, '')})"
|
107
117
|
r << ", " if date || !id1.empty?
|
108
118
|
end
|
109
119
|
|
110
|
-
def reference_format_title(
|
111
|
-
if ftitle =
|
120
|
+
def reference_format_title(bib, r)
|
121
|
+
if ftitle = bib.at(ns("./formattedref"))
|
112
122
|
ftitle&.children&.each { |n| parse(n, r) }
|
113
123
|
/\.$/.match(ftitle&.text) or r << "."
|
114
|
-
elsif title = iso_title(
|
124
|
+
elsif title = iso_title(bib)
|
115
125
|
r.i do |i|
|
116
126
|
title&.children&.each { |n| parse(n, i) }
|
117
127
|
end
|
@@ -23,7 +23,7 @@ module IsoDoc
|
|
23
23
|
|
24
24
|
def make_body2(body, docxml)
|
25
25
|
body.div **{ class: "WordSection2" } do |div2|
|
26
|
-
info docxml, div2
|
26
|
+
info docxml, div2
|
27
27
|
boilerplate docxml, div2
|
28
28
|
preface_block docxml, div2
|
29
29
|
abstract docxml, div2
|
@@ -46,14 +46,14 @@ module IsoDoc
|
|
46
46
|
kw = @meta.get[:keywords]
|
47
47
|
kw.nil? || kw.empty? and return
|
48
48
|
out.div **attr_code(class: "Keyword") do |div|
|
49
|
-
clause_name(nil, "Keywords", div,
|
49
|
+
clause_name(nil, "Keywords", div, class: "IntroTitle")
|
50
50
|
div.p kw.join(", ") + "."
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def formula_parse1(node, out)
|
55
55
|
out.div **attr_code(class: "formula") do |div|
|
56
|
-
div.p **attr_code(class: "formula") do |
|
56
|
+
div.p **attr_code(class: "formula") do |_p|
|
57
57
|
insert_tab(div, 1)
|
58
58
|
parse(node.at(ns("./stem")), div)
|
59
59
|
if lbl = node&.at(ns("./name"))&.text
|
@@ -74,29 +74,34 @@ module IsoDoc
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def default_fonts(options)
|
77
|
-
{ bodyfont: (options[:script] == "Hans"
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
77
|
+
{ bodyfont: (if options[:script] == "Hans"
|
78
|
+
'"Source Han Sans",serif'
|
79
|
+
else
|
80
|
+
'"Times New Roman",serif'
|
81
|
+
end),
|
82
|
+
headerfont: (if options[:script] == "Hans"
|
83
|
+
'"Source Han Sans",sans-serif'
|
84
|
+
else
|
85
|
+
'"Times New Roman",serif'
|
86
|
+
end),
|
87
|
+
monospacefont: '"Courier New",monospace',
|
88
|
+
normalfontsize: "12.0pt",
|
89
|
+
footnotefontsize: "11.0pt",
|
90
|
+
smallerfontsize: "11.0pt",
|
91
|
+
monospacefontsize: "10.0pt" }
|
87
92
|
end
|
88
93
|
|
89
|
-
def default_file_locations(
|
94
|
+
def default_file_locations(_options)
|
90
95
|
{ wordstylesheet: html_doc_path("wordstyle.scss"),
|
91
96
|
standardstylesheet: html_doc_path("itu.scss"),
|
92
97
|
header: html_doc_path("header.html"),
|
93
98
|
wordcoverpage: html_doc_path("word_itu_titlepage.html"),
|
94
99
|
wordintropage: html_doc_path("word_itu_intro.html"),
|
95
100
|
ulstyle: "l3",
|
96
|
-
olstyle: "l2"
|
101
|
+
olstyle: "l2" }
|
97
102
|
end
|
98
103
|
|
99
|
-
def make_tr_attr(
|
104
|
+
def make_tr_attr(tcell, row, totalrows, header)
|
100
105
|
super.merge(valign: "top")
|
101
106
|
end
|
102
107
|
|
@@ -105,7 +110,7 @@ module IsoDoc
|
|
105
110
|
end
|
106
111
|
|
107
112
|
def link_parse(node, out)
|
108
|
-
out.a **attr_code(href: node["target"], title: node["alt"],
|
113
|
+
out.a **attr_code(href: node["target"], title: node["alt"],
|
109
114
|
class: "url") do |l|
|
110
115
|
if node.text.empty?
|
111
116
|
l << node["target"].sub(/^mailto:/, "")
|
@@ -16,11 +16,16 @@ module IsoDoc
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
def
|
19
|
+
def annex_name_anchors(clause, num)
|
20
20
|
lbl = annextype(clause)
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
{ label: annex_name_lbl(clause, num),
|
22
|
+
elem: lbl,
|
23
|
+
type: "clause", value: num.to_s, level: 1,
|
24
|
+
xref: l10n("#{lbl} #{num}") }
|
25
|
+
end
|
26
|
+
|
27
|
+
def annex_names(clause, num)
|
28
|
+
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
24
29
|
if a = single_annex_special_section(clause)
|
25
30
|
annex_names1(a, num.to_s, 1)
|
26
31
|
else
|
@@ -36,7 +41,7 @@ module IsoDoc
|
|
36
41
|
|
37
42
|
def annex_names1(clause, num, level)
|
38
43
|
@anchors[clause["id"]] =
|
39
|
-
{ label: num,
|
44
|
+
{ label: num, elem: @labels["annex_subclause"],
|
40
45
|
xref: @doctype == "resolution" ? num : l10n("#{@labels['annex_subclause']} #{num}"),
|
41
46
|
level: level, type: "clause" }
|
42
47
|
i = Counter.new
|
@@ -65,7 +70,7 @@ module IsoDoc
|
|
65
70
|
lbl = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
|
66
71
|
@anchors[clause["id"]] =
|
67
72
|
{ label: num.print, xref: l10n("#{lbl} #{num.print}"),
|
68
|
-
level: lvl, type: "clause" }
|
73
|
+
level: lvl, type: "clause", elem: lbl }
|
69
74
|
i = Counter.new
|
70
75
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
71
76
|
i.increment(c)
|
@@ -77,6 +82,7 @@ module IsoDoc
|
|
77
82
|
def section_names1(clause, num, level)
|
78
83
|
@anchors[clause["id"]] =
|
79
84
|
{ label: num, level: level,
|
85
|
+
elem: @doctype == "resolution" ? "" : @labels["clause"],
|
80
86
|
xref: @doctype == "resolution" ? num : l10n("#{@labels['clause']} #{num}") }
|
81
87
|
i = Counter.new
|
82
88
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
@@ -173,9 +173,11 @@
|
|
173
173
|
<data type="dateTime"/>
|
174
174
|
</attribute>
|
175
175
|
</optional>
|
176
|
-
<
|
177
|
-
<
|
178
|
-
|
176
|
+
<optional>
|
177
|
+
<attribute name="from">
|
178
|
+
<data type="IDREF"/>
|
179
|
+
</attribute>
|
180
|
+
</optional>
|
179
181
|
<optional>
|
180
182
|
<attribute name="to">
|
181
183
|
<data type="IDREF"/>
|
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|
@@ -152,9 +152,7 @@
|
|
152
152
|
<data type="boolean"/>
|
153
153
|
</attribute>
|
154
154
|
</optional>
|
155
|
-
<
|
156
|
-
<ref name="PureTextElement"/>
|
157
|
-
</oneOrMore>
|
155
|
+
<ref name="XrefBody"/>
|
158
156
|
</element>
|
159
157
|
</define>
|
160
158
|
<define name="erefType">
|
@@ -188,6 +186,42 @@
|
|
188
186
|
<ref name="PureTextElement"/>
|
189
187
|
</oneOrMore>
|
190
188
|
</define>
|
189
|
+
<define name="localityStack">
|
190
|
+
<element name="localityStack">
|
191
|
+
<optional>
|
192
|
+
<attribute name="connective">
|
193
|
+
<choice>
|
194
|
+
<value>and</value>
|
195
|
+
<value>or</value>
|
196
|
+
<value>from</value>
|
197
|
+
<value>to</value>
|
198
|
+
<value/>
|
199
|
+
</choice>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<zeroOrMore>
|
203
|
+
<ref name="locality"/>
|
204
|
+
</zeroOrMore>
|
205
|
+
</element>
|
206
|
+
</define>
|
207
|
+
<define name="sourceLocalityStack">
|
208
|
+
<element name="sourceLocalityStack">
|
209
|
+
<optional>
|
210
|
+
<attribute name="connective">
|
211
|
+
<choice>
|
212
|
+
<value>and</value>
|
213
|
+
<value>or</value>
|
214
|
+
<value>from</value>
|
215
|
+
<value>to</value>
|
216
|
+
<value/>
|
217
|
+
</choice>
|
218
|
+
</attribute>
|
219
|
+
</optional>
|
220
|
+
<zeroOrMore>
|
221
|
+
<ref name="sourceLocality"/>
|
222
|
+
</zeroOrMore>
|
223
|
+
</element>
|
224
|
+
</define>
|
191
225
|
<define name="ul">
|
192
226
|
<element name="ul">
|
193
227
|
<attribute name="id">
|
@@ -1098,6 +1132,16 @@
|
|
1098
1132
|
</define>
|
1099
1133
|
</include>
|
1100
1134
|
<!-- end overrides -->
|
1135
|
+
<define name="image" combine="choice">
|
1136
|
+
<element name="svg">
|
1137
|
+
<oneOrMore>
|
1138
|
+
<choice>
|
1139
|
+
<text/>
|
1140
|
+
<ref name="AnyElement"/>
|
1141
|
+
</choice>
|
1142
|
+
</oneOrMore>
|
1143
|
+
</element>
|
1144
|
+
</define>
|
1101
1145
|
<define name="MultilingualRenderingType">
|
1102
1146
|
<choice>
|
1103
1147
|
<value>common</value>
|
@@ -2631,4 +2675,30 @@
|
|
2631
2675
|
</zeroOrMore>
|
2632
2676
|
</element>
|
2633
2677
|
</define>
|
2678
|
+
<define name="XrefBody">
|
2679
|
+
<zeroOrMore>
|
2680
|
+
<ref name="XrefTarget"/>
|
2681
|
+
</zeroOrMore>
|
2682
|
+
<oneOrMore>
|
2683
|
+
<ref name="PureTextElement"/>
|
2684
|
+
</oneOrMore>
|
2685
|
+
</define>
|
2686
|
+
<define name="XrefTarget">
|
2687
|
+
<element name="location">
|
2688
|
+
<attribute name="target">
|
2689
|
+
<data type="string">
|
2690
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2691
|
+
</data>
|
2692
|
+
</attribute>
|
2693
|
+
<attribute name="connective">
|
2694
|
+
<choice>
|
2695
|
+
<value>and</value>
|
2696
|
+
<value>or</value>
|
2697
|
+
<value>from</value>
|
2698
|
+
<value>to</value>
|
2699
|
+
<value/>
|
2700
|
+
</choice>
|
2701
|
+
</attribute>
|
2702
|
+
</element>
|
2703
|
+
</define>
|
2634
2704
|
</grammar>
|
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: 2.0.
|
4
|
+
version: 2.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|