metanorma-itu 2.2.4 → 2.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/isodoc/itu/base_convert.rb +11 -11
  3. data/lib/isodoc/itu/html/header.html +4 -4
  4. data/lib/isodoc/itu/html/html_itu_titlepage.html +2 -0
  5. data/lib/isodoc/itu/html/htmlstyle.css +4 -0
  6. data/lib/isodoc/itu/html/htmlstyle.scss +6 -0
  7. data/lib/isodoc/itu/html/word_itu_titlepage.html +2 -0
  8. data/lib/isodoc/itu/html/word_itu_titlepage_sp.html +2 -0
  9. data/lib/isodoc/itu/i18n-ar.yaml +1 -0
  10. data/lib/isodoc/itu/i18n-de.yaml +1 -0
  11. data/lib/isodoc/itu/i18n-en.yaml +1 -0
  12. data/lib/isodoc/itu/i18n-es.yaml +1 -0
  13. data/lib/isodoc/itu/i18n-fr.yaml +1 -0
  14. data/lib/isodoc/itu/i18n-ru.yaml +1 -0
  15. data/lib/isodoc/itu/i18n-zh-Hans.yaml +1 -0
  16. data/lib/isodoc/itu/itu.implementers-guide.xsl +227 -100
  17. data/lib/isodoc/itu/itu.in-force.xsl +227 -100
  18. data/lib/isodoc/itu/itu.recommendation-annex.xsl +227 -100
  19. data/lib/isodoc/itu/itu.recommendation-supplement.xsl +227 -100
  20. data/lib/isodoc/itu/itu.recommendation.xsl +227 -100
  21. data/lib/isodoc/itu/itu.resolution.xsl +227 -100
  22. data/lib/isodoc/itu/itu.service-publication.xsl +227 -100
  23. data/lib/isodoc/itu/itu.technical-paper.xsl +227 -100
  24. data/lib/isodoc/itu/itu.technical-report.xsl +227 -100
  25. data/lib/isodoc/itu/metadata.rb +18 -17
  26. data/lib/isodoc/itu/presentation_xml_convert.rb +2 -2
  27. data/lib/isodoc/itu/xref.rb +7 -5
  28. data/lib/metanorma/itu/basicdoc.rng +0 -1
  29. data/lib/metanorma/itu/biblio.rng +11 -1
  30. data/lib/metanorma/itu/front_id.rb +15 -8
  31. data/lib/metanorma/itu/isodoc.rng +11 -0
  32. data/lib/metanorma/itu/validate.rb +2 -2
  33. data/lib/metanorma/itu/version.rb +1 -1
  34. metadata +2 -2
@@ -21,11 +21,11 @@ module IsoDoc
21
21
 
22
22
  def title(isoxml, _out)
