metanorma-itu 2.2.15 → 2.3.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/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 +102 -43
- data/lib/isodoc/itu/itu.in-force.xsl +102 -43
- data/lib/isodoc/itu/itu.recommendation-annex.xsl +102 -43
- data/lib/isodoc/itu/itu.recommendation-supplement.xsl +102 -43
- data/lib/isodoc/itu/itu.recommendation.xsl +102 -43
- data/lib/isodoc/itu/itu.resolution.xsl +102 -43
- data/lib/isodoc/itu/itu.service-publication.xsl +102 -43
- data/lib/isodoc/itu/itu.technical-paper.xsl +102 -43
- data/lib/isodoc/itu/itu.technical-report.xsl +102 -43
- 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 -57
- data/lib/isodoc/itu/word_convert.rb +0 -27
- data/lib/metanorma/itu/isodoc.rng +26 -4
- data/lib/metanorma/itu/version.rb +1 -1
- data/metanorma-itu.gemspec +1 -1
- metadata +5 -4
@@ -3,6 +3,7 @@ require "roman-numerals"
|
|
3
3
|
require "isodoc"
|
4
4
|
require_relative "../../relaton/render/general"
|
5
5
|
require_relative "presentation_bibdata"
|
6
|
+
require_relative "presentation_preface"
|
6
7
|
|
7
8
|
module IsoDoc
|
8
9
|
module ITU
|
@@ -17,60 +18,6 @@ module IsoDoc
|
|
17
18
|
super
|
18
19
|
end
|
19
20
|
|
20
|
-
def insert_preface_sections(docxml)
|
21
|
-
x = insert_editors_clause(docxml) and
|
22
|
-
editors_insert_pt(docxml).next = x
|
23
|
-
end
|
24
|
-
|
25
|
-
def editors_insert_pt(docxml)
|
26
|
-
docxml.at(ns("//preface")) || docxml.at(ns("//sections"))
|
27
|
-
.add_previous_sibling("<preface> </preface>").first
|
28
|
-
ins = docxml.at(ns("//preface/acknolwedgements")) and return ins
|
29
|
-
docxml.at(ns("//preface")).children[-1]
|
30
|
-
end
|
31
|
-
|
32
|
-
def insert_editors_clause(doc)
|
33
|
-
ret = extract_editors(doc) or return
|
34
|
-
eds = ret[:names].each_with_object([]).with_index do |(_x, acc), i|
|
35
|
-
acc << { name: ret[:names][i], affiliation: ret[:affiliations][i],
|
36
|
-
email: ret[:emails][i] }
|
37
|
-
end
|
38
|
-
editors_clause(eds)
|
39
|
-
end
|
40
|
-
|
41
|
-
def extract_editors(doc)
|
42
|
-
e = doc.xpath(ns("//bibdata/contributor[role/@type = 'editor']/person"))
|
43
|
-
e.empty? and return
|
44
|
-
{ names: @meta.extract_person_names(e),
|
45
|
-
affiliations: @meta.extract_person_affiliations(e),
|
46
|
-
emails: e.reduce([]) { |ret, p| ret << p.at(ns("./email"))&.text } }
|
47
|
-
end
|
48
|
-
|
49
|
-
def editors_clause(eds)
|
50
|
-
ed_lbl = @i18n.inflect(@i18n.get["editor_full"],
|
51
|
-
number: eds.size > 1 ? "pl" : "sg")
|
52
|
-
ed_lbl &&= l10n("#{ed_lbl.capitalize}:")
|
53
|
-
mail_lbl = l10n("#{@i18n.get['email']}: ")
|
54
|
-
ret = <<~SUBMITTING
|
55
|
-
<clause id="_#{UUIDTools::UUID.random_create}" type="editors">
|
56
|
-
<table id="_#{UUIDTools::UUID.random_create}" unnumbered="true"><tbody>
|
57
|
-
SUBMITTING
|
58
|
-
ret += editor_table_entries(eds, ed_lbl, mail_lbl)
|
59
|
-
"#{ret}</tbody></table></clause>"
|
60
|
-
end
|
61
|
-
|
62
|
-
def editor_table_entries(eds, ed_lbl, mail_lbl)
|
63
|
-
eds.each_with_index.with_object([]) do |(n, i), m|
|
64
|
-
mail = ""
|
65
|
-
n[:email] and
|
66
|
-
mail = "#{mail_lbl}<link target='mailto:#{n[:email]}'>" \
|
67
|
-
"#{n[:email]}</link>"
|
68
|
-
aff = n[:affiliation].empty? ? "" : "<br/>#{n[:affiliation]}"
|
69
|
-
th = "<th>#{i.zero? ? ed_lbl : ''}</th>"
|
70
|
-
m << "<tr>#{th}<td>#{n[:name]}#{aff}</td><td>#{mail}</td></tr>"
|
71
|
-
end.join("\n")
|
72
|
-
end
|
73
|
-
|
74
21
|
def prefix_container(container, linkend, node, _target)
|
75
22
|
l10n("#{linkend} #{@i18n.get['in']} #{anchor_xref(node, container)}")
|
76
23
|
end
|
@@ -139,7 +86,7 @@ module IsoDoc
|
|
139
86
|
|
140
87
|
t = elem.at(ns("./title")) and t["depth"] = "1"
|
141
88
|
lbl = @xrefs.anchor(elem["id"], :label, false) or return
|
142
|
-
elem.
|
89
|
+
elem.previous =
|
143
90
|
"<p keep-with-next='true' class='supertitle'>" \
|
144
91
|
"#{@i18n.get['section'].upcase} #{lbl}</p>"
|
145
92
|
end
|
@@ -184,7 +131,7 @@ module IsoDoc
|
|
184
131
|
!idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
|
185
132
|
ret += datefn
|
186
133
|
ret.empty? and return ret
|
187
|
-
ret.gsub(
|
134
|
+
ret.gsub("-", "‑").gsub(/ /, " ")
|
188
135
|
end
|
189
136
|
|
190
137
|
def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
|
@@ -192,7 +139,7 @@ module IsoDoc
|
|
192
139
|
!idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
|
193
140
|
ret += datefn
|
194
141
|
ret.empty? and return ret
|
195
|
-
ret.gsub(
|
142
|
+
ret.gsub("-", "‑").gsub(/ /, " ")
|
196
143
|
end
|
197
144
|
|
198
145
|
def toc_title(docxml)
|
@@ -201,6 +148,64 @@ module IsoDoc
|
|
201
148
|
super
|
202
149
|
end
|
203
150
|
|
151
|
+
def middle_title(isoxml)
|
152
|
+
s = isoxml.at(ns("//sections")) or return
|
153
|
+
titfn = isoxml.at(ns("//note[@type = 'title-footnote']"))
|
154
|
+
if @meta.get[:doctype] == "Resolution"
|
155
|
+
middle_title_resolution(isoxml, s.children.first)
|
156
|
+
else
|
157
|
+
middle_title_recommendation(isoxml, s.children.first)
|
158
|
+
end
|
159
|
+
titfn and renumber_footnotes(isoxml)
|
160
|
+
end
|
161
|
+
|
162
|
+
def renumber_footnotes(isoxml)
|
163
|
+
(isoxml.xpath(ns("//fn")) - isoxml.xpath(ns("//table//fn | //figure//fn")))
|
164
|
+
.each_with_index do |fn, i|
|
165
|
+
fn["reference"] = (i + 1).to_s
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def middle_title_resolution(isoxml, out)
|
170
|
+
res = isoxml.at(ns("//bibdata/title[@type = 'resolution']"))
|
171
|
+
out.previous =
|
172
|
+
"<p class='zzSTDTitle1' align='center'>#{res.children.to_xml}</p>"
|
173
|
+
t = @meta.get[:doctitle] and
|
174
|
+
out.previous = "<p class='zzSTDTitle2'>#{t}</p>"
|
175
|
+
middle_title_resolution_subtitle(isoxml, out)
|
176
|
+
end
|
177
|
+
|
178
|
+
def middle_title_resolution_subtitle(isoxml, out)
|
179
|
+
ret = "<p align='center' class='zzSTDTitle2'><em>("
|
180
|
+
d = isoxml.at(ns("//bibdata/title[@type = 'resolution-placedate']"))
|
181
|
+
ret += "#{d.children.to_xml.strip}</em>)"
|
182
|
+
ret += "#{title_footnotes(isoxml)}</p>"
|
183
|
+
out.previous = ret
|
184
|
+
end
|
185
|
+
|
186
|
+
def middle_title_recommendation(isoxml, out)
|
187
|
+
ret = ""
|
188
|
+
type = @meta.get[:doctype]
|
189
|
+
@meta.get[:unpublished] && @meta.get[:draft_new_doctype] and
|
190
|
+
type = @meta.get[:draft_new_doctype]
|
191
|
+
id = @meta.get[:docnumber] and
|
192
|
+
ret += "<<p class='zzSTDTitle1'>#{type} #{id}</p>"
|
193
|
+
t = @meta.get[:doctitle] and
|
194
|
+
ret += "<p class='zzSTDTitle2'>#{t}"
|
195
|
+
ret += "#{title_footnotes(isoxml)}</p>"
|
196
|
+
s = @meta.get[:docsubtitle] and ret += "<p class='zzSTDTitle3'>#{s}</p>"
|
197
|
+
out.previous = ret
|
198
|
+
end
|
199
|
+
|
200
|
+
def title_footnotes(isoxml)
|
201
|
+
ret = ""
|
202
|
+
isoxml.xpath(ns("//note[@type = 'title-footnote']"))
|
203
|
+
.each_with_index do |f, i|
|
204
|
+
ret += "<fn reference='H#{i}'>#{f.remove.children.to_xml}</fn>"
|
205
|
+
end
|
206
|
+
ret
|
207
|
+
end
|
208
|
+
|
204
209
|
include Init
|
205
210
|
end
|
206
211
|
end
|
@@ -21,38 +21,11 @@ module IsoDoc
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
def make_body2(body, docxml)
|
25
|
-
body.div class: "WordSection2" do |div2|
|
26
|
-
info docxml, div2
|
27
|
-
boilerplate docxml, div2
|
28
|
-
front docxml, div2
|
29
|
-
div2.p { |p| p << " " } # placeholder
|
30
|
-
end
|
31
|
-
section_break(body)
|
32
|
-
end
|
33
|
-
|
34
|
-
def front(isoxml, out)
|
35
|
-
if !isoxml.at(ns("//preface/abstract"))
|
36
|
-
keywords(isoxml, out)
|
37
|
-
end
|
38
|
-
super # do keyword with abstract
|
39
|
-
end
|
40
|
-
|
41
24
|
def abstract(clause, out)
|
42
25
|
out.div **attr_code(id: clause["id"], class: "Abstract") do |s|
|
43
26
|
clause_name(clause, "Summary", s, class: "AbstractTitle")
|
44
27
|
clause.elements.each { |e| parse(e, s) unless e.name == "title" }
|
45
28
|
end
|
46
|
-
keywords(nil, out)
|
47
|
-
end
|
48
|
-
|
49
|
-
def keywords(_docxml, out)
|
50
|
-
kw = @meta.get[:keywords]
|
51
|
-
kw.nil? || kw.empty? and return
|
52
|
-
out.div **attr_code(class: "Keyword") do |div|
|
53
|
-
clause_name(nil, "Keywords", div, class: "IntroTitle")
|
54
|
-
div.p "#{kw.join(', ')}."
|
55
|
-
end
|
56
29
|
end
|
57
30
|
|
58
31
|
def formula_parse1(node, out)
|
@@ -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.3 -->
|
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>
|
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.
|
29
|
+
spec.add_dependency "metanorma-standoc", "~> 2.5.0"
|
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.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: 2023-07
|
11
|
+
date: 2023-08-07 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.5.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.5.0
|
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
|