metanorma-itu 2.8.0 → 2.8.2

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.
@@ -6,13 +6,16 @@ module IsoDoc
6
6
  class Metadata < IsoDoc::Metadata
7
7
  def initialize(lang, script, locale, labels)
8
8
  super
9
+ @isodoc = IsoDoc::Itu::HtmlConvert.new({})
10
+ end
11
+
12
+ def images(isoxml, xml)
9
13
  n = "International_Telecommunication_Union_Logo.svg"
10
14
  set(:logo_html, fileloc(n))
11
15
  set(:logo_comb, fileloc("itu-document-comb.png"))
12
16
  set(:logo_word, fileloc(n))
13
17
  set(:logo_sp, fileloc("logo-sp.png"))
14
18
  set(:logo_small, fileloc("logo-small.png"))
15
- @isodoc = IsoDoc::Itu::HtmlConvert.new({})
16
19
  end
17
20
 
18
21
  def fileloc(file)
@@ -50,7 +50,7 @@ module IsoDoc
50
50
  end
51
51
 
52
52
  def contribution_table_contacts
53
- n = (0..@meta.get[:authors]&.size).each_with_object([]) do |i, ret|
53
+ n = (0...@meta.get[:authors]&.size).each_with_object([]) do |i, ret|
54
54
  ret << contribution_table_contact(i)
55
55
  end
56
56
  n.map do |x|
@@ -90,7 +90,7 @@ module IsoDoc
90
90
  end
91
91
 
92
92
  def contrib_justification_contacts
93
- (0..@meta.get[:authors]&.size).each_with_object([]) do |i, ret|
93
+ (0...@meta.get[:authors]&.size).each_with_object([]) do |i, ret|
94
94
  ret << contribution_justification_contact(i)
95
95
  end
96
96
  end
@@ -82,8 +82,8 @@ module IsoDoc
82
82
  bibitem["hidden"] == "true" || bibitem.parent["hidden"] == "true"
83
83
  end
84
84
 
85
- def norm_ref_entry_code(_ordinal, idents, _ids, _standard, datefn, _bib)
86
- ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
85
+ def norm_ref_entry_code(_ordinal, ids, _standard, datefn, _bib)
86
+ ret = (ids[:content] || ids[:metanorma] || ids[:ordinal] || ids[:sdo]).to_s
87
87
  ret.empty? and return ""
88
88
  ret = ret.sub(/^\[(.+)\]$/, "\\1")
89
89
  ret = "[#{esc ret}]"
@@ -91,8 +91,8 @@ module IsoDoc
91
91
  ret.gsub("-", "&#x2011;").gsub(/ /, "&#xa0;")
92
92
  end
93
93
 
94
- def biblio_ref_entry_code(_ordinal, idents, _id, _standard, datefn, _bib)
95
- ret = (idents[:metanorma] || idents[:ordinal] || idents[:sdo]).to_s
94
+ def biblio_ref_entry_code(_ordinal, ids, _standard, datefn, _bib)
95
+ ret = (ids[:content] || ids[:metanorma] || ids[:ordinal] || ids[:sdo]).to_s
96
96
  ret = ret.sub(/^\[(.+)\]$/, "\\1")
97
97
  ret = "[#{esc ret}]"
98
98
  ret += datefn
@@ -157,6 +157,16 @@ module IsoDoc
157
157
  l10n(" &#x2013; ", { prev: lbl })
158
158
  end
159
159
 
160
+ def link(docxml)
161
+ (docxml.xpath(ns("//fmt-link")) -
162
+ docxml.xpath(ns("//boilerplate//fmt-link")) -
163
+ docxml.xpath(ns("//preface//fmt-link"))).each do |l|
164
+ l.text.empty? || l.text.match?(URI::DEFAULT_PARSER.make_regexp) or
165
+ next
166
+ l["style"] ||= "url"
167
+ end
168
+ end
169
+
160
170
  include Init
161
171
  end
162
172
  end
@@ -106,17 +106,6 @@ module IsoDoc
106
106
  start: node["start"] }
107
107
  end
108
108
 
109
- def link_parse(node, out)
110
- out.a **attr_code(href: node["target"], title: node["alt"],
111
- class: "url") do |l|
112
- if node.text.empty?
113
- l << node["target"].sub(/^mailto:/, "")
114
- else
115
- node.children.each { |n| parse(n, l) }
116
- end
117
- end
118
- end
119
-
120
109
  def clause_attrs(node)
121
110
  ret = {}
122
111
  %w(source history).include?(node["type"]) and
@@ -466,11 +466,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
466
466
  <a:documentation>Contact information for the organization, including address, phone number, and email</a:documentation>
467
467
  </ref>
468
468
  </optional>
469
- <optional>
469
+ <zeroOrMore>
470
470
  <ref name="logo">
471
471
  <a:documentation>A logo for the organization</a:documentation>
472
472
  </ref>
473
- </optional>
473
+ </zeroOrMore>
474
474
  </define>
475
475
  <define name="orgname">
476
476
  <element name="name">
@@ -502,6 +502,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
502
502
  </define>
503
503
  <define name="logo">
504
504
  <element name="logo">
505
+ <optional>
506
+ <attribute name="type">
507
+ <a:documentation>The type of logo</a:documentation>
508
+ </attribute>
509
+ </optional>
505
510
  <ref name="image-no-id"/>
506
511
  </element>
507
512
  </define>
@@ -513,6 +518,11 @@ Editorial and advisory groups are represented as consecutive subdivisions of the
513
518
  <a:documentation>Description of what is being depicted</a:documentation>
514
519
  </attribute>
515
520
  </optional>
521
+ <optional>
522
+ <attribute name="type">
523
+ <a:documentation>Description of what kind of depiction this</a:documentation>
524
+ </attribute>
525
+ </optional>
516
526
  <zeroOrMore>
517
527
  <ref name="image-no-id">
518
528
  <a:documentation>A visual depiction of the bibliographic item</a:documentation>
@@ -690,7 +700,7 @@ Examples include GRID, LEI, CrossRef, and Ringgold</a:documentation>
690
700
  <define name="CitationType">
691
701
  <attribute name="bibitemid">
692
702
  <a:documentation>Bibliographic item that the citation applies to, referenced as the anchor of a bibliographic description</a:documentation>
693
- <data type="IDREF"/>
703
+ <ref name="IdRefType"/>
694
704
  </attribute>
695
705
  <choice>
696
706
  <zeroOrMore>
@@ -1236,9 +1246,9 @@ Refer to `BibliographicItem` for definitions</a:documentation>
1236
1246
  <optional>
1237
1247
  <ref name="validity"/>
1238
1248
  </optional>
1239
- <optional>
1249
+ <zeroOrMore>
1240
1250
  <ref name="depiction"/>
1241
- </optional>
1251
+ </zeroOrMore>
1242
1252
  </define>
1243
1253
  <define name="btitle">
1244
1254
  <a:documentation>A title of a bibliographic item, associated with a type of title</a:documentation>
@@ -1296,17 +1306,17 @@ for which this claim of validity is made, if applicable</a:documentation>
1296
1306
  </define>
1297
1307
  <define name="validityBegins">
1298
1308
  <element name="validityBegins">
1299
- <ref name="ISO8601Date"/>
1309
+ <ref name="ISO8601DateTime"/>
1300
1310
  </element>
1301
1311
  </define>
1302
1312
  <define name="validityEnds">
1303
1313
  <element name="validityEnds">
1304
- <ref name="ISO8601Date"/>
1314
+ <ref name="ISO8601DateTime"/>
1305
1315
  </element>
1306
1316
  </define>
1307
1317
  <define name="validityRevision">
1308
1318
  <element name="revision">
1309
- <ref name="ISO8601Date"/>
1319
+ <ref name="ISO8601DateTime"/>
1310
1320
  </element>
1311
1321
  </define>
1312
1322
  <define name="TypedTitleString">
@@ -7,7 +7,7 @@ module Metanorma
7
7
  super
8
8
  xmldoc.xpath("//thead/tr[1]/th | //thead/tr[1]/td").each do |t|
9
9
  text = t.at("./descendant::text()") or next
10
- text.replace(text.text.capitalize)
10
+ text.replace(::Metanorma::Utils.strict_capitalize_first(text.text))
11
11
  end
12
12
  end
13
13
 
@@ -70,10 +70,10 @@ module Metanorma
70
70
  id = bib.at("./docidentifier[not(#{skip_docid} or @type = " \
71
71
  "'metanorma')]")
72
72
  metaid = bib.at("./docidentifier[@type = 'metanorma']")&.text
73
- #abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
73
+ # abbrid = metaid unless /^\[\d+\]$/.match?(metaid)
74
74
  type = id["type"] if id
75
- title = bib.at("./title[@type = 'main']")&.text ||
76
- bib.at("./title")&.text || bib.at("./formattedref")&.text
75
+ title = (bib.at("./title[@type = 'main']") ||
76
+ bib.at("./title") || bib.at("./formattedref"))&.text
77
77
  "#{pubclass} :: #{type} :: #{id&.text || metaid} :: #{title}"
78
78
  end
79
79
 
@@ -96,7 +96,8 @@ module Metanorma
96
96
  node.attr("keywords") or return
97
97
  node.attr("keywords").split(/, */).sort.each_with_index do |kw, i|
98
98
  kw_out = i.zero? ? Metanorma::Utils.strict_capitalize_first(kw) : kw
99
- xml.keyword kw_out
99
+ add_noko_elem(xml, "keyword", kw_out)
100
+ # xml.keyword kw_out
100
101
  end
101
102
  end
102
103
 
@@ -112,7 +113,8 @@ module Metanorma
112
113
 
113
114
  def abstract_parse(attrs, xml, node)
114
115
  xml.abstract **attr_code(attrs) do |xml_section|
115
- xml_section.title { |name| name << node.title }
116
+ # xml_section.title { |name| name << node.title }
117
+ add_noko_elem(xml_section, "title", node.title)
116
118
  xml_section << node.content
117
119
  end
118
120
  end
@@ -9,7 +9,8 @@ module Metanorma
9
9
  stage = node.attr("status") || node.attr("docstage") || "published"
10
10
  stage = "draft" if node.attributes.has_key?("draft")
11
11
  xml.status do |s|
12
- s.stage stage
12
+ add_noko_elem(s, "stage", stage)
13
+ # s.stage stage
13
14
  end
14
15
  end
15
16
 
@@ -65,8 +66,9 @@ module Metanorma
65
66
  end
66
67
  vals.each do |v|
67
68
  xml.question do |q|
68
- a = v[:id] and q.identifier a
69
- a = v[:value] and q.name a
69
+ add_noko_elem(q, "identifier", v[:id])
70
+ # q.identifier a
71
+ add_noko_elem(q, "name", v[:value]) # q.name a
70
72
  end
71
73
  end
72
74
  end
@@ -83,7 +85,7 @@ module Metanorma
83
85
  .each do |k, v|
84
86
  node.attr(k.to_s) and
85
87
  xml.series **{ type: v } do |s|
86
- s.title node.attr(k.to_s)
88
+ add_noko_elem(s, "title", node.attr(k.to_s))
87
89
  end
88
90
  end
89
91
  end
@@ -92,37 +94,46 @@ module Metanorma
92
94
  node.attr("recommendation-from") || node.attr("approval-process") or
93
95
  return
94
96
  xml.recommendationstatus do |s|
95
- a = node.attr("recommendation-from") and s.from a
96
- a = node.attr("recommendation-to") and s.to a
97
+ add_noko_elem(s, "from", node.attr("recommendation-from"))
98
+ add_noko_elem(s, "to", node.attr("recommendation-to"))
97
99
  node.attr("approval-process") and
98
- s.approvalstage **{ process: node.attr("approval-process") } do |x|
99
- x << node.attr("approval-status")
100
- end
100
+ add_noko_elem(s, "approvalstage", node.attr("approval-status"),
101
+ process: node.attr("approval-process"))
102
+ # s.approvalstage **{ process: node.attr("approval-process") } do |x|
103
+ # x << node.attr("approval-status")
104
+ # end
101
105
  end
102
106
  end
103
107
 
104
108
  def metadata_ip_notice(node, xml)
105
- xml.ip_notice_received (node.attr("ip-notice-received") || "false")
109
+ add_noko_elem(xml, "ip-notice-received",
110
+ node.attr("ip-notice-received") || "false")
111
+ # xml.ip_notice_received (node.attr("ip-notice-received") || "false")
106
112
  end
107
113
 
108
114
  def metadata_techreport(node, xml)
109
115
  a = node.attr("meeting") and
110
116
  metadata_meeting(a, node.attr("meeting-acronym"), xml)
111
- a = node.attr("meeting-place") and xml.meeting_place a
117
+ add_noko_elem(xml, "meeting_place", node.attr("meeting-place"))
118
+ # a = node.attr("meeting-place") and xml.meeting_place a
112
119
  a = node.attr("meeting-date") and metadata_meeting_date(a, xml)
113
- a = node.attr("intended-type") and xml.intended_type a
114
- a = node.attr("source") and xml.source a
120
+ add_noko_elem(xml, "intended_type", node.attr("intended-type"))
121
+ # a = node.attr("intended-type") and xml.intended_type a
122
+ add_noko_elem(xml, "source", node.attr("source"))
123
+ # a = node.attr("source") and xml.source a
115
124
  end
116
125
 
117
126
  def metadata_meeting(mtg, acronym, xml)
118
- xml.meeting **attr_code(acronym: acronym) do |m|
119
- m << mtg
120
- end
127
+ add_noko_elem(xml, "meeting", mtg, acronym: acronym)
128
+ # xml.meeting **attr_code(acronym: acronym) do |m|
129
+ # m << mtg
130
+ # end
121
131
  end
122
132
 
123
133
  def metadata_contribution(node, xml)
124
134
  %w(timing).each do |k|
125
- a = node.attr(k) and xml.send k, a
135
+ add_noko_elem(xml, k, node.attr(k))
136
+ # a = node.attr(k) and xml.send k, a
126
137
  end
127
138
  end
128
139
 
@@ -130,17 +141,21 @@ module Metanorma
130
141
  xml.meeting_date do |m|
131
142
  d = val.split("/")
132
143
  if d.size > 1
133
- m.from d[0]
134
- m.to d[1]
144
+ add_noko_elem(m, "from", d[0])
145
+ # m.from d[0]
146
+ add_noko_elem(m, "to", d[1])
147
+ # m.to d[1]
135
148
  else
136
- m.on d[0]
149
+ add_noko_elem(m, "on", d[0])
150
+ # m.on d[0]
137
151
  end
138
152
  end
139
153
  end
140
154
 
141
155
  def personal_role(node, contrib, suffix)
142
156
  if node.attr("role#{suffix}")&.downcase == "rapporteur"
143
- contrib.role "raporteur", **{ type: "editor" }
157
+ add_noko_elem(contrib, "role", "raporteur", type: "editor")
158
+ # contrib.role "raporteur", **{ type: "editor" }
144
159
  else
145
160
  super
146
161
  end
@@ -149,8 +164,8 @@ module Metanorma
149
164
  def metadata_studyperiod(node, xml)
150
165
  s, e = group_period(node, "", "")
151
166
  xml.studyperiod do |p|
152
- p.start s
153
- p.end e
167
+ add_noko_elem(p, "start", s.to_s)
168
+ add_noko_elem(p, "end", e.to_s)
154
169
  end
155
170
  end
156
171
 
@@ -11,21 +11,27 @@ module Metanorma
11
11
 
12
12
  def provisional_id(node, xml)
13
13
  node.attr("provisional-name") or return
14
- xml.docidentifier type: "ITU-provisional" do |i|
15
- i << node.attr("provisional-name")
16
- end
14
+ add_noko_elem(xml, "docidentifier",
15
+ node.attr("provisional-name"), type: "ITU-provisional")
16
+ # xml.docidentifier type: "ITU-provisional" do |i|
17
+ # i << node.attr("provisional-name")
18
+ # end
17
19
  end
18
20
 
19
21
  def td_id(node, xml)
20
22
  node.attr("td-number") or return
21
- xml.docidentifier type: "ITU-TemporaryDocument" do |i|
22
- i << node.attr("td-number")
23
- end
23
+ add_noko_elem(xml, "docidentifier",
24
+ node.attr("td-number"), type: "ITU-TemporaryDocument")
25
+ # xml.docidentifier type: "ITU-TemporaryDocument" do |i|
26
+ # i << node.attr("td-number")
27
+ # end
24
28
  end
25
29
 
26
30
  def iso_id(node, xml)
27
- a = node.attr("common-text-docnumber") and
28
- xml.docidentifier a, type: "ISO"
31
+ add_noko_elem(xml, "docidentifier",
32
+ node.attr("common-text-docnumber"), type: "ISO")
33
+ # a = node.attr("common-text-docnumber") and
34
+ # xml.docidentifier a, type: "ISO"
29
35
  end
30
36
 
31
37
  ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
@@ -56,31 +62,42 @@ module Metanorma
56
62
 
57
63
  def itu_id(node, xml)
58
64
  node.attr("docnumber") || node.attr("docidentifier") or return