23
23
  { doctitle: "//bibdata/title[@language='#{@lang}'][@type = 'main']",
24
- docsubtitle: "//bibdata/title[@language='#{@lang}']"\
24
+ docsubtitle: "//bibdata/title[@language='#{@lang}']" \
25
25
  "[@type = 'subtitle']",
26
- amendmenttitle: "//bibdata/title[@language='#{@lang}']"\
26
+ amendmenttitle: "//bibdata/title[@language='#{@lang}']" \
27
27
  "[@type = 'amendment']",
28
- corrigendumtitle: "//bibdata/title[@language='#{@lang}']"\
28
+ corrigendumtitle: "//bibdata/title[@language='#{@lang}']" \
29
29
  "[@type = 'corrigendum']",
30
30
  series: "//bibdata/series[@type='main']/title",
31
31
  series1: "//bibdata/series[@type='secondary']/title",
@@ -62,7 +62,7 @@ module IsoDoc
62
62
  tc = xml.at(ns("//bibdata/ext/editorialgroup/workgroup/name"))
63
63
  set(:workgroup, tc.text) if tc
64
64
  super
65
- authors = xml.xpath(ns("//bibdata/contributor[role/@type = 'author' "\
65
+ authors = xml.xpath(ns("//bibdata/contributor[role/@type = 'author' " \
66
66
  "or xmlns:role/@type = 'editor']/person"))
67
67
  person_attributes(authors) unless authors.empty?
68
68
  end
@@ -76,7 +76,7 @@ module IsoDoc
76
76
  authors.each do |a|
77
77
  append(:affiliations,
78
78
  a&.at(ns("./affiliation/organization/name"))&.text)
79
- append(:addresses, a&.at(ns("./affiliation/organization/address/"\
79
+ append(:addresses, a&.at(ns("./affiliation/organization/address/" \
80
80
  "formattedAddress"))&.text)
81
81
  append(:emails, a&.at(ns("./email"))&.text)
82
82
  append(:faxes, a&.at(ns("./phone[@type = 'fax']"))&.text)
@@ -85,21 +85,22 @@ module IsoDoc
85
85
  end
86
86
 
87
87
  def docid(isoxml, _out)
88
- dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ITU']"))
89
- set(:docnumber, dn&.text)
90
- dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ITU-Recommendation']"))
91
- dn and set(:recommendationnumber, dn&.text)
92
- dn = isoxml.at(ns("//bibdata/docidentifier[@type = 'ITU-lang']"))
93
- dn and set(:docnumber_lang, dn&.text)
88
+ { docnumber: "ITU", recommendationnumber: "ITU-Recommendation",
89
+ docnumber_lang: "ITU-lang", docnumber_td: "ITU-TemporaryDocument",
90
+ docnumber_provisional: "ITU-provisional" }
91
+ .each do |k, v|
92
+ dn = isoxml.at(ns("//bibdata/docidentifier[@type = '#{v}']")) and
93
+ set(k, dn.text)
94
+ end
94
95
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
95
- oblig = isoxml&.at(ns("//annex/@obligation"))&.text
96
+ oblig = isoxml.at(ns("//annex/@obligation"))&.text
96
97
  lbl = oblig == "informative" ? @labels["appendix"] : @labels["annex"]
97
- dn and set(:annexid, @i18n.l10n("#{lbl} #{dn&.text}"))
98
+ dn and set(:annexid, @i18n.l10n("#{lbl} #{dn.text}"))
98
99
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/amendment")) and
99
- set(:amendmentid, @i18n.l10n("#{@labels['amendment']} #{dn&.text}"))
100
+ set(:amendmentid, @i18n.l10n("#{@labels['amendment']} #{dn.text}"))
100
101
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/corrigendum")) and
101
102
  set(:corrigendumid,
102
- @i18n.l10n("#{@labels['corrigendum']} #{dn&.text}"))
103
+ @i18n.l10n("#{@labels['corrigendum']} #{dn.text}"))
103
104
  end
104
105
 
105
106
  def unpublished(status)
@@ -170,11 +171,11 @@ module IsoDoc
170
171
  if m1[:mo] == m2[:mo]
171
172
  @i18n.l10n("#{dd1}–#{dd2} #{months[m1[:mo].to_sym]} #{m1[:yr]}")
172
173
  else
173
- @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} – "\
174
+ @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} – " \
174
175
  "#{dd2} #{months[m2[:mo].to_sym]} #{m1[:yr]}")
175
176
  end
176
177
  else
177
- @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]} – "\
178
+ @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]} – " \
178
179
  "#{dd2} #{months[m2[:mo].to_sym]} #{m2[:yr]}")
179
180
  end
180
181
  else
@@ -179,7 +179,7 @@ module IsoDoc
179
179
  super
180
180
  end
181
181
 
182
- def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn)
182
+ def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
183
183
  ret = (idents[:metanorma] || idents[:sdo] || idents[:ordinal]).to_s
184
184
  !idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
185
185
  ret += datefn
@@ -187,7 +187,7 @@ module IsoDoc
187
187
  ret.gsub(/-/, "‑").gsub(/ /, " ")
188
188
  end
189
189
 
190
- def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn)
190
+ def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
191
191
  ret = (idents[:metanorma] || idents[:sdo] || idents[:ordinal]).to_s
192
192
  !idents[:metanorma] && idents[:sdo] and ret = "[#{ret}]"
193
193
  ret += datefn
@@ -97,10 +97,14 @@ module IsoDoc
97
97
  end
98
98
  end
99
99
 
100
+ def subfigure_label(subfignum)
101
+ subfignum.zero? and return ""
102
+ "-#{(subfignum + 96).chr}"
103
+ end
104
+
100
105
  def sequential_figure_body(subfignum, counter, block, klass)
101
106
  label = counter.print
