metanorma-itu 2.8.8 → 2.8.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 309580c7c20cde65a6868a26f20894ac22c56d36696960dd12e25c99a1fc31a7
4
- data.tar.gz: 02d6887677b0688ce59574d5584c66b4c65318e5d9a17f1647ea75d506632a4f
3
+ metadata.gz: c79cddef8a6aef9e8d667048e0dd426441c2dc129c0f21c69525239a48144ce1
4
+ data.tar.gz: 755506724bd48e5a84cfd1208bc942d4ba4dad8cae6d44f1a014338320e4bc4b
5
5
  SHA512:
6
- metadata.gz: eb6e6a969ba3117a680c6d32ddc87197c46c827d242b829d1aa4e79eb99cda2abfb2d9d487fa14fd9b210f6bf0955b13ab2be501c2f16593962d1e66f120702e
7
- data.tar.gz: 728a29fbc6bdd0bfd89791398063ca82e732056ee5e36e9af1525d8fa627ba2bc54e90ed38128f04399d71e671219074dbc7b0c53a1fb0f81b9df273cbf2b3e3
6
+ metadata.gz: 34f34dce2494bce28d4849f8b2bacf5b1045834d9ea766cd34e9cf1dbf2e46ec09412e1c6170598652206e138ac6a771f54cc1c87e5689e961a8ba75cff3cbb1
7
+ data.tar.gz: 5a83fa8c083ce8c66ef29131d414c2b0d48edaa5ead51543cdcfae92686a4c14d365eeaeb9607449a7875ca5df4d0071420f72a212028cef86dc867703ca6538
data/.rubocop.yml CHANGED
@@ -1,10 +1,10 @@
1
1
  # Auto-generated by Cimas: Do not edit it manually!
2
2
  # See https://github.com/metanorma/cimas
3
3
  inherit_from:
4
- - https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
4
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
5
5
 
6
6
  # local repo-specific modifications
7
7
  # ...
8
8
 
9
9
  AllCops:
10
- TargetRubyVersion: 2.5
10
+ TargetRubyVersion: 3.4
@@ -60,7 +60,7 @@ page: الصفحة
60
60
  placedate: "جنيف، %"
61
61
  annex_to_itu_ob: ملحق بالنشرة التشغيلية للاتحاد
62
62
  number_abbrev: رقم
63
- annex_to_itu_ob_abbrev: ملحق بالنشرة التشغيلية للاتحاد رقم
63
+ annex_to_itu_ob_abbrev: "% ملحق بالنشرة التشغيلية للاتحاد "
64
64
  international_telecommunication_union: الاتحاد الدولي للاتصالات
65
65
  position_on: الوضع في
66
66
  revision_abbreviation: المراجعة
@@ -9,7 +9,7 @@ module IsoDoc
9
9
  @isodoc = IsoDoc::Itu::HtmlConvert.new({})
10
10
  end
11
11
 
12
- def images(isoxml, xml)
12
+ def images(_isoxml, _xml)
13
13
  n = "International_Telecommunication_Union_Logo.svg"
14
14
  set(:logo_html, fileloc(n))
15
15
  set(:logo_comb, fileloc("itu-document-comb.png"))
@@ -67,22 +67,13 @@ module IsoDoc
67
67
  end
68
68
 
69
69
  COMMITTEE_XPATH = "//bibdata/contributor[role/description = 'committee']/" \
70
- "organization/subdivision".freeze
70
+ "organization/subdivision".freeze
71
71
 
72
72
  def author(xml, _out)
73
73
  sector = xml.at(ns("#{COMMITTEE_XPATH}[@type='Sector']/name"))
74
74
  set(:sector, sector.text) if sector
75
75
  bureau(xml)
76
- tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Group']/name"))
77
- set(:group, tc.text) if tc
78
- tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Group']/identifier"))
79
- set(:group_acronym, tc.text) if tc
80
- start1 = xml.at(ns("//bibdata/ext/studyperiod/start"))
81
- end1 = xml.at(ns("//bibdata/ext/studyperiod/end"))
82
- if start1
83
- set(:study_group_period,
84
- @i18n.l10n("#{start1.text}–#{end1.text}"))
85
- end
76
+ study_group(xml)
86
77
  tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Subgroup']/name"))
87
78
  set(:subgroup, tc.text) if tc
88
79
  tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Workgroup']/name"))
@@ -93,14 +84,24 @@ module IsoDoc
93
84
  person_attributes(authors) unless authors.empty?
94
85
  end
95
86
 
87
+ def study_group(xml)
88
+ tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Group']/name"))
89
+ set(:group, tc.text) if tc
90
+ tc = xml.at(ns("#{COMMITTEE_XPATH}[@type='Group']/identifier"))
91
+ set(:group_acronym, tc.text) if tc
92
+ start1 = xml.at(ns("//bibdata/ext/studyperiod/start")) or return
93
+ end1 = xml.at(ns("//bibdata/ext/studyperiod/end"))
94
+ set(:study_group_period,
95
+ @i18n.l10n("#{start1.text}–#{end1.text}"))
96
+ end
97
+
96
98
  def bureau(xml)
97
- if bureau = xml.at(ns("#{COMMITTEE_XPATH}[@type='Bureau']/name"))
98
- set(:bureau, bureau.text)
99
- case bureau.text
100
- when "T" then set(:bureau_full, @i18n.tsb_full)
101
- when "D" then set(:bureau_full, @i18n.bdt_full)
102
- when "R" then set(:bureau_full, @i18n.br_full)
103
- end
99
+ bureau = xml.at(ns("#{COMMITTEE_XPATH}[@type='Bureau']/name")) or return
100
+ set(:bureau, bureau.text)
101
+ case bureau.text
102
+ when "T" then set(:bureau_full, @i18n.tsb_full)
103
+ when "D" then set(:bureau_full, @i18n.bdt_full)
104
+ when "R" then set(:bureau_full, @i18n.br_full)
104
105
  end
105
106
  end
106
107
 
@@ -2,17 +2,21 @@ module IsoDoc
2
2
  module Itu
3
3
  class Metadata < IsoDoc::Metadata
4
4
  def monthyr(isodate)
5
- m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)/.match isodate
6
- m && m[:yr] && m[:mo] or return isodate
7
- "#{m[:mo]}/#{m[:yr]}"
5
+ IsoDoc::ExtendedDateFormatter.format_iso_date(
6
+ isodate,
7
+ lang: @lang,
8
+ year_month: "%m/%Y",
9
+ full: "%m/%Y",
10
+ )
8
11
  end
9
12
 
10
13
  def ddMMMYYYY(isodate)
11
- m = /(?<yr>\d\d\d\d)-(?<mo>\d\d)-(?<dd>\d\d)/.match isodate
12
- m && m[:yr] && m[:mo] && m[:dd] or return isodate
13
- mmm = DateTime.parse(isodate).localize(@lang.to_sym)
14
- .to_additional_s("yMMM")
15
- @i18n.l10n("#{m[:dd]} #{mmm}")
14
+ out = IsoDoc::ExtendedDateFormatter.format_iso_date(
15
+ isodate,
16
+ lang: @lang,
17
+ full: "%d %b %Y",
18
+ )
19
+ out == isodate ? out : @i18n.l10n(out)
16
20
  end
17
21
 
18
22
  def ddMMMMYYYY(date1, date2)
@@ -24,22 +28,30 @@ module IsoDoc
24
28
  dd2 = m2[:dd].sub(/^0/, "")
25
29
  if m1[:yr] == m2[:yr]
26
30
  if m1[:mo] == m2[:mo]
27
- @i18n.l10n("#{dd1}&#x2013;#{dd2} #{months[m1[:mo].to_sym]} #{m1[:yr]}")
31
+ @i18n.l10n("#{dd1}&#x2013;#{dd2} #{localized_month(m1[:mo])} #{m1[:yr]}")
28
32
  else
29
- @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} &#x2013; " \
30
- "#{dd2} #{months[m2[:mo].to_sym]} #{m1[:yr]}")
33
+ @i18n.l10n("#{dd1} #{localized_month(m1[:mo])} &#x2013; " \
34
+ "#{dd2} #{localized_month(m2[:mo])} #{m1[:yr]}")
31
35
  end
32
36
  else
33
- @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]} &#x2013; " \
34
- "#{dd2} #{months[m2[:mo].to_sym]} #{m2[:yr]}")
37
+ @i18n.l10n("#{dd1} #{localized_month(m1[:mo])} #{m1[:yr]} &#x2013; " \
38
+ "#{dd2} #{localized_month(m2[:mo])} #{m2[:yr]}")
35
39
  end
36
40
  else
37
- date2.nil? ? @i18n.l10n("#{dd1} #{months[m1[:mo].to_sym]} #{m1[:yr]}") : "#{date1}/#{date2}"
41
+ date2.nil? ? @i18n.l10n("#{dd1} #{localized_month(m1[:mo])} #{m1[:yr]}") : "#{date1}/#{date2}"
38
42
  end
39
43
  else
40
44
  date2.nil? ? date1 : "#{date1}/#{date2}"
41
45
  end
42
46
  end
47
+
48
+ private
49
+
50
+ def localized_month(month)
51
+ IsoDoc::ExtendedDateFormatter.format(
52
+ "2000-#{month}-01", "%B", lang: @lang
53
+ )
54
+ end
43
55
  end
44
56
  end
45
57
  end
@@ -52,28 +52,33 @@ module IsoDoc
52
52
  end
53
53
 
54
54
  def ddMMMyyyy(date)
55
- d = date.split("-").map { |x| x.sub(/^0/, "") }
55
+ IsoDoc::ExtendedDateFormatter.format_iso_date(
56
+ date, lang: @lang, **roman_or_chinese_formats
57
+ )
58
+ end
59
+
60
+ def roman_or_chinese_formats
56
61
  case @lang
57
62
  when "zh"
58
- d[0] += "年" if d[0]
59
- d[1] += "月" if d[1]
60
- d[2] += "日" if d[2]
61
- d.join
63
+ { year: "%Y年", year_month: "%Y年%-m月", full: "%Y年%-m月%-d日" }
62
64
  when "ar"
63
- d[1] = ::RomanNumerals.to_roman(d[1].to_i).upcase if d[1]
64
- d.join(".")
65
+ { year: "%Y", year_month: "%Y.%Om[roman]",
66
+ full: "%Y.%Om[roman].%-d" }
65
67
  else
66
- d[1] = ::RomanNumerals.to_roman(d[1].to_i).upcase if d[1]
67
- d.reverse.join(".")
68
+ { year: "%Y", year_month: "%Om[roman].%Y",
69
+ full: "%-d.%Om[roman].%Y" }
68
70
  end
69
71
  end
70
72
 
71
73
  def ddmmmmyyyy(date)
72
74
  @lang == "zh" and return ddMMMyyyy(date)
73
- d = date.split("-")
74
- d[1] &&= @meta.months[d[1].to_sym]
75
- d[2] &&= d[2].sub(/^0/, "")
76
- l10n(d.reverse.join(" "))
75
+ out = IsoDoc::ExtendedDateFormatter.format_iso_date(
76
+ date,
77
+ lang: @lang,
78
+ year_month: "%B %Y",
79
+ full: "%-d %B %Y",
80
+ )
81
+ out == date ? out : l10n(out)
77
82
  end
78
83
 
79
84
  def amendment_id(bib)
@@ -2,7 +2,7 @@ module IsoDoc
2
2
  module Itu
3
3
  class WordConvert < IsoDoc::WordConvert
4
4
  def word_preface_cleanup(docxml)
5
- docxml.xpath("//h1[@class = 'AbstractTitle'] | "\
5
+ docxml.xpath("//h1[@class = 'AbstractTitle'] | " \
6
6
  "//h1[@class = 'IntroTitle']").each do |h2|
7
7
  h2.name = "p"
8
8
  h2["class"] = "h1Preface"
@@ -25,8 +25,8 @@ module IsoDoc
25
25
 
26
26
  def word_footnote_cleanup(docxml)
27
27
  docxml.xpath("//aside").each do |a|
28
- a.first_element_child.
29
- add_first_child '<span style="mso-tab-count:1"/>'
28
+ a.first_element_child
29
+ .add_first_child '<span style="mso-tab-count:1"/>'
30
30
  end
31
31
  end
32
32
 
@@ -50,21 +50,13 @@ module IsoDoc
50
50
 
51
51
  def word_preface(docxml)
52
52
  super
53
- abstractbox = docxml.at("//div[@id='abstractbox']")
54
- historybox = docxml.at("//div[@id='historybox']")
55
- sourcebox = docxml.at("//div[@id='sourcebox']")
56
- keywordsbox = docxml.at("//div[@id='keywordsbox']")
57
- changelogbox = docxml.at("//div[@id='change_logbox']")
58
- abstract = docxml.at("//div[@class = 'Abstract']")
59
- history = docxml.at("//div[@class = 'history']")
60
- source = docxml.at("//div[@class = 'source']")
61
- keywords = docxml.at("//div[@class = 'Keyword']")
62
- changelog = docxml.at("//div[@id = 'change_log']")
63
- abstract.parent = abstractbox if abstract && abstractbox
64
- history.parent = historybox if history && historybox
65
- source.parent = sourcebox if source && sourcebox
66
- keywords.parent = keywordsbox if keywords && keywordsbox
67
- changelog.parent = changelogbox if changelog && changelogbox
53
+ { abstractbox: "Abstract", historybox: "history",
54
+ sourcebox: "source", keywordsbox: "Keyword",
55
+ changelogbox: "change_log" }.each do |k, v|
56
+ box = docxml.at("//div[@id='#{k}']")
57
+ content = docxml.at("//div[@class = '#{v}']")
58
+ content.parent = box if content && box
59
+ end
68
60
  end
69
61
 
70
62
  def toWord(result, filename, dir, header)
@@ -82,8 +74,8 @@ module IsoDoc
82
74
  def postprocess_cleanup(result)
83
75
  result = from_xhtml(cleanup(to_xhtml(textcleanup(result))))
84
76
  result = populate_template(result, :word)
85
- result = from_xhtml(word_cleanup(to_xhtml(result)))
86
- .gsub(/-DOUBLE_HYPHEN_ESCAPE-/, "--")
77
+ from_xhtml(word_cleanup(to_xhtml(result)))
78
+ .gsub("-DOUBLE_HYPHEN_ESCAPE-", "--")
87
79
  end
88
80
 
89
81
  def wordstylesheet_update
@@ -128,24 +120,31 @@ module IsoDoc
128
120
  auth = docxml.at("//div[@id = 'draft-warning']")
129
121
  dest and auth and dest.replace(auth.remove)
130
122
  %w(copyright license legal).each do |t|
131
- dest = docxml.at("//div[@id = 'boilerplate-#{t}-destination']")
132
- auth = docxml.at("//div[@class = 'boilerplate-#{t}']")
133
- auth.remove if auth && !dest
134
- next unless auth && dest
135
-
136
- t == "copyright" and para = auth&.at(".//p") and
137
- para["class"] = "boilerplateHdr"
138
- auth&.xpath(".//p[not(@class)]")&.each_with_index do |p, _i|
139
- p["class"] = "boilerplate"
140
- # i == 0 && t == "copyright" and p["style"] = "text-align:center;"
141
- end
142
- t == "copyright" or
143
- auth << "<p>&#xa0;</p><p>&#xa0;</p><p>&#xa0;</p>"
144
- dest.replace(auth.remove)
123
+ authority_cleanup1(docxml, t)
145
124
  end
146
125
  coverpage_note_cleanup(docxml)
147
126
  end
148
127
 
128
+ def authority_cleanup1(docxml, type)
129
+ auth, dest = authority_cleanup1_prep(docxml, type)
130
+ (auth && dest) or return
131
+ type == "copyright" and para = auth.at(".//p") and
132
+ para["class"] = "boilerplateHdr"
133
+ auth.xpath(".//p[not(@class)]").each do |p|
134
+ p["class"] = "boilerplate"
135
+ end
136
+ type == "copyright" or
137
+ auth << "<p>&#xa0;</p><p>&#xa0;</p><p>&#xa0;</p>"
138
+ dest.replace(auth.remove)
139
+ end
140
+
141
+ def authority_cleanup1_prep(docxml, type)
142
+ dest = docxml.at("//div[@id = 'boilerplate-#{type}-destination']")
143
+ auth = docxml.at("//div[@class = 'boilerplate-#{type}']")
144
+ auth.remove if auth && !dest
145
+ [auth, dest]
146
+ end
147
+
149
148
  TOPLIST = "[not(ancestor::ul) and not(ancestor::ol)]".freeze
150
149
 
151
150
  def table_list_style(xml)
@@ -1,6 +1,6 @@
1
1
  require "fileutils"
2
- require_relative "./front_id"
3
- require_relative "./front_contrib"
2
+ require_relative "front_id"
3
+ require_relative "front_contrib"
4
4
 
5
5
  module Metanorma
6
6
  module Itu
@@ -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
- add_noko_elem(s, "stage", stage, abbreviation: node.attr("docstage-abbrev"))
12
+ add_noko_elem(s, "stage", stage,
13
+ abbreviation: node.attr("docstage-abbrev"))
13
14
  end
14
15
  end
15
16
 
@@ -49,14 +50,14 @@ module Metanorma
49
50
 
50
51
  def other_title_defaultlang(node, xml, type)
51
52
  a = node.attr(type) || node.attr("#{type}-#{@lang}")
52
- add_title_xml(xml, a, @lang, type.sub(/-title/, ""))
53
+ add_title_xml(xml, a, @lang, type.sub("-title", ""))
53
54
  end
54
55
 
55
56
  def other_title_otherlangs(node, xml, type)
56
57
  node.attributes.each do |k, v|
57
58
  m = /^#{type}-(?<lang>.+)$/.match(k) or next
58
59
  m[:lang] == @lang and next
59
- add_title_xml(xml, v, m[:lang], type.sub(/-title/, ""))
60
+ add_title_xml(xml, v, m[:lang], type.sub("-title", ""))
60
61
  end
61
62
  end
62
63
 
@@ -76,8 +77,8 @@ module Metanorma
76
77
 
77
78
  def group_period(node, prefix, suffix)
78
79
  s = node.attr("#{prefix}group-year-start#{suffix}") ||
79
- Date.today.year - (Date.today.year % 2)
80
- e = node.attr("#{prefix}group-year-end#{suffix}") || s.to_i + 2
80
+ (Date.today.year - (Date.today.year % 2))
81
+ e = node.attr("#{prefix}group-year-end#{suffix}") || (s.to_i + 2)
81
82
  [s, e]
82
83
  end
83
84
 
@@ -85,7 +86,7 @@ module Metanorma
85
86
  { series: "main", series1: "secondary", series2: "tertiary" }
86
87
  .each do |k, v|
87
88
  node.attr(k.to_s) and
88
- xml.series **{ type: v } do |s|
89
+ xml.series type: v do |s|
89
90
  add_noko_elem(s, "title", node.attr(k.to_s))
90
91
  end
91
92
  end
@@ -1,3 +1,5 @@
1
+ require "pubid-itu"
2
+
1
3
  module Metanorma
2
4
  module Itu
3
5
  class Converter < Standoc::Converter
@@ -25,55 +27,103 @@ module Metanorma
25
27
  node.attr("common-text-docnumber"), type: "ISO")
26
28
  end
27
29
 
30
+ # KILL
28
31
  ITULANG = { "en" => "E", "fr" => "F", "ar" => "A", "es" => "S",
29
32
  "zh" => "C", "ru" => "R" }.freeze
30
33
 
31
- def itu_id1(node, lang)
32
- bureau = node.attr("bureau") || "T"
33
- id = case doctype(node)
34
- when "service-publication"
35
- itu_service_pub_id(node)
36
- when "contribution"
37
- itu_contrib_id(node)
38
- else
39
- "ITU-#{bureau} #{node.attr('docnumber')}"
40
- end
41
- itu_lang(id, lang)
34
+ def metadata_id_primary_type(_node)
35
+ "ITU"
42
36
  end
43
37
 
44
- def itu_lang(id, lang)
45
- id + (lang ? "-#{ITULANG[@lang]}" : "")
38
+ def metadata_id_primary(node, xml)
39
+ itu_id(node, xml)
46
40
  end
47
41
 
48
- def itu_service_pub_id(node)
49
- @i18n.annex_to_itu_ob_abbrev.sub(/%/, node.attr("docnumber"))
42
+ def itu_id(node, xml)
43
+ node.attr("docnumber") or return
44
+ params = itu_id_params(node)
45
+ itu_id_out(node, xml, params)
50
46
  end
51
47
 
52
- def itu_contrib_id(node)
53
- group = node.attr("group-acronym") ||
54
- node.attr("group")&.sub("Study Group ", "SG") || "XXX"
55
- "#{group}-C#{node.attr('docnumber')}"
48
+ def compact_blank(hash)
49
+ hash.compact.reject { |_, v| v.is_a?(String) && v.empty? }
56
50
  end
57
51
 
58
- def metadata_id_primary(node, xml)
59
- node.attr("docnumber") or return
60
- add_noko_elem(xml, "docidentifier",
61
- itu_id1(node, false),
62
- type: "ITU", primary: "true")
63
- add_noko_elem(xml, "docidentifier",
64
- itu_id1(node, true), type: "ITU-lang")
52
+ def itu_id_pub(node)
53
+ (node.attr("publisher") || "ITU").split(/[;,]/)
54
+ .map(&:strip).map { |x| org_abbrev[x] || x }
65
55
  end
66
56
 
67
- def metadata_id_docidentifier(node, xml)
68
- super
69
- add_noko_elem(xml, "docidentifier",
70
- itu_lang(node.attr("docidentifier"), true),
71
- boilerplate: true,
57
+ def itu_id_params(node)
58
+ itu_id_resolve(node, itu_id_params_core(node), itu_id_params_add(node))
59
+ end
60
+
61
+ def itu_id_resolve(_node, core, add)
62
+ ret = core.merge(add)
63
+ case @doctype
64
+ when "service-publication"
65
+ base = ret.merge(series: "OB")
66
+ ret = { type: :annex, base: base }
67
+ when "contribution"
68
+ ret[:type] = :contribution
69
+ end
70
+ ret
71
+ end
72
+
73
+ def itu_id_params_core(node)
74
+ pub = itu_id_pub(node)
75
+ num = node.attr("docnumber")
76
+ ret = { sector: itu_id_params_sector(node),
77
+ publisher: pub[0],
78
+ copublisher: pub[1..-1] }.compact
79
+ ret.merge!(itu_id_params_num(num))
80
+ ret[:copublisher].empty? and ret.delete(:copublisher)
81
+ ret
82
+ end
83
+
84
+ def itu_id_params_sector(node)
85
+ node.attr("doctype") == "service-publication" and return nil
86
+ node.attr("bureau") || "T"
87
+ end
88
+
89
+ def itu_id_params_num(num)
90
+ if m = /^(?:(?<series>[A-Z])\.)?(?<number>\d+)$/.match(num)
91
+ { series: m[:series], number: m[:number] }
92
+ else { number: num }
93
+ end
94
+ end
95
+
96
+ def itu_id_params_add(node)
97
+ ret = { part: node.attr("partnumber") }
98
+ @doctype == "contribution" and
99
+ ret[:series] = node.attr("group-acronym") ||
100
+ node.attr("group")&.sub("Study Group ", "SG")
101
+ compact_blank(ret)
102
+ end
103
+
104
+ def itu_id_out(node, xml, params)
105
+ add_noko_elem(xml, "docidentifier", itu_id_default(node, params)
106
+ .to_s(i18n_lang: @lang),
107
+ type: "ITU", primary: "true")
108
+ id_lang = itu_id_lang(node, params)
109
+ add_noko_elem(xml, "docidentifier", id_lang.to_s(language: @lang,
110
+ i18n_lang: @lang),
72
111
  type: "ITU-lang")
112
+ add_noko_elem(xml, "docidentifier", id_lang
113
+ .to_s(language: @lang, i18n_lang: @lang, format: :long),
114
+ type: "ITU-lang-long")
73
115
  end
74
116
 
75
- def metadata_id_primary_type(_node)
76
- "ITU"
117
+ def itu_id_default(node, params)
118
+ p = params.dup
119
+ p[:base] &&= itu_id_default(node, p[:base])
120
+ Pubid::Itu::Identifier.create(**p)
121
+ end
122
+
123
+ def itu_id_lang(node, params)
124
+ params[:base] &&= itu_id_lang(node, params[:base])
125
+ params[:language] = @lang
126
+ Pubid::Itu::Identifier.create(**params)
77
127
  end
78
128
 
79
129
  def recommendation_id(node, xml)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Itu
3
- VERSION = "2.8.8".freeze
3
+ VERSION = "2.8.9".freeze
4
4
  end
5
5
  end
@@ -25,12 +25,12 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ["lib"]
26
26
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
27
27
 
28
- spec.add_dependency "metanorma-standoc", "~> 3.4.0"
28
+ spec.add_dependency "metanorma-standoc", "~> 3.4.2"
29
29
  spec.add_dependency "pubid"
30
30
  spec.add_dependency "twitter_cldr", ">= 3.0.0"
31
31
  spec.add_dependency "tzinfo-data" # we need this for windows only
32
32
 
33
- spec.add_development_dependency "canon", "= 0.2.3"
33
+ spec.add_development_dependency "canon" #, "= 0.2.3"
34
34
  spec.add_development_dependency "debug"
35
35
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
36
36
  spec.add_development_dependency "guard", "~> 2.14"
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.8
4
+ version: 2.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-04-27 00:00:00.000000000 Z
11
+ date: 2026-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-standoc
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.4.0
19
+ version: 3.4.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.4.0
26
+ version: 3.4.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: canon
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 0.2.3
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.2.3
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: debug
85
85
  requirement: !ruby/object:Gem::Requirement