metanorma-iec 2.5.6 → 2.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,9 +11,8 @@ module IsoDoc
11
11
  end
12
12
 
13
13
  def xref_init(lang, script, _klass, labels, options)
14
- @xrefs = Xref.new(lang, script,
15
- HtmlConvert.new(language: lang, script: script),
16
- labels, options)
14
+ p = HtmlConvert.new(language: lang, script: script)
15
+ @xrefs = Xref.new(lang, script, p, labels, options)
17
16
  end
18
17
 
19
18
  def i18n_init(lang, script, locale, i18nyaml = nil)
@@ -20,25 +20,25 @@ module IsoDoc
20
20
  set(:revdate, revdate&.text)
21
21
  end
22
22
 
23
- def doctype(isoxml, _out)
23
+ def doctype(xml, _out)
24
24
  super
25
- b = isoxml&.at(ns("//bibdata/ext/doctype#{NOLANG}"))&.text
26
- b1 = isoxml&.at(ns("//bibdata/ext/doctype[@language = 'en']"))&.text || b
25
+ b = xml.at(ns("//bibdata/ext/doctype#{NOLANG}"))&.text
26
+ b1 = xml.at(ns("//bibdata/ext/doctype[@language = 'en']"))&.text || b
27
27
  b1 and set(:doctype_en, status_print(b1))
28
- b1 = isoxml&.at(ns("//bibdata/ext/doctype[@language = 'fr']"))&.text || b
28
+ b1 = xml.at(ns("//bibdata/ext/doctype[@language = 'fr']"))&.text || b
29
29
  b1 and set(:doctype_fr, status_print(b1))
30
- docfunction(isoxml)
31
- dochorizontal(isoxml)
30
+ docfunction(xml)
31
+ dochorizontal(xml)
32
32
  end
33
33
 
34
- def docfunction(isoxml)
35
- b = isoxml&.at(ns("//bibdata/ext/function#{NOLANG}"))&.text || return
34
+ def docfunction(xml)
35
+ b = xml.at(ns("//bibdata/ext/function#{NOLANG}"))&.text || return
36
36
  b and set(:function, status_print(b))
37
- b1 = isoxml&.at(ns("//bibdata/ext/function#{currlang}"))&.text || b
37
+ b1 = xml.at(ns("//bibdata/ext/function#{currlang}"))&.text || b
38
38
  b1 and set(:function_display, status_print(b1))
39
- b1 = isoxml&.at(ns("//bibdata/ext/function[@language = 'en']"))&.text || b
39
+ b1 = xml.at(ns("//bibdata/ext/function[@language = 'en']"))&.text || b
40
40
  b1 and set(:function_en, status_print(b1))
41
- b1 = isoxml&.at(ns("//bibdata/ext/function[@language = 'fr']"))&.text || b
41
+ b1 = xml.at(ns("//bibdata/ext/function[@language = 'fr']"))&.text || b
42
42
  b1 and set(:function_fr, status_print(b1))
43
43
  end
44
44
 
@@ -54,7 +54,7 @@ module IsoDoc
54
54
  end
55
55
 
56
56
  def unpublished(status)
57
- status.to_i > 0 && status.to_i < 60
57
+ status.to_i.positive? && status.to_i < 60
58
58
  end
59
59
  end
60
60
  end
@@ -3,9 +3,13 @@ module IsoDoc
3
3
  class PresentationXMLConvert < IsoDoc::Iso::PresentationXMLConvert
4
4
  def termclause1(elem)
5
5
  @is_iev or return clause1(elem)
6
- @suppressheadingnumbers || elem["unnumbered"] and return
7
- lbl = @xrefs.anchor(elem["id"], :label, true) or return
8
- prefix_name(elem, " ", "#{lbl}#{clausedelim}", "title")
6
+ @suppressheadingnumbers || elem["unnumbered"] or
7
+ lbl = @xrefs.anchor(elem["id"], :label, true)
8
+ if lbl
9
+ prefix_name(elem, { caption: " " }, "#{lbl}#{clausedelim}", "title")
10
+ else
11
+ prefix_name(elem, {}, nil, "title")
12
+ end
9
13
  end
10
14
 
11
15
  def concept(docxml)
@@ -15,9 +19,9 @@ module IsoDoc
15
19
 
16
20
  def concept_iev(docxml)
17
21
  labels = @xrefs.get_anchors.each_with_object({}) do |(k, v), m|
18
- m[v[:label]] = k
22
+ v[:label] and m[v[:label].gsub(%r{</?[^>]+>}, "")] = k
19
23
  end
20
- docpart = docxml&.at(ns("//bibdata/ext/structuredidentifier/" \
24
+ docpart = docxml.at(ns("//bibdata/ext/structuredidentifier/" \
21
25
  "project-number/@part"))&.text or return
22
26
  docxml.xpath(ns("//termref[@base = 'IEV']")).each do |t|
23
27
  concept_iev1(t, docpart, labels)
@@ -38,15 +42,25 @@ module IsoDoc
38
42
  merge_fr_into_en_term(docxml)
39
43
  end
40
44
 
45
+ def termdomain(elem)
46
+ if @is_iev
47
+ d = elem.at(ns("./domain")) or return
48
+ d["hidden"] = true
49
+ else super
50
+ end
51
+ end
52
+
41
53
  def merge_fr_into_en_term(docxml)
42
54
  @is_iev or return
43
55
  docxml.xpath(ns("//term[@language = 'en'][@tag]")).each do |en|
44
56
  fr = docxml.at(ns("//term[@language = 'fr'][@tag = '#{en['tag']}']"))
45
57
  merge_fr_into_en_term1(en, fr) if fr
58
+ en.xpath(ns("./fmt-name | ./fmt-xref-label")).each(&:remove)
59
+ term1(en)
46
60
  end
47
61
  @xrefs.parse_inclusions(clauses: true).parse docxml
48
- docxml.xpath(ns("//term/name")).each(&:remove)
49
- term(docxml)
62
+ #docxml.xpath(ns("//term/fmt-name | //term/fmt-xref")).each(&:remove)
63
+ #term(docxml)
50
64
  end
51
65
 
52
66
  def merge_fr_into_en_term1(en_term, fr_term)
@@ -69,8 +83,7 @@ module IsoDoc
69
83
  .each_with_object([]) do |d, m|
70
84
  lg = d["language"]
71
85
  d.delete("language")
72
- next if lgs.include?(lg)
73
-
86
+ lgs.include?(lg) and next
74
87
  p = d.parent
75
88
  designation_annotate(p, d.at(ns("./name")))
76
89
  m << { lang: lg, script: Metanorma::Utils.default_script(lg),
@@ -119,13 +132,13 @@ module IsoDoc
119
132
 
120
133
  def move_related(term)
121
134
  defn = term.at(ns("./definition")) or return
122
- term.xpath(ns("./related")).reverse.each do |r|
135
+ term.xpath(ns("./related")).reverse_each do |r|
123
136
  defn.next = r.remove
124
137
  end
125
138
  end
126
139
 
127
140
  def related1(node)
128
- lg = node&.at("./ancestor::xmlns:term/@language")&.text
141
+ lg = node.at("./ancestor::xmlns:term/@language")&.text
129
142
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
130
143
  p = node.at(ns("./preferred"))
131
144
  ref = node.at(ns("./xref | ./eref | ./termref"))
@@ -166,19 +179,26 @@ module IsoDoc
166
179
 
167
180
  def termexample1(elem)
168
181
  lg = elem&.at("./ancestor::xmlns:term/@language")&.text
182
+ #require "debug"; binding.b
169
183
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
170
184
  example1(elem)
171
185
  @i18n = @i18n_lg["default"]
172
186
  end
173
187
 
174
- def termnote1(elem)
188
+ def termnote_label(elem)
175
189
  lg = elem&.at("./ancestor::xmlns:term/@language")&.text
176
190
  @i18n = @i18n_lg[lg] if lg && @i18n_lg[lg]
177
191
 
178
192
  val = @xrefs.anchor(elem["id"], :value) || "???"
179
193
  lbl = @i18n.termnote.gsub("%", val)
180
- prefix_name(elem, "", lower2cap(lbl), "name")
194
+ ret = @i18n.l10n lbl
181
195
  @i18n = @i18n_lg["default"]
196
+ ret
197
+ end
198
+
199
+ def term1(elem)
200
+ #require 'debug'; binding.b
201
+ super
182
202
  end
183
203
  end
184
204
  end
@@ -15,17 +15,15 @@ module IsoDoc
15
15
  end
16
16
 
17
17
  def clause(docxml)
18
- docxml.xpath(ns("//clause[not(ancestor::annex)] | " \
19
- "//definitions | //references | " \
20
- "//preface/introduction[clause]"))
18
+ docxml.xpath(ns("//clause | //definitions | //references | //appendix | " \
19
+ "//introduction | //foreword | //preface/abstract | " \
20
+ "//acknowledgements | //colophon | //indexsect "))
21
21
  .each do |f|
22
22
  f.parent.name == "annex" &&
23
23
  @xrefs.klass.single_term_clause?(f.parent) and next
24
24
  clause1(f)
25
25
  end
26
- docxml.xpath(ns("//terms")).each do |f|
27
- termclause1(f)
28
- end
26
+ docxml.xpath(ns("//terms")).each { |f| termclause1(f) }
29
27
  end
30
28
 
31
29
  def clause1(elem)
@@ -65,10 +63,15 @@ module IsoDoc
65
63
  <foreword id='_#{UUIDTools::UUID.random_create}'> </foreword>
66
64
  CLAUSE
67
65
  end
68
- f.children.empty? and f.children = " "
69
- ins = f.at(ns("./title")) || f.children.first.before(" ").previous
70
- ins.next =
71
- "<clause type='boilerplate_legal'>#{to_xml(b.children)}</clause>"
66
+ insert_foreword_boilerplate(f, b)
67
+ end
68
+
69
+ def insert_foreword_boilerplate(elem, boilerplate)
70
+ elem.children.empty? and elem.children = " "
71
+ ins = elem.at(ns("./title")) || elem.children.first.before(" ").previous
72
+ ins.next = <<~CLAUSE
73
+ <clause type='boilerplate_legal'>#{to_xml(boilerplate.children)}</clause>
74
+ CLAUSE
72
75
  end
73
76
 
74
77
  def insert_middle_title(docxml)
@@ -118,7 +121,7 @@ module IsoDoc
118
121
  <p class='zzSTDTitle2'><strong>#{title2}</strong><p>
119
122
  TITLE
120
123
  ret += "<p class='zzSTDTitle1'>&#xa0;</p>"
121
- s.children.first.previous = ret
124
+ s.add_first_child ret
122
125
  end
123
126
 
124
127
  include Init
@@ -203,8 +203,7 @@ module IsoDoc
203
203
  end
204
204
 
205
205
  def annex_name(_annex, name, div)
206
- return if name.nil?
207
-
206
+ name.nil? and return
208
207
  div.h1 class: "Annex" do |t|
209
208
  name.children.each { |c2| parse(c2, t) }
210
209
  clause_parse_subtitle(name, t)
@@ -216,9 +215,9 @@ module IsoDoc
216
215
  div.p **attr_code(class: "formula") do |_p|
217
216
  insert_tab(div, 1)
218
217
  parse(node.at(ns("./stem")), div)
219
- if lbl = node&.at(ns("./name"))&.text
218
+ if lbl = node&.at(ns("./fmt-name"))&.text
220
219
  insert_tab(div, 1)
221
- div << "(#{lbl})"
220
+ div << lbl
222
221
  end
223
222
  end
224
223
  end
@@ -10,7 +10,7 @@ module IsoDoc
10
10
  end
11
11
 
12
12
  def introduction_names(clause)
13
- return super unless @is_iev
13
+ super unless @is_iev
14
14
  end
15
15
 
16
16
  def initial_anchor_names(docxml)
@@ -18,28 +18,41 @@ module IsoDoc
18
18
  return unless @is_iev
19
19
 
20
20
  if @parse_settings.empty? || @parse_settings[:clauses]
21
+ @terms_iev_names = true
21
22
  terms_iev_names(docxml)
23
+ @terms_iev_names = false
22
24
  end
23
25
  end
24
26
 
25
27
  def terms_iev_names(docxml)
26
28
  docxml.xpath(ns("//sections/clause/terms")).each_with_index do |t, i|
27
- num = "#{@iev_part}-%02d" % [i + 1]
29
+ num = semx(t, "#{@iev_part}-%02d" % [i + 1])
28
30
  @anchors[t["id"]] =
29
- { label: num, xref: l10n("#{@labels['section_iev']} #{num}"),
31
+ { label: num,
32
+ #xref: l10n("#{@labels['section_iev']} #{num}"),
33
+ xref: labelled_autonum(@labels['section_iev'], num),
30
34
  level: 2, type: "clause", elem: @labels["section_iev"] }
31
35
  t.xpath(ns("./term")).each_with_index do |c, j|
32
- num2 = "%02d" % [j + 1]
33
- section_names1(c, "#{num}-#{num2}", 3)
36
+ num2 = semx(c, "%02d" % [j + 1])
37
+ #section_names1(c, "#{num}#{delim_wrap("-")}#{num2}", 3)
38
+ section_names1(c, num, num2, 3)
34
39
  end
35
40
  end
36
41
  end
37
42
 
43
+ def clausesep
44
+ if @terms_iev_names then "-"
45
+ else super
46
+ end
47
+ end
48
+
38
49
  def annex_name_lbl(clause, num)
39
50
  obl = l10n("(#{@labels['inform_annex']})")
40
51
  clause["obligation"] == "normative" and
41
52
  obl = l10n("(#{@labels['norm_annex']})")
42
- l10n("<strong>#{@labels['annex']} #{num}</strong><br/>#{obl}")
53
+ obl = "<span class='fmt-obligation'>#{l10n obl}</fmt>"
54
+ s = labelled_autonum(@labels['annex'], num)
55
+ l10n("<strong><span class='fmt-caption-label'>#{s}</span></strong><br/>#{obl}")
43
56
  end
44
57
  end
45
58
  end
@@ -1783,9 +1783,21 @@ that the `number` given for the series applies to the second iteration of number
1783
1783
  May be used to differentiate rendering of notes in bibliographies</a:documentation>
1784
1784
  </attribute>
1785
1785
  </optional>
1786
- <ref name="LocalizedMarkedUpString">
1786
+ <ref name="LocalizedStringAttributes">
1787
1787
  <a:documentation>The content of the note</a:documentation>
1788
1788
  </ref>
1789
+ <choice>
1790
+ <oneOrMore>
1791
+ <ref name="BasicBlockNoId">
1792
+ <a:documentation>Multiple blocks of content</a:documentation>
1793
+ </ref>
1794
+ </oneOrMore>
1795
+ <oneOrMore>
1796
+ <ref name="TextElement">
1797
+ <a:documentation>Single block of content</a:documentation>
1798
+ </ref>
1799
+ </oneOrMore>
1800
+ </choice>
1789
1801
  </element>
1790
1802
  </define>
1791
1803
  <define name="bibabstract">
@@ -166,7 +166,6 @@ module Metanorma
166
166
  super
167
167
  a = node.attr("accessibility-color-inside") and
168
168
  xml.accessibility_color_inside a
169
- a = node.attr("price-code") and xml.price_code a
170
169
  a = node.attr("cen-processing") and xml.cen_processing a
171
170
  a = node.attr("secretary") and xml.secretary a
172
171
  a = node.attr("interest-to-committees") and xml.interest_to_committees a
@@ -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.3.4 -->
20
+ <!-- VERSION v1.4.1 -->
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">
@@ -326,7 +326,7 @@ normative or informative references, some split references into sections organiz
326
326
  <a:documentation>Content of note</a:documentation>
327
327
  <oneOrMore>
328
328
  <choice>
329
- <ref name="paragraph"/>
329
+ <ref name="paragraph-with-footnote"/>
330
330
  <ref name="ul"/>
331
331
  <ref name="ol"/>
332
332
  <ref name="dl"/>
@@ -412,7 +412,7 @@ normative or informative references, some split references into sections organiz
412
412
  <element name="note">
413
413
  <ref name="OptionalId"/>
414
414
  <oneOrMore>
415
- <ref name="paragraph"/>
415
+ <ref name="paragraph-with-footnote"/>
416
416
  </oneOrMore>
417
417
  </element>
418
418
  </define>
@@ -1977,7 +1977,7 @@ used in document amendments</a:documentation>
1977
1977
  <oneOrMore>
1978
1978
  <choice>
1979
1979
  <a:documentation>Content of the verbal representation of the term</a:documentation>
1980
- <ref name="paragraph"/>
1980
+ <ref name="paragraph-with-footnote"/>
1981
1981
  <ref name="dl"/>
1982
1982
  <ref name="ol"/>
1983
1983
  <ref name="ul"/>
@@ -2015,7 +2015,7 @@ used in document amendments</a:documentation>
2015
2015
  <oneOrMore>
2016
2016
  <choice>
2017
2017
  <a:documentation>Content of the term note</a:documentation>
2018
- <ref name="paragraph"/>
2018
+ <ref name="paragraph-with-footnote"/>
2019
2019
  <ref name="ul"/>
2020
2020
  <ref name="ol"/>
2021
2021
  <ref name="dl"/>
@@ -2037,7 +2037,7 @@ used in document amendments</a:documentation>
2037
2037
  <ref name="dl"/>
2038
2038
  <ref name="quote"/>
2039
2039
  <ref name="sourcecode"/>
2040
- <ref name="paragraph"/>
2040
+ <ref name="paragraph-with-footnote"/>
2041
2041
  <ref name="figure"/>
2042
2042
  </choice>
2043
2043
  </oneOrMore>
@@ -28,10 +28,10 @@
28
28
  <ref name="updates_document_type"/>
29
29
  </optional>
30
30
  <optional>
31
- <ref name="accessibility-color-inside"/>
31
+ <ref name="price-code"/>
32
32
  </optional>
33
33
  <optional>
34
- <ref name="price-code"/>
34
+ <ref name="accessibility-color-inside"/>
35
35
  </optional>
36
36
  <optional>
37
37
  <ref name="cen-processing"/>
@@ -75,36 +75,19 @@
75
75
  </choice>
76
76
  </element>
77
77
  </define>
78
- <define name="organization">
79
- <element name="organization">
80
- <oneOrMore>
81
- <ref name="orgname"/>
82
- </oneOrMore>
83
- <optional>
84
- <ref name="abbreviation"/>
85
- </optional>
86
- <optional>
87
- <ref name="uri"/>
88
- </optional>
89
- <zeroOrMore>
90
- <ref name="org-identifier"/>
91
- </zeroOrMore>
92
- <zeroOrMore>
93
- <ref name="contact"/>
94
- </zeroOrMore>
95
- <optional>
96
- <ref name="technical-committee"/>
97
- </optional>
98
- <optional>
99
- <ref name="subcommittee"/>
100
- </optional>
101
- <optional>
102
- <ref name="workgroup"/>
103
- </optional>
104
- <optional>
105
- <ref name="secretariat"/>
106
- </optional>
107
- </element>
78
+ <define name="OrganizationType" combine="interleave">
79
+ <optional>
80
+ <ref name="technical-committee"/>
81
+ </optional>
82
+ <optional>
83
+ <ref name="subcommittee"/>
84
+ </optional>
85
+ <optional>
86
+ <ref name="workgroup"/>
87
+ </optional>
88
+ <optional>
89
+ <ref name="secretariat"/>
90
+ </optional>
108
91
  </define>
109
92
  <define name="DocumentType">
110
93
  <choice>
@@ -1,6 +1,6 @@
1
1
  module Metanorma
2
2
  module Iec
3
- VERSION = "2.5.6".freeze
3
+ VERSION = "2.5.8".freeze
4
4
  end
5
5
  end
6
6
 
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
30
30
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
31
31
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
32
32
 
33
- spec.add_dependency "metanorma-iso", "~> 2.8.0"
33
+ spec.add_dependency "metanorma-iso", "~> 2.9.1"
34
34
  spec.add_dependency "pubid"
35
35
 
36
36
  spec.add_development_dependency "debug"
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.5.6
4
+ version: 2.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-28 00:00:00.000000000 Z
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-iso
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.8.0
19
+ version: 2.9.1
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: 2.8.0
26
+ version: 2.9.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pubid
29
29
  requirement: !ruby/object:Gem::Requirement