102
- label &&= label +
103
- (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
107
+ label &&= label + subfigure_label(subfignum)
104
108
  @anchors[block["id"]] = anchor_struct(
105
109
  label, nil, @labels[klass] || klass.capitalize, klass,
106
110
  block["unnumbered"]
@@ -108,9 +112,7 @@ module IsoDoc
108
112
  end
109
113
 
110
114
  def hierarchical_figure_body(num, subfignum, counter, block, klass)
111
- label = "#{num}#{hiersep}#{counter.print}" +
112
- (subfignum.zero? ? "" : "#{hierfigsep}#{(subfignum + 96).chr}")
113
-
115
+ label = "#{num}#{hiersep}#{counter.print}" + subfigure_label(subfignum)
114
116
  @anchors[block["id"]] = anchor_struct(
115
117
  label, nil, @labels[klass] || klass.capitalize,
116
118
  klass, block["unnumbered"]
@@ -522,7 +522,6 @@
522
522
  <value>tip</value>
523
523
  <value>important</value>
524
524
  <value>caution</value>
525
- <value>statement</value>
526
525
  </choice>
527
526
  </define>
528
527
  <define name="figure">
@@ -216,6 +216,9 @@
216
216
  <optional>
217
217
  <ref name="fullname"/>
218
218
  </optional>
219
+ <zeroOrMore>
220
+ <ref name="credential"/>
221
+ </zeroOrMore>
219
222
  <zeroOrMore>
220
223
  <ref name="affiliation"/>
221
224
  </zeroOrMore>
@@ -232,6 +235,11 @@
232
235
  <ref name="FullNameType"/>
233
236
  </element>
234
237
  </define>
238
+ <define name="credential">
239
+ <element name="credential">
240
+ <text/>
241
+ </element>
242
+ </define>
235
243
  <define name="FullNameType">
236
244
  <choice>
237
245
  <group>
@@ -305,7 +313,9 @@
305
313
  <zeroOrMore>
306
314
  <ref name="affiliationdescription"/>
307
315
  </zeroOrMore>
308
- <ref name="organization"/>
316
+ <optional>
317
+ <ref name="organization"/>
318
+ </optional>
309
319
  </element>
310
320
  </define>
311
321
  <define name="affiliationname">
@@ -3,18 +3,25 @@ module Metanorma
3
3
  class Converter < Standoc::Converter
4
4
  def metadata_id(node, xml)
5
5
  provisional_id(node, xml)
6
+ td_id(node, xml)
6
7
  itu_id(node, xml)
7
8
  recommendation_id(node, xml)
8
9
  end
9
10
 
10
11
  def provisional_id(node, xml)
11
- return unless node.attr("provisional-name")
12
-
13
- xml.docidentifier **{ type: "ITU-provisional" } do |i|
12
+ node.attr("provisional-name") or return
13
+ xml.docidentifier type: "ITU-provisional" do |i|
14
14
  i << node.attr("provisional-name")
15
15
  end
16
16
  end
17
17
 
18
+ def td_id(node, xml)
19
+ node.attr("td-number") or return
20
+ xml.docidentifier type: "ITU-TemporaryDocument" do |i|
21
+ i << node.attr("td-number")
22
+ end
23
+ end
24
+
18
25
  ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
19
26
  "zh" => "C", "ru" => "R" }.freeze
20
27
 
@@ -30,12 +37,12 @@ module Metanorma
30
37
  end
31
38
 
32
39
  def itu_id(node, xml)
33
- return unless node.attr("docnumber")
40
+ return unless node.attr("docnumber") || node.attr("docidentifier")
34
41
 
35
- xml.docidentifier **{ type: "ITU" } do |i|
36
- i << itu_id1(node, false)
42
+ xml.docidentifier type: "ITU" do |i|
43
+ i << (node.attr("docidentifier") || itu_id1(node, false))
37
44
  end
38
- xml.docidentifier **{ type: "ITU-lang" } do |i|
45
+ xml.docidentifier type: "ITU-lang" do |i|
39
46
  i << itu_id1(node, true)
40
47
  end
41
48
  xml.docnumber { |i| i << node.attr("docnumber") }
@@ -45,7 +52,7 @@ module Metanorma
45
52
  return unless node.attr("recommendationnumber")
46
53
 
47
54
  node.attr("recommendationnumber").split("/").each do |s|
48
- xml.docidentifier **{ type: "ITU-Recommendation" } do |i|
55
+ xml.docidentifier type: "ITU-Recommendation" do |i|
49
56
  i << s
50
57
  end
51
58
  end
@@ -66,6 +66,7 @@
66
66
  <value>caution</value>
67
67
  <value>statement</value>
68
68
  <value>editorial</value>
69
+ <value>box</value>
69
70
  </choice>
70
71
  </define>
71
72
  <define name="index">
@@ -1577,6 +1578,9 @@
1577
1578
  <zeroOrMore>
1578
1579
  <ref name="indexsect"/>
1579
1580
  </zeroOrMore>
1581
+ <optional>
1582
+ <ref name="colophon"/>
1583
+ </optional>
1580
1584
  </element>
1581
1585
  </define>
1582
1586
  <define name="misccontainer">
@@ -1599,6 +1603,13 @@
1599
1603
  </oneOrMore>
1600
1604
  </element>
1601
1605
  </define>
1606
+ <define name="colophon">
1607
+ <element name="colophon">
1608
+ <oneOrMore>
1609
+ <ref name="content"/>
1610
+ </oneOrMore>
1611
+ </element>
1612
+ </define>
1602
1613
  <define name="foreword">
1603
1614
  <element name="foreword">
1604
1615
  <ref name="Content-Section"/>
@@ -98,8 +98,8 @@ module Metanorma
98
98
 
99
99
  def itu_identifier_validate(xmldoc)
100
100
  xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x|
101
- /^ITU-[RTD] [AD-VX-Z]\.[0-9]+$/.match(x.text) or
102
- @log.add("Style", nil, "#{x.text} does not match ITU document "\
101
+ /^ITU-[RTD] [AD-VX-Z]\.\d+(\.\d+)?$/.match(x.text) or
102
+ @log.add("Style", nil, "#{x.text} does not match ITU document " \
103
103
  "identifier conventions")
104
104
  end
105
105
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module ITU
3
- VERSION = "2.2.4".freeze
3
+ VERSION = "2.2.6".freeze
4
4
  end
5
5
  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: 2.2.4
4
+ version: 2.2.6
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-01-23 00:00:00.000000000 Z
11
+ date: 2023-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: htmlentities