59
- xml.docidentifier type: "ITU", primary: "true" do |i|
60
- i << (node.attr("docidentifier") || itu_id1(node, false))
61
- end
62
- xml.docidentifier type: "ITU-lang" do |i|
63
- i << itu_id1(node, true)
64
- end
65
+ add_noko_elem(xml, "docidentifier",
66
+ node.attr("docidentifier") || itu_id1(node, false), type: "ITU", primary: "true")
67
+ # xml.docidentifier type: "ITU", primary: "true" do |i|
68
+ # i << (node.attr("docidentifier") || itu_id1(node, false))
69
+ # end
70
+ add_noko_elem(xml, "docidentifier",
71
+ itu_id1(node, true), type: "ITU-lang")
72
+ # xml.docidentifier type: "ITU-lang" do |i|
73
+ # i << itu_id1(node, true)
74
+ # end
65
75
  end
66
76
 
67
77
  def recommendation_id(node, xml)
68
78
  node.attr("recommendationnumber") or return
69
79
  node.attr("recommendationnumber").split("/").each do |s|
70
- xml.docidentifier type: "ITU-Recommendation" do |i|
71
- i << s
72
- end
80
+ add_noko_elem(xml, "docidentifier", s, type: "ITU-Recommendation")
81
+
82
+ # xml.docidentifier type: "ITU-Recommendation" do |i|
83
+ # i << s
84
+ # end
73
85
  end
74
86
  end
75
87
 
76
88
  def structured_id(node, xml)
77
89
  node.attr("docnumber") or return
78
90
  xml.structuredidentifier do |i|
79
- i.bureau node.attr("bureau") || "T"
80
- i.docnumber node.attr("docnumber")
81
- a = node.attr("annexid") and i.annexid a
82
- a = node.attr("amendment-number") and i.amendment a
83
- a = node.attr("corrigendum-number") and i.corrigendum a
91
+ add_noko_elem(i, "bureau", node.attr("bureau") || "T")
92
+ # i.bureau node.attr("bureau") || "T"
93
+ add_noko_elem(i, "docnumber", node.attr("docnumber"))
94
+ # i.docnumber node.attr("docnumber")
95
+ add_noko_elem(i, "annexid", node.attr("annexid"))
96
+ # a = node.attr("annexid") and i.annexid a
97
+ add_noko_elem(i, "amendment", node.attr("amendment-number"))
98
+ # a = node.attr("amendment-number") and i.amendment a
99
+ add_noko_elem(i, "corrigendum", node.attr("corrigendum-number"))
100
+ # a = node.attr("corrigendum-number") and i.corrigendum a
84
101
  end
85
102
  end
86
103
  end
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <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">
3
- <!-- VERSION v2.1.3 -->
3
+ <!-- VERSION v2.1.5 -->
4
4
 
5
5
  <!--
6
6
  ALERT: cannot have root comments, because of https://github.com/metanorma/metanorma/issues/437
@@ -905,15 +905,32 @@ titlecase, or lowercase</a:documentation>
905
905
  </element>
906
906
  </define>
907
907
  <define name="image" combine="choice">
908
- <element name="svg">
909
- <a:documentation>Add svg mark up to image</a:documentation>
910
- <oneOrMore>
911
- <choice>
912
- <text/>
913
- <ref name="AnyElement"/>
914
- </choice>
915
- </oneOrMore>
916
- </element>
908
+ <choice>
909
+ <element name="image">
910
+ <ref name="RequiredId"/>
911
+ <ref name="ImageAttributes"/>
912
+ <optional>
913
+ <element name="svg">
914
+ <a:documentation>Allow svg in image/svg, for consistency</a:documentation>
915
+ <oneOrMore>
916
+ <choice>
917
+ <text/>
918
+ <ref name="AnyElement"/>
919
+ </choice>
920
+ </oneOrMore>
921
+ </element>
922
+ </optional>
923
+ </element>
924
+ <element name="svg">
925
+ <a:documentation>Add svg mark up to image</a:documentation>
926
+ <oneOrMore>
927
+ <choice>
928
+ <text/>
929
+ <ref name="AnyElement"/>
930
+ </choice>
931
+ </oneOrMore>
932
+ </element>
933
+ </choice>
917
934
  </define>
918
935
  <define name="ParagraphFnBody" combine="interleave">
919
936
  <ref name="BlockSource">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Itu
3
- VERSION = "2.8.0".freeze
3
+ VERSION = "2.8.2".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.8.0
4
+ version: 2.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-03 00:00:00.000000000 Z
11
+ date: 2025-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc