metanorma-iec 2.2.3 → 2.2.4

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: 3df1d6637e7c07bd1e152d015eab70efb8907e5b75fdcd988b38bcf9bf4710cd
4
- data.tar.gz: 6c00622ff41524f4451c0f3c43f0b36388eeff742c61ac33e5f2533681c57bbd
3
+ metadata.gz: aa0cb1e4f74a208623ea4afa6ac089d07ef738ab6a5e2b743ba1c9cf874c761f
4
+ data.tar.gz: 306daf6fb488295282985216c68bd3e27f50c0a9a48d5b44949c9b8a7c793ad2
5
5
  SHA512:
6
- metadata.gz: 62f8813c4e594dcfb25ac7a681b8507647ec4cfcd18b2df774903cf54e32bafca9816bac62340771b3b2ac88ccbd1864a18e75f5225e14b6c58dd55282ca6955
7
- data.tar.gz: 30392d4a42b4fa9d2a9c3c8233c251e96a93b43e930a3653674e5f5ca12dad82c1f1021f0dc7a8fbad46b0dc3adf2e5dcac2970d0af54586b410138dc43ef14c
6
+ metadata.gz: ff37df74026031b95f8900c82d5ab67ff1e9df40999ddee4f82e35ead8b9f9d4087c67d60db1987889b69e7dce311163fa79b9d0744d8303322e80ea4d50c7e7
7
+ data.tar.gz: f2969e8aed2645c90fee5e6fafa183ece04729b87827daf62783bc8214a0e37250c0780ad62dd076fa0c19951e1446fd21f770f812d962ea06df42b1962f47db
@@ -13,7 +13,7 @@
13
13
  <p class="coverpage_docnumber">{{ docnumber }}(E) {{ draftinfo }}</p>
14
14
  {% endif %}
15
15
 
16
- <p class="coverpage_techcommittee">{{ agency }}/{{ editorialgroup | join: "/" }}</p>
16
+ <p class="coverpage_techcommittee">{{ editorialgroup }}</p>
17
17
 
18
18
  <p class="coverpage_techcommittee"><a
19
19
  name="CVP_Secretariat_Loca">Secretariat</a>: {{ secretariat }}</p>
@@ -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">
@@ -126,8 +126,8 @@ module Metanorma
126
126
  m = /60050-(\d+)/.match(id) or return
127
127
  xmldoc.xpath("//sections/clause/terms/title").each_with_index do |t, i|
128
128
  num = "%02d" % [i + 1]
129
- t.next = "<variant-title type='toc'>"\
130
- "#{@i18n.section_iev} #{m[1]}-#{num} &#x2013; "\
129
+ t.next = "<variant-title type='toc'>" \
130
+ "#{@i18n.section_iev} #{m[1]}-#{num} &#x2013; " \
131
131
  "#{t.children.to_xml}</variant-title>"
132
132
  end
133
133
  end
@@ -136,6 +136,29 @@ module Metanorma
136
136
  attr_code(keep_attrs(node)
137
137
  .merge(id: ::Metanorma::Utils::anchor_or_uuid(node)))
138
138
  end
139
+
140
+ # TODO remove when I adopt pubid-iec
141
+ #
142
+ def get_id_prefix(xmldoc)
143
+ xmldoc.xpath("//bibdata/contributor[role/@type = 'publisher']" \
144
+ "/organization").each_with_object([]) do |x, prefix|
145
+ x1 = x.at("abbreviation")&.text || x.at("name")&.text
146
+ #(x1 == "IEC" and prefix.unshift("IEC")) or prefix << x1
147
+ prefix << x1
148
+ end
149
+ end
150
+ #
151
+ def docidentifier_cleanup(xmldoc)
152
+ prefix = get_id_prefix(xmldoc)
153
+ id = xmldoc.at("//bibdata/docidentifier[@type = 'ISO']") or return
154
+ id.content = id_prefix(prefix, id)
155
+ id = xmldoc.at("//bibdata/ext/structuredidentifier/project-number") and
156
+ id.content = id_prefix(prefix, id)
157
+ %w(iso-with-lang iso-reference iso-undated).each do |t|
158
+ id = xmldoc.at("//bibdata/docidentifier[@type = '#{t}']") and
159
+ id.content = id_prefix(prefix, id)
160
+ end
161
+ end
139
162
  end
140
163
  end
141
164
  end
@@ -5,7 +5,7 @@ module Metanorma
5
5
  publishers = node.attr("publisher") || "IEC"
6
6
  csv_split(publishers)&.each do |p|
7
7
  xml.contributor do |c|
8
- c.role **{ type: "author" }
8
+ c.role type: "author"
9
9
  c.organization do |a|
10
10
  organization(a, p, false, node, !node.attr("publisher"))
11
11
  end
@@ -17,7 +17,7 @@ module Metanorma
17
17
  publishers = node.attr("publisher") || "IEC"
18
18
  csv_split(publishers)&.each do |p|
19
19
  xml.contributor do |c|
20
- c.role **{ type: "publisher" }
20
+ c.role type: "publisher"
21
21
  c.organization do |a|
22
22
  organization(a, p, true, node, !node.attr("publisher"))
23
23
  end
@@ -51,6 +51,37 @@ module Metanorma
51
51
  xml.docidentifier dn, **attr_code(type: "ISO")
52
52
  end
53
53
 
54
+ def add_id_parts(docnum, part, subpart)
55
+ docnum += "-#{part}" if part
56
+ docnum += "-#{subpart}" if subpart
57
+ docnum
58
+ end
59
+
60
+ def id_stage_prefix(docnum, node)
61
+ stage = get_stage(node)
62
+ typeabbr = get_typeabbr(node)&.upcase
63
+ if stage && (stage.to_i < 60)
64
+ docnum = unpub_stage_prefix(docnum, stage, typeabbr, node)
65
+ elsif typeabbr == "DIR " then docnum = "#{typeabbr}#{docnum}"
66
+ elsif typeabbr && !@amd then docnum = "/#{typeabbr}#{docnum}"
67
+ end
68
+ docnum
69
+ end
70
+
71
+ def unpub_stage_prefix(docnum, stage, typeabbr, node)
72
+ abbr = id_stage_abbr(stage, get_substage(node), node)
73
+ %w(40 50).include?(stage) && i = node.attr("iteration") and
74
+ itersuffix = ".#{i}"
75
+ return docnum if abbr.nil? || abbr.empty? # prefixes added in cleanup
76
+
77
+ typeabbr = "" if %w(DTS FDTS).include?(abbr.sub(/\s+$/, ""))
78
+ return "/#{abbr}#{typeabbr} #{docnum}#{itersuffix}" unless @amd
79
+
80
+ a = docnum.split(%r{/})
81
+ a[-1] = "#{abbr}#{a[-1]}#{itersuffix}"
82
+ a.join("/")
83
+ end
84
+
54
85
  def id_edition_suffix(docnum, node)
55
86
  ed = node.attr("edition") || 1
56
87
  docnum += " ED #{ed}"
@@ -151,7 +182,7 @@ module Metanorma
151
182
  abbr
152
183
  end
153
184
 
154
- def stage_abbr(stage, _substage)
185
+ def stage_abbr(stage, _substage, _doctype)
155
186
  return "PPUB" if stage == "60"
156
187
 
157
188
  DOC_STAGE[stage.to_sym] || "??"
@@ -191,7 +222,8 @@ module Metanorma
191
222
  stage = get_stage(node)
192
223
  substage = get_substage(node)
193
224
  xml.status do |s|
194
- s.stage stage, **attr_code(abbreviation: stage_abbr(stage, substage))
225
+ s.stage stage,
226
+ **attr_code(abbreviation: stage_abbr(stage, substage, nil))
195
227
  subst = status_abbrev1(stage, substage, node.attr("iteration"),
196
228
  doctype(node), node.attr("draft"))
197
229
  s.substage substage, **attr_code(abbreviation: subst)
@@ -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">
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.2.3".freeze
3
+ VERSION = "2.2.4".freeze
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iec
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.3
4
+ version: 2.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-24 00:00:00.000000000 Z
11
+ date: 2023-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso