metanorma-itu 2.2.15 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/itu/base_convert.rb +18 -66
- data/lib/isodoc/itu/html_convert.rb +5 -10
- data/lib/isodoc/itu/i18n-ar.yaml +1 -0
- data/lib/isodoc/itu/i18n-de.yaml +1 -0
- data/lib/isodoc/itu/i18n-en.yaml +1 -0
- data/lib/isodoc/itu/i18n-es.yaml +1 -0
- data/lib/isodoc/itu/i18n-fr.yaml +1 -0
- data/lib/isodoc/itu/i18n-ru.yaml +1 -0
- data/lib/isodoc/itu/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/itu/itu.implementers-guide.xsl +135 -57
- data/lib/isodoc/itu/itu.in-force.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +135 -57
- data/lib/isodoc/itu/itu.recommendation.xsl +135 -57
- data/lib/isodoc/itu/itu.resolution.xsl +135 -57
- data/lib/isodoc/itu/itu.service-publication.xsl +135 -57
- data/lib/isodoc/itu/itu.technical-paper.xsl +135 -57
- data/lib/isodoc/itu/itu.technical-report.xsl +135 -57
- data/lib/isodoc/itu/presentation_bibdata.rb +1 -1
- data/lib/isodoc/itu/presentation_preface.rb +78 -0
- data/lib/isodoc/itu/presentation_xml_convert.rb +62 -59
- data/lib/isodoc/itu/word_convert.rb +0 -27
- data/lib/isodoc/itu/xref.rb +4 -54
- data/lib/isodoc/itu/xref_section.rb +55 -13
- data/lib/metanorma/itu/isodoc.rng +29 -4
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +1 -1
- metadata +5 -4
data/lib/isodoc/itu/xref.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "isodoc"
|
2
2
|
require "fileutils"
|
3
|
-
require_relative "
|
3
|
+
require_relative "xref_section"
|
4
4
|
|
5
5
|
module IsoDoc
|
6
6
|
module ITU
|
@@ -20,59 +20,10 @@ module IsoDoc
|
|
20
20
|
@hierarchical_assets = options[:hierarchicalassets]
|
21
21
|
end
|
22
22
|
|
23
|
-
def back_anchor_names(docxml)
|
24
|
-
super
|
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
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def informative_annex_names(docxml)
|
37
|
-
i = Counter.new(0, numerals: :roman)
|
38
|
-
docxml.xpath(ns("//annex[@obligation = 'informative']"))
|
39
|
-
.each do |c|
|
40
|
-
i.increment(c)
|
41
|
-
annex_names(c, i.print.upcase)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def normative_annex_names(docxml)
|
46
|
-
i = Counter.new("@", skip_i: true)
|
47
|
-
docxml.xpath(ns("//annex[not(@obligation = 'informative')]"))
|
48
|
-
.each do |c|
|
49
|
-
i.increment(c)
|
50
|
-
annex_names(c, i.print)
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def initial_anchor_names(doc)
|
55
|
-
@doctype = doc&.at(ns("//bibdata/ext/doctype"))&.text
|
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? || @parse_settings[:clauses]
|
61
|
-
n = Counter.new
|
62
|
-
n = section_names(doc.at(ns("//clause[@type = 'scope']")), n, 1)
|
63
|
-
n = section_names(doc.at(ns(@klass.norm_ref_xpath)), n, 1)
|
64
|
-
n = section_names(
|
65
|
-
doc.at(ns("//sections/terms | //sections/clause[descendant::terms]")), n, 1
|
66
|
-
)
|
67
|
-
n = section_names(doc.at(ns("//sections/definitions")), n, 1)
|
68
|
-
clause_names(doc, n)
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
23
|
def middle_sections
|
73
24
|
"//clause[@type = 'scope'] | " \
|
74
|
-
"//foreword | //introduction | //acknowledgements |
|
75
|
-
"
|
25
|
+
"//foreword | //introduction | //acknowledgements | " \
|
26
|
+
"#{@klass.norm_ref_xpath} | " \
|
76
27
|
"//sections/terms | //preface/clause | " \
|
77
28
|
"//sections/definitions | //clause[parent::sections]"
|
78
29
|
end
|
@@ -90,8 +41,7 @@ module IsoDoc
|
|
90
41
|
end
|
91
42
|
|
92
43
|
def middle_section_asset_names(doc)
|
93
|
-
return super
|
94
|
-
|
44
|
+
@hierarchical_assets or return super
|
95
45
|
doc.xpath(ns(middle_sections)).each do |c|
|
96
46
|
hierarchical_asset_names(c, @anchors[c["id"]][:label])
|
97
47
|
end
|
@@ -1,6 +1,45 @@
|
|
1
1
|
module IsoDoc
|
2
2
|
module ITU
|
3
3
|
class Xref < IsoDoc::Xref
|
4
|
+
def clause_order_annex(docxml)
|
5
|
+
if docxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
|
6
|
+
[{ path: "//annex", multi: true }]
|
7
|
+
else
|
8
|
+
[{ path: "//annex[not(@obligation = 'informative')]", multi: true },
|
9
|
+
{ path: "//annex[@obligation = 'informative']", multi: true }]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def annex_anchor_names(xml)
|
14
|
+
t = clause_order_annex(xml)
|
15
|
+
if annexid = xml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
|
16
|
+
xml.xpath(ns(t[0][:path])).each do |c|
|
17
|
+
annex_names(c, annexid.text)
|
18
|
+
end
|
19
|
+
else
|
20
|
+
annex_names_with_counter(xml, t[0][:path],
|
21
|
+
Counter.new("@", skip_i: true))
|
22
|
+
annex_names_with_counter(xml, t[1][:path],
|
23
|
+
Counter.new(0, numerals: :roman))
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def annex_names_with_counter(docxml, xpath, counter)
|
28
|
+
docxml.xpath(ns(xpath)).each do |c|
|
29
|
+
annex_names(c, counter.increment(c).print.upcase)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def clause_order_preface(_docxml)
|
34
|
+
[{ path: "//boilerplate/*", multi: true },
|
35
|
+
{ path: "//preface/*", multi: true }]
|
36
|
+
end
|
37
|
+
|
38
|
+
def initial_anchor_names(doc)
|
39
|
+
@doctype = doc&.at(ns("//bibdata/ext/doctype"))&.text
|
40
|
+
super
|
41
|
+
end
|
42
|
+
|
4
43
|
def annextype(clause)
|
5
44
|
if clause["obligation"] == "informative" then @labels["appendix"]
|
6
45
|
else @labels["annex"]
|
@@ -38,19 +77,21 @@ module IsoDoc
|
|
38
77
|
end
|
39
78
|
end
|
40
79
|
|
41
|
-
def
|
42
|
-
|
43
|
-
|
44
|
-
.each do |c|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
unnumbered_section_names(c, 1)
|
80
|
+
def main_anchor_names(xml)
|
81
|
+
n = Counter.new
|
82
|
+
clause_order_main(xml).each do |a|
|
83
|
+
xml.xpath(ns(a[:path])).each do |c|
|
84
|
+
section_names(c, n, 1)
|
85
|
+
a[:multi] or break
|
86
|
+
end
|
49
87
|
end
|
50
88
|
end
|
51
89
|
|
52
90
|
def section_names(clause, num, lvl)
|
53
|
-
|
91
|
+
clause.nil? and return num
|
92
|
+
clause["unnumbered"] == "true" and return unnumbered_section_names(
|
93
|
+
clause, 1
|
94
|
+
)
|
54
95
|
|
55
96
|
num.increment(clause)
|
56
97
|
lbl = @doctype == "resolution" ? @labels["section"] : @labels["clause"]
|
@@ -79,11 +120,11 @@ module IsoDoc
|
|
79
120
|
end
|
80
121
|
|
81
122
|
def unnumbered_section_names(clause, lvl)
|
82
|
-
|
83
|
-
|
123
|
+
clause.nil? and return
|
84
124
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
85
125
|
@anchors[clause["id"]] =
|
86
|
-
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl,
|
126
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl,
|
127
|
+
type: "clause" }
|
87
128
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
88
129
|
unnumbered_section_names1(c, lvl + 1)
|
89
130
|
end
|
@@ -92,7 +133,8 @@ module IsoDoc
|
|
92
133
|
def unnumbered_section_names1(clause, level)
|
93
134
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
|
94
135
|
@anchors[clause["id"]] =
|
95
|
-
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level,
|
136
|
+
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: level,
|
137
|
+
type: "clause" }
|
96
138
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
97
139
|
unnumbered_section_names1(c, level + 1)
|
98
140
|
end
|
@@ -17,7 +17,7 @@
|
|
17
17
|
these elements; we just want one namespace for any child grammars
|
18
18
|
of this.
|
19
19
|
-->
|
20
|
-
<!-- VERSION v1.2.
|
20
|
+
<!-- VERSION v1.2.4 -->
|
21
21
|
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
22
22
|
<include href="reqt.rng"/>
|
23
23
|
<include href="basicdoc.rng">
|
@@ -192,9 +192,11 @@
|
|
192
192
|
</attribute>
|
193
193
|
</optional>
|
194
194
|
<attribute name="citeas"/>
|
195
|
-
<
|
196
|
-
<
|
197
|
-
|
195
|
+
<optional>
|
196
|
+
<attribute name="type">
|
197
|
+
<ref name="ReferenceFormat"/>
|
198
|
+
</attribute>
|
199
|
+
</optional>
|
198
200
|
<optional>
|
199
201
|
<attribute name="alt"/>
|
200
202
|
</optional>
|
@@ -836,6 +838,26 @@
|
|
836
838
|
<ref name="paragraph"/>
|
837
839
|
</element>
|
838
840
|
</define>
|
841
|
+
<define name="stem">
|
842
|
+
<element name="stem">
|
843
|
+
<attribute name="type">
|
844
|
+
<choice>
|
845
|
+
<value>MathML</value>
|
846
|
+
<value>AsciiMath</value>
|
847
|
+
<value>LatexMath</value>
|
848
|
+
</choice>
|
849
|
+
</attribute>
|
850
|
+
<attribute name="block">
|
851
|
+
<data type="boolean"/>
|
852
|
+
</attribute>
|
853
|
+
<oneOrMore>
|
854
|
+
<choice>
|
855
|
+
<text/>
|
856
|
+
<ref name="AnyElement"/>
|
857
|
+
</choice>
|
858
|
+
</oneOrMore>
|
859
|
+
</element>
|
860
|
+
</define>
|
839
861
|
<define name="em">
|
840
862
|
<element name="em">
|
841
863
|
<zeroOrMore>
|
@@ -2046,6 +2068,9 @@
|
|
2046
2068
|
</define>
|
2047
2069
|
<define name="termdefinition">
|
2048
2070
|
<element name="definition">
|
2071
|
+
<optional>
|
2072
|
+
<attribute name="type"/>
|
2073
|
+
</optional>
|
2049
2074
|
<choice>
|
2050
2075
|
<ref name="verbaldefinition"/>
|
2051
2076
|
<ref name="nonverbalrep"/>
|
data/metanorma-itu.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0")
|
27
27
|
|
28
28
|
spec.add_dependency "htmlentities", "~> 4.3.4"
|
29
|
-
spec.add_dependency "metanorma-standoc", "~> 2.4
|
29
|
+
spec.add_dependency "metanorma-standoc", "~> 2.5.4"
|
30
30
|
spec.add_dependency "ruby-jing"
|
31
31
|
spec.add_dependency "twitter_cldr", ">= 3.0.0"
|
32
32
|
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.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-28 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.4
|
33
|
+
version: 2.5.4
|
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.4
|
40
|
+
version: 2.5.4
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: ruby-jing
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -309,6 +309,7 @@ files:
|
|
309
309
|
- lib/isodoc/itu/metadata.rb
|
310
310
|
- lib/isodoc/itu/pdf_convert.rb
|
311
311
|
- lib/isodoc/itu/presentation_bibdata.rb
|
312
|
+
- lib/isodoc/itu/presentation_preface.rb
|
312
313
|
- lib/isodoc/itu/presentation_xml_convert.rb
|
313
314
|
- lib/isodoc/itu/ref.rb
|
314
315
|
- lib/isodoc/itu/terms.rb
|