metanorma-itu 2.0.8.1 → 2.1.0
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/html_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_titlepage.html +1 -0
- data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +1 -1
- data/lib/isodoc/itu/html_convert.rb +16 -11
- data/lib/isodoc/itu/init.rb +1 -1
- data/lib/isodoc/itu/itu.implementers-guide.xsl +348 -116
- data/lib/isodoc/itu/itu.in-force.xsl +348 -116
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +348 -116
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +348 -116
- data/lib/isodoc/itu/itu.recommendation.xsl +348 -116
- data/lib/isodoc/itu/itu.resolution.xsl +348 -116
- data/lib/isodoc/itu/itu.service-publication.xsl +348 -116
- data/lib/isodoc/itu/itu.technical-paper.xsl +348 -116
- data/lib/isodoc/itu/itu.technical-report.xsl +348 -116
- data/lib/isodoc/itu/presentation_xml_convert.rb +16 -0
- data/lib/isodoc/itu/ref.rb +20 -32
- data/lib/isodoc/itu/word_cleanup.rb +4 -3
- data/lib/isodoc/itu/xref.rb +42 -27
- data/lib/isodoc/itu/xref_section.rb +0 -15
- data/lib/metanorma/itu/biblio.rng +37 -8
- data/lib/metanorma/itu/isodoc.rng +56 -0
- data/lib/metanorma/itu/version.rb +1 -1
- data/lib/relaton/render/config.yml +3 -0
- data/lib/relaton/render/general.rb +13 -0
- data/metanorma-itu.gemspec +1 -1
- metadata +6 -4
@@ -1,6 +1,7 @@
|
|
1
1
|
require_relative "init"
|
2
2
|
require "roman-numerals"
|
3
3
|
require "isodoc"
|
4
|
+
require_relative "../../relaton/render/general"
|
4
5
|
|
5
6
|
module IsoDoc
|
6
7
|
module ITU
|
@@ -121,6 +122,21 @@ module IsoDoc
|
|
121
122
|
end
|
122
123
|
end
|
123
124
|
|
125
|
+
def bibrenderer
|
126
|
+
::Relaton::Render::ITU::General.new(language: @lang)
|
127
|
+
end
|
128
|
+
|
129
|
+
def bibrender(xml)
|
130
|
+
if f = xml.at(ns("./formattedref"))
|
131
|
+
f << "." unless /\.$/.match?(f.text)
|
132
|
+
else
|
133
|
+
# retain date in order to generate reference tag
|
134
|
+
xml.children =
|
135
|
+
"#{bibrenderer.render(xml.to_xml)}"\
|
136
|
+
"#{xml.xpath(ns('./docidentifier | ./uri | ./note | ./date')).to_xml}"
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
124
140
|
def ddmmmmyyyy(date)
|
125
141
|
if @lang == "zh"
|
126
142
|
ddMMMyyyy(date)
|
data/lib/isodoc/itu/ref.rb
CHANGED
@@ -5,27 +5,27 @@ require "fileutils"
|
|
5
5
|
module IsoDoc
|
6
6
|
module ITU
|
7
7
|
module BaseConvert
|
8
|
-
def nonstd_bibitem(list,
|
9
|
-
list.tr **attr_code(iso_bibitem_entry_attrs(
|
10
|
-
id = render_identifier(bibitem_ref_code(
|
8
|
+
def nonstd_bibitem(list, bibitem, _ordinal, biblio)
|
9
|
+
list.tr **attr_code(iso_bibitem_entry_attrs(bibitem, biblio)) do |ref|
|
10
|
+
id = render_identifier(bibitem_ref_code(bibitem))
|
11
11
|
ref.td **{ style: "vertical-align:top" } do |td|
|
12
12
|
td << (id[:metanorma] || "[#{id[:sdo]}]")
|
13
13
|
&.gsub(/-/, "‑")&.gsub(/ /, " ")
|
14
|
-
date_note_process(
|
14
|
+
date_note_process(bibitem, td)
|
15
15
|
end
|
16
|
-
ref.td { |td| reference_format(
|
16
|
+
ref.td { |td| reference_format(bibitem, td) }
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def std_bibitem_entry(list,
|
21
|
-
nonstd_bibitem(list,
|
20
|
+
def std_bibitem_entry(list, bibitem, ordinal, biblio)
|
21
|
+
nonstd_bibitem(list, bibitem, ordinal, biblio)
|
22
22
|
end
|
23
23
|
|
24
|
-
def biblio_list(
|
24
|
+
def biblio_list(clause, div, biblio)
|
25
25
|
div.table **{ class: "biblio", border: "0" } do |t|
|
26
26
|
i = 0
|
27
27
|
t.tbody do |tbody|
|
28
|
-
|
28
|
+
clause.elements.each do |b|
|
29
29
|
if b.name == "bibitem"
|
30
30
|
next if implicit_reference(b)
|
31
31
|
|
@@ -39,7 +39,7 @@ module IsoDoc
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
42
|
+
clause.xpath(ns("./clause | ./references")).each do |x|
|
43
43
|
parse(x, div)
|
44
44
|
end
|
45
45
|
end
|
@@ -53,7 +53,7 @@ module IsoDoc
|
|
53
53
|
|
54
54
|
def reference_format(biblio, ref)
|
55
55
|
reference_format_start(biblio, ref)
|
56
|
-
|
56
|
+
super
|
57
57
|
end
|
58
58
|
|
59
59
|
def titlecase(str)
|
@@ -61,7 +61,7 @@ module IsoDoc
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def pref_ref_code(bibitem)
|
64
|
-
ret = bibitem.xpath(ns("./docidentifier[@type = 'ITU']"))
|
64
|
+
ret = bibitem.xpath(ns("./docidentifier[@type = 'ITU']"))
|
65
65
|
ret.empty? and ret = super
|
66
66
|
ret
|
67
67
|
end
|
@@ -69,11 +69,11 @@ module IsoDoc
|
|
69
69
|
IGNORE_IDS = "@type = 'DOI' or @type = 'ISSN' or @type = 'ISBN' or "\
|
70
70
|
"@type = 'rfc-anchor' or @type = 'metanorma-ordinal'".freeze
|
71
71
|
|
72
|
-
def multi_bibitem_ref_code(
|
73
|
-
id =
|
74
|
-
|
72
|
+
def multi_bibitem_ref_code(bibitem)
|
73
|
+
id = bibitem.xpath(ns("./docidentifier[not(@type = 'metanorma' or "\
|
74
|
+
"#{IGNORE_IDS})]"))
|
75
75
|
id.empty? and
|
76
|
-
id =
|
76
|
+
id = bibitem.xpath(ns("./docidentifier[not(@type = 'metanorma')]"))
|
77
77
|
return [] if id.empty?
|
78
78
|
|
79
79
|
id.sort_by { |i| i["type"] == "ITU" ? 0 : 1 }
|
@@ -108,25 +108,13 @@ module IsoDoc
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
111
|
-
def reference_format_start(bib,
|
111
|
+
def reference_format_start(bib, out)
|
112
112
|
id = multi_bibitem_ref_code(bib)
|
113
113
|
id1 = render_multi_identifiers(id)
|
114
|
-
|
114
|
+
out << id1
|
115
115
|
date = bib.at(ns("./date[@type = 'published']")) and
|
116
|
-
|
117
|
-
|
118
|
-
end
|
119
|
-
|
120
|
-
def reference_format_title(bib, r)
|
121
|
-
if ftitle = bib.at(ns("./formattedref"))
|
122
|
-
ftitle&.children&.each { |n| parse(n, r) }
|
123
|
-
/\.$/.match(ftitle&.text) or r << "."
|
124
|
-
elsif title = iso_title(bib)
|
125
|
-
r.i do |i|
|
126
|
-
title&.children&.each { |n| parse(n, i) }
|
127
|
-
end
|
128
|
-
/\.$/.match(title&.text) or r << "."
|
129
|
-
end
|
116
|
+
out << " (#{date.text.sub(/-.*$/, '')})"
|
117
|
+
out << ", " if date || !id1.empty?
|
130
118
|
end
|
131
119
|
end
|
132
120
|
end
|
@@ -76,13 +76,13 @@ module IsoDoc
|
|
76
76
|
@wordstylesheet&.write(@landscapestyle)
|
77
77
|
@wordstylesheet&.close
|
78
78
|
end
|
79
|
-
Html2Doc.
|
80
|
-
|
79
|
+
Html2Doc.new(
|
80
|
+
filename: filename,
|
81
81
|
stylesheet: @wordstylesheet&.path,
|
82
82
|
header_file: header&.path, dir: dir,
|
83
83
|
asciimathdelims: [@openmathdelim, @closemathdelim],
|
84
84
|
liststyles: { ul: @ulstyle, ol: @olstyle, steps: "l4" }
|
85
|
-
)
|
85
|
+
).process(result)
|
86
86
|
header&.unlink
|
87
87
|
@wordstylesheet&.unlink
|
88
88
|
end
|
@@ -134,6 +134,7 @@ module IsoDoc
|
|
134
134
|
auth << "<p> </p><p> </p><p> </p>"
|
135
135
|
dest.replace(auth.remove)
|
136
136
|
end
|
137
|
+
coverpage_note_cleanup(docxml)
|
137
138
|
end
|
138
139
|
|
139
140
|
TOPLIST = "[not(ancestor::ul) and not(ancestor::ol)]".freeze
|
data/lib/isodoc/itu/xref.rb
CHANGED
@@ -6,8 +6,11 @@ module IsoDoc
|
|
6
6
|
module ITU
|
7
7
|
class Counter < IsoDoc::XrefGen::Counter
|
8
8
|
def print
|
9
|
-
super
|
10
|
-
|
9
|
+
ret = super or return nil
|
10
|
+
|
11
|
+
ret
|
12
|
+
.sub(/([0-9])(bis|ter|quater|quinquies|sexies|septies|octies|nonies)$/,
|
13
|
+
"\\1<em>\\2</em>")
|
11
14
|
end
|
12
15
|
end
|
13
16
|
|
@@ -19,12 +22,14 @@ module IsoDoc
|
|
19
22
|
|
20
23
|
def back_anchor_names(docxml)
|
21
24
|
super
|
22
|
-
if
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
26
|
+
if annexid = docxml
|
27
|
+
&.at(ns("//bibdata/ext/structuredidentifier/annexid"))&.text
|
28
|
+
docxml.xpath(ns("//annex")).each { |c| annex_names(c, annexid) }
|
29
|
+
else
|
30
|
+
informative_annex_names(docxml)
|
31
|
+
normative_annex_names(docxml)
|
32
|
+
end
|
28
33
|
end
|
29
34
|
end
|
30
35
|
|
@@ -48,25 +53,33 @@ module IsoDoc
|
|
48
53
|
|
49
54
|
def initial_anchor_names(doc)
|
50
55
|
@doctype = doc&.at(ns("//bibdata/ext/doctype"))&.text
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
56
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
57
|
+
doc.xpath(ns("//boilerplate//clause")).each { |c| preface_names(c) }
|
58
|
+
doc.xpath("//xmlns:preface/child::*").each { |c| preface_names(c) }
|
59
|
+
end
|
60
|
+
if @parse_settings.empty?
|
61
|
+
if @hierarchical_assets
|
62
|
+
hierarchical_asset_names(doc.xpath("//xmlns:preface/child::*"),
|
63
|
+
"Preface")
|
64
|
+
else
|
65
|
+
sequential_asset_names(doc.xpath("//xmlns:preface/child::*"))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if @parse_settings.empty? || @parse_settings[:clauses]
|
69
|
+
n = Counter.new
|
70
|
+
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
71
|
+
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
72
|
+
n = section_names(
|
73
|
+
doc.at(ns("//sections/terms | //sections/clause[descendant::terms]")), n, 1
|
74
|
+
)
|
75
|
+
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
76
|
+
clause_names(doc, n)
|
77
|
+
end
|
78
|
+
if @parse_settings.empty?
|
79
|
+
middle_section_asset_names(doc)
|
80
|
+
termnote_anchor_names(doc)
|
81
|
+
termexample_anchor_names(doc)
|
58
82
|
end
|
59
|
-
n = Counter.new
|
60
|
-
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
61
|
-
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
62
|
-
n = section_names(
|
63
|
-
doc.at(ns("//sections/terms | //sections/clause[descendant::terms]")), n, 1
|
64
|
-
)
|
65
|
-
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
66
|
-
clause_names(doc, n)
|
67
|
-
middle_section_asset_names(doc)
|
68
|
-
termnote_anchor_names(doc)
|
69
|
-
termexample_anchor_names(doc)
|
70
83
|
end
|
71
84
|
|
72
85
|
def middle_sections
|
@@ -134,7 +147,9 @@ module IsoDoc
|
|
134
147
|
|
135
148
|
def hierarchical_formula_names(clause, num)
|
136
149
|
c = Counter.new
|
137
|
-
clause.xpath(ns(".//formula")).reject
|
150
|
+
clause.xpath(ns(".//formula")).reject do |n|
|
151
|
+
blank?(n["id"])
|
152
|
+
end.each do |t|
|
138
153
|
@anchors[t["id"]] = anchor_struct(
|
139
154
|
"#{num}-#{c.increment(t).print}", nil,
|
140
155
|
t["inequality"] ? @labels["inequality"] : @labels["formula"],
|
@@ -24,21 +24,6 @@ module IsoDoc
|
|
24
24
|
xref: l10n("#{lbl} #{num}") }
|
25
25
|
end
|
26
26
|
|
27
|
-
def annex_names(clause, num)
|
28
|
-
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
29
|
-
if a = single_annex_special_section(clause)
|
30
|
-
annex_names1(a, num.to_s, 1)
|
31
|
-
else
|
32
|
-
i = Counter.new
|
33
|
-
clause.xpath(ns("./clause | ./references | ./terms | ./definitions"))
|
34
|
-
.each do |c|
|
35
|
-
i.increment(c)
|
36
|
-
annex_names1(c, "#{num}.#{i.print}", 2)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
hierarchical_asset_names(clause, num)
|
40
|
-
end
|
41
|
-
|
42
27
|
def annex_names1(clause, num, level)
|
43
28
|
@anchors[clause["id"]] =
|
44
29
|
{ label: num, elem: @labels["annex_subclause"],
|
@@ -851,17 +851,46 @@
|
|
851
851
|
</define>
|
852
852
|
<define name="bplace">
|
853
853
|
<element name="place">
|
854
|
-
<
|
855
|
-
<
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<group>
|
857
|
+
<ref name="bibliocity"/>
|
858
|
+
<zeroOrMore>
|
859
|
+
<ref name="biblioregion"/>
|
860
|
+
</zeroOrMore>
|
861
|
+
<zeroOrMore>
|
862
|
+
<ref name="bibliocountry"/>
|
863
|
+
</zeroOrMore>
|
864
|
+
</group>
|
865
|
+
</choice>
|
866
|
+
</element>
|
867
|
+
</define>
|
868
|
+
<define name="bibliocity">
|
869
|
+
<element name="city">
|
862
870
|
<text/>
|
863
871
|
</element>
|
864
872
|
</define>
|
873
|
+
<define name="biblioregion">
|
874
|
+
<element name="region">
|
875
|
+
<ref name="RegionType"/>
|
876
|
+
</element>
|
877
|
+
</define>
|
878
|
+
<define name="bibliocountry">
|
879
|
+
<element name="country">
|
880
|
+
<ref name="RegionType"/>
|
881
|
+
</element>
|
882
|
+
</define>
|
883
|
+
<define name="RegionType">
|
884
|
+
<optional>
|
885
|
+
<attribute name="iso"/>
|
886
|
+
</optional>
|
887
|
+
<optional>
|
888
|
+
<attribute name="recommended">
|
889
|
+
<data type="boolean"/>
|
890
|
+
</attribute>
|
891
|
+
</optional>
|
892
|
+
<text/>
|
893
|
+
</define>
|
865
894
|
<define name="bprice">
|
866
895
|
<element name="price">
|
867
896
|
<attribute name="currency"/>
|
@@ -32,6 +32,43 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="admonition">
|
36
|
+
<element name="admonition">
|
37
|
+
<attribute name="type">
|
38
|
+
<ref name="AdmonitionType"/>
|
39
|
+
</attribute>
|
40
|
+
<optional>
|
41
|
+
<attribute name="class"/>
|
42
|
+
</optional>
|
43
|
+
<attribute name="id">
|
44
|
+
<data type="ID"/>
|
45
|
+
</attribute>
|
46
|
+
<optional>
|
47
|
+
<attribute name="uri">
|
48
|
+
<data type="anyURI"/>
|
49
|
+
</attribute>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<attribute name="coverpage">
|
53
|
+
<data type="boolean"/>
|
54
|
+
</attribute>
|
55
|
+
</optional>
|
56
|
+
<optional>
|
57
|
+
<attribute name="notag">
|
58
|
+
<data type="boolean"/>
|
59
|
+
</attribute>
|
60
|
+
</optional>
|
61
|
+
<optional>
|
62
|
+
<ref name="tname"/>
|
63
|
+
</optional>
|
64
|
+
<zeroOrMore>
|
65
|
+
<ref name="paragraph-with-footnote"/>
|
66
|
+
</zeroOrMore>
|
67
|
+
<zeroOrMore>
|
68
|
+
<ref name="note"/>
|
69
|
+
</zeroOrMore>
|
70
|
+
</element>
|
71
|
+
</define>
|
35
72
|
<define name="index">
|
36
73
|
<element name="index">
|
37
74
|
<optional>
|
@@ -851,6 +888,16 @@
|
|
851
888
|
<ref name="MultilingualRenderingType"/>
|
852
889
|
</attribute>
|
853
890
|
</optional>
|
891
|
+
<optional>
|
892
|
+
<attribute name="coverpage">
|
893
|
+
<data type="boolean"/>
|
894
|
+
</attribute>
|
895
|
+
</optional>
|
896
|
+
<optional>
|
897
|
+
<attribute name="notag">
|
898
|
+
<data type="boolean"/>
|
899
|
+
</attribute>
|
900
|
+
</optional>
|
854
901
|
<oneOrMore>
|
855
902
|
<choice>
|
856
903
|
<ref name="paragraph"/>
|
@@ -1178,6 +1225,7 @@
|
|
1178
1225
|
<ref name="concept"/>
|
1179
1226
|
<ref name="add"/>
|
1180
1227
|
<ref name="del"/>
|
1228
|
+
<ref name="span"/>
|
1181
1229
|
</choice>
|
1182
1230
|
</define>
|
1183
1231
|
<define name="add">
|
@@ -1204,6 +1252,14 @@
|
|
1204
1252
|
</choice>
|
1205
1253
|
</element>
|
1206
1254
|
</define>
|
1255
|
+
<define name="span">
|
1256
|
+
<element name="span">
|
1257
|
+
<attribute name="class"/>
|
1258
|
+
<oneOrMore>
|
1259
|
+
<ref name="TextElement"/>
|
1260
|
+
</oneOrMore>
|
1261
|
+
</element>
|
1262
|
+
</define>
|
1207
1263
|
<define name="concept">
|
1208
1264
|
<element name="concept">
|
1209
1265
|
<optional>
|
data/metanorma-itu.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
26
26
|
|
27
27
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
28
|
-
spec.add_dependency "metanorma-standoc", "~> 2.
|
28
|
+
spec.add_dependency "metanorma-standoc", "~> 2.1.0"
|
29
29
|
spec.add_dependency "ruby-jing"
|
30
30
|
spec.add_dependency "twitter_cldr", ">= 3.0.0"
|
31
31
|
spec.add_dependency "tzinfo-data" # we need this for windows only
|
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.1.0
|
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-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: htmlentities
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.
|
33
|
+
version: 2.1.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.
|
40
|
+
version: 2.1.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby-jing
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -335,6 +335,8 @@ files:
|
|
335
335
|
- lib/metanorma/itu/reqt.rng
|
336
336
|
- lib/metanorma/itu/validate.rb
|
337
337
|
- lib/metanorma/itu/version.rb
|
338
|
+
- lib/relaton/render/config.yml
|
339
|
+
- lib/relaton/render/general.rb
|
338
340
|
- metanorma-itu.gemspec
|
339
341
|
homepage: https://github.com/metanorma/metanorma-itu
|
340
342
|
licenses:
|