metanorma-iso 2.8.8 → 2.9.0

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.
@@ -52,19 +52,6 @@ module IsoDoc
52
52
  node.children)
53
53
  end
54
54
 
55
- def termdefinition1(elem)
56
- prefix_domain_to_definition(elem)
57
- super
58
- end
59
-
60
- def prefix_domain_to_definition(elem)
61
- ((d = elem.at(ns("./domain"))) &&
62
- (v = elem.at(ns("./definition/verbal-definition"))) &&
63
- v.elements.first.name == "p") or return
64
- v.elements.first.children.first.previous =
65
- "<#{to_xml(d.remove.children)}> "
66
- end
67
-
68
55
  def insertall_after_here(node, insert, name)
69
56
  node.children.each do |n|
70
57
  n.name == name or next
@@ -31,6 +31,7 @@ module IsoDoc
31
31
  admonition docxml
32
32
  source docxml
33
33
  ol docxml
34
+ quote docxml
34
35
  permission docxml
35
36
  requirement docxml
36
37
  recommendation docxml
@@ -38,6 +39,8 @@ module IsoDoc
38
39
  @xrefs.anchors_previous = @xrefs.anchors.dup # store old xrefs of reqts
39
40
  @xrefs.parse docxml
40
41
  table docxml # have table include requirements newly converted to tables
42
+ # table feeds dl
43
+ dl docxml
41
44
  example docxml
42
45
  note docxml
43
46
  end
@@ -52,6 +55,8 @@ module IsoDoc
52
55
  end
53
56
 
54
57
  def figure1(node)
58
+ figure_fn(node)
59
+ figure_key(node.at(ns("./dl")))
55
60
  lbl = @xrefs.anchor(node["id"], :label, false) or return
56
61
  figname = node.parent.name == "figure" ? "" : "#{@i18n.figure} "
57
62
  conn = node.parent.name == "figure" ? "  " : " — "
@@ -97,7 +102,6 @@ module IsoDoc
97
102
 
98
103
  def admonition1(elem)
99
104
  super
100
- admonition_inline_name(elem)
101
105
  admonition_outside_clauses(elem)
102
106
  end
103
107
 
@@ -113,17 +117,6 @@ module IsoDoc
113
117
  cell.children.each { |p| wrap_in_bold(p) }
114
118
  end
115
119
 
116
- def admonition_inline_name(elem)
117
- n = elem.at(ns("./name")) or return
118
- if (p = n.next_element) && p&.name == "p"
119
- p.children.first.previous = admonition_name(to_xml(n.remove.children))
120
- end
121
- end
122
-
123
- def admonition_name(xml)
124
- "#{xml} — "
125
- end
126
-
127
120
  def bibrender_formattedref(formattedref, xml)
128
121
  %w(techreport standard).include? xml["type"] and return
129
122
  super
@@ -146,10 +139,9 @@ module IsoDoc
146
139
 
147
140
  def formula_where(dlist)
148
141
  dlist.nil? and return
149
- return super unless dlist.xpath(ns("./dt")).size == 1 &&
142
+ dlist.xpath(ns("./dt")).size == 1 &&
150
143
  dlist.at(ns("./dd"))&.elements&.size == 1 &&
151
- dlist.at(ns("./dd/p"))
152
-
144
+ dlist.at(ns("./dd/p")) or return super
153
145
  formula_where_one(dlist)
154
146
  end
155
147
 
@@ -162,7 +154,7 @@ module IsoDoc
162
154
 
163
155
  def table1(elem)
164
156
  elem.xpath(ns(".//dl[@key = 'true'][not(./name)]")).each do |dl|
165
- dl.children.first.previous = "<name>#{@i18n.key}</name>"
157
+ dl.add_first_child "<name>#{@i18n.key}</name>"
166
158
  end
167
159
  super
168
160
  end
@@ -177,7 +169,7 @@ module IsoDoc
177
169
  return
178
170
  s = docxml.at(ns("//sections")) or return
179
171
  ret = "#{middle_title_main}#{middle_title_amd}"
180
- s.children.first.previous = ret
172
+ s.add_first_child ret
181
173
  end
182
174
 
183
175
  def middle_title_main
@@ -214,9 +206,7 @@ module IsoDoc
214
206
  end
215
207
 
216
208
  def move_norm_ref_to_sections(docxml)
217
- if amd?(docxml)
218
- else super
219
- end
209
+ amd?(docxml) or super
220
210
  end
221
211
 
222
212
  def twitter_cldr_localiser_symbols
@@ -224,6 +214,25 @@ module IsoDoc
224
214
  fraction_group_digits: 3 }
225
215
  end
226
216
 
217
+ def implicit_reference(bib)
218
+ bib.at(ns("./docidentifier"))&.text == "IEV" and return true
219
+ super
220
+ end
221
+
222
+ def render_identifier(ident)
223
+ ret = super
224
+ ret[:sdo] = std_docid_semantic(ret[:sdo])
225
+ ret
226
+ end
227
+
228
+ def admonition_delim(elem)
229
+ if elem.at("./*[not(self::xmlns:name)]")&.name == "p"
230
+ " &#x2014; "
231
+ else
232
+ ""
233
+ end
234
+ end
235
+
227
236
  include Init
228
237
  end
229
238
  end
@@ -130,6 +130,8 @@ module IsoDoc
130
130
  end
131
131
 
132
132
  def expand_citeas(text)
133
+ ret = super or return
134
+ ret.include?("<span") and return ret
133
135
  std_docid_semantic(super)
134
136
  end
135
137
 
@@ -12,7 +12,7 @@ module IsoDoc
12
12
  @foreword = true
13
13
  page_break(out)
14
14
  out.div **attr_code(id: clause["id"]) do |s|
15
- clause_name(nil, clause.at(ns("./title")) || @i18n.foreword, s,
15
+ clause_name(nil, clause.at(ns("./title")), s,
16
16
  { class: "ForewordTitle" })
17
17
  clause.elements.each { |e| parse(e, s) unless e.name == "title" }
18
18
  end
@@ -110,26 +110,44 @@ module IsoDoc
110
110
  end
111
111
 
112
112
  def authority_cleanup(docxml)
113
- insert = docxml.at("//div[@id = 'boilerplate-license-destination']")
114
- auth = docxml.at("//div[@class = 'boilerplate-license']")&.remove
115
- auth&.xpath(".//p[not(@class)]")&.each { |p| p["class"] = "zzWarning" }
116
- auth and insert and insert.children = auth
117
- insert = docxml.at("//div[@id = 'boilerplate-copyright-destination']")
118
- auth = docxml.at("//div[@class = 'boilerplate-copyright']")&.remove
119
- auth&.xpath(".//p[not(@class)]")&.each do |p|
120
- p["class"] = "zzCopyright"
121
- end
122
- auth&.xpath(".//p[@id = 'boilerplate-message']")&.each do |p|
113
+ authority_license_cleanup(docxml)
114
+ authority_copyright_cleanup(docxml)
115
+ coverpage_note_cleanup(docxml)
116
+ end
117
+
118
+ def authority_copyright_cleanup(docxml)
119
+ auth = docxml.at("//div[@class = 'boilerplate-copyright']") or return
120
+ authority_copyright_style(auth)
121
+ authority_copyright_populate(docxml, auth)
122
+ end
123
+
124
+ def authority_copyright_style(auth)
125
+ auth.xpath(".//p[not(@class)]").each { |p| p["class"] = "zzCopyright" }
126
+ auth.xpath(".//p[@id = 'boilerplate-message']").each do |p|
123
127
  p["class"] = "zzCopyright1"
124
128
  end
125
- auth&.xpath(".//p[@id = 'boilerplate-address']")&.each do |p|
129
+ auth.xpath(".//p[@id = 'boilerplate-address']").each do |p|
126
130
  p["class"] = "zzAddress"
127
131
  end
128
- auth&.xpath(".//p[@id = 'boilerplate-place']")&.each do |p|
132
+ auth.xpath(".//p[@id = 'boilerplate-place']").each do |p|
129
133
  p["class"] = "zzCopyright1"
130
134
  end
131
- auth and insert and insert.children = auth
132
- coverpage_note_cleanup(docxml)
135
+ end
136
+
137
+ def authority_copyright_populate(doc, auth)
138
+ i = doc.at("//div[@id = 'boilerplate-copyright-default-destination']")
139
+ j = doc.at("//div[@id = 'boilerplate-copyright-append-destination']")
140
+ default = auth.at(".//div[@id = 'boilerplate-copyright-default']")
141
+ default and i and i.children = default.remove
142
+ j and j.children = auth.remove
143
+ end
144
+
145
+ def authority_license_cleanup(docxml)
146
+ dest = docxml.at("//div[@id = 'boilerplate-license-destination']") or
147
+ return
148
+ auth = docxml.at("//div[@class = 'boilerplate-license']") or return
149
+ auth.xpath(".//p[not(@class)]").each { |p| p["class"] = "zzWarning" }
150
+ dest.children = auth.remove
133
151
  end
134
152
 
135
153
  def word_cleanup(docxml)
@@ -142,9 +160,7 @@ module IsoDoc
142
160
  # supply missing annex title
143
161
  def make_WordToC(docxml, level)
144
162
  toc = ""
145
- if source = docxml.at("//div[@class = 'TOC']")
146
- toc = to_xml(source.children)
147
- end
163
+ s = docxml.at("//div[@class = 'TOC']") and toc = to_xml(s.children)
148
164
  xpath = (1..level).each.map { |i| "//h#{i}" }.join (" | ")
149
165
  docxml.xpath(xpath).each do |h|
150
166
  x = ""
@@ -7,7 +7,7 @@ module IsoDoc
7
7
  clause.at(ns("./clause")) and
8
8
  @anchors[clause["id"]] = { label: nil, level: 1, type: "clause",
9
9
  xref: clause.at(ns("./title"))&.text }
10
- i = Counter.new(0, prefix: "0.")
10
+ i = Counter.new(0, prefix: "0")
11
11
  clause.xpath(ns("./clause")).each do |c|
12
12
  section_names1(c, i.increment(c).print, 2)
13
13
  end
@@ -26,7 +26,7 @@ module IsoDoc
26
26
  anchor_struct(i.print, nil, @labels["appendix"],
27
27
  "clause").merge(level: 2, subtype: "annex",
28
28
  container: clause["id"])
29
- j = Counter.new(0, prefix: "#{i.print}.")
29
+ j = Counter.new(0, prefix: i.print)
30
30
  c.xpath(ns("./clause | ./references")).each do |c1|
31
31
  lbl = "#{@labels['appendix']} #{j.increment(c1).print}"
32
32
  appendix_names1(c1, l10n(lbl), 3, clause["id"])
@@ -62,7 +62,7 @@ module IsoDoc
62
62
 
63
63
  def annex_names1(clause, num, level)
64
64
  annex_name_anchors1(clause, num, level)
65
- i = Counter.new(0, prefix: "#{num}.")
65
+ i = Counter.new(0, prefix: num)
66
66
  clause.xpath(ns("./clause | ./references")).each do |c|
67
67
  annex_names1(c, i.increment(c).print, level + 1)
68
68
  end
@@ -71,7 +71,7 @@ module IsoDoc
71
71
  def appendix_names1(clause, num, level, container)
72
72
  @anchors[clause["id"]] = { label: num, xref: num, level: level,
73
73
  container: container }
74
- i = Counter.new(0, prefix: "#{num}.")
74
+ i = Counter.new(0, prefix: num)
75
75
  clause.xpath(ns("./clause | ./references")).each do |c|
76
76
  appendix_names1(c, i.increment(c).print, level + 1, container)
77
77
  end
@@ -1,6 +1,7 @@
1
1
  == copyright-statement
2
2
  {% if document_scheme == "1951" %}
3
3
 
4
+ [[boilerplate-copyright-default]]
4
5
  === REPRODUCTION INTERDITE
5
6
 
6
7
  [[boilerplate-message]]
@@ -20,6 +21,7 @@ nationales de normalisation.
20
21
 
21
22
  {% elsif document_scheme == "1972" or document_scheme == "1987" %}
22
23
 
24
+ [[boilerplate-copyright-default]]
23
25
  === {blank}
24
26
 
25
27
  [[boilerplate-year]]
@@ -31,6 +33,7 @@ Publié en Suisse
31
33
 
32
34
  {% elsif document_scheme == "1989" %}
33
35
 
36
+ [[boilerplate-copyright-default]]
34
37
  === {blank}
35
38
 
36
39
  [[boilerplate-year]]
@@ -53,6 +56,7 @@ Imprimé en Suisse
53
56
 
54
57
 
55
58
  {% else %}
59
+ [[boilerplate-copyright-default]]
56
60
  === {% if stage_int >= 40 %}DOCUMENT PROTÉGÉ PAR COPYRIGHT{%else%}{blank}{%endif%}
57
61
 
58
62
  [[boilerplate-year]]
@@ -2,6 +2,7 @@
2
2
 
3
3
  {% if document_scheme == "1972" or document_scheme == "1987" %}
4
4
 
5
+ [[boilerplate-copyright-default]]
5
6
  === {blank}
6
7
 
7
8
  [[boilerplate-year]]
@@ -12,6 +13,7 @@
12
13
 
13
14
  {% elsif document_scheme == "1989" %}
14
15
 
16
+ [[boilerplate-copyright-default]]
15
17
  === {blank}
16
18
 
17
19
  [[boilerplate-year]]
@@ -34,6 +36,7 @@ X.400&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;&#xa0;c=ch; a=400net;
34
36
 
35
37
  {% else %}
36
38
 
39
+ [[boilerplate-copyright-default]]
37
40
  === {% if stage_int >= 40 %}ДОКУМЕНТ, ОХРАНЯЕМЫЙ АВТОРСКИМ ПРАВОМ{% else %}{blank}{% endif %}
38
41
 
39
42
  [[boilerplate-year]]
@@ -2,6 +2,7 @@
2
2
 
3
3
  {% if document_scheme == "1951" %}
4
4
 
5
+ [[boilerplate-copyright-default]]
5
6
  === COPYRIGHT RESERVED
6
7
 
7
8
  [[boilerplate-message]]
@@ -20,6 +21,7 @@ Also issued in French and Russian. Copies to be obtained through the national st
20
21
 
21
22
  {% elsif document_scheme == "1972" or document_scheme == "1987" %}
22
23
 
24
+ [[boilerplate-copyright-default]]
23
25
  === {blank}
24
26
 
25
27
  [[boilerplate-year]]
@@ -31,6 +33,7 @@ Printed in Switzerland
31
33
 
32
34
  {% elsif document_scheme == "1989" %}
33
35
 
36
+ [[boilerplate-copyright-default]]
34
37
  === {blank}
35
38
 
36
39
  [[boilerplate-year]]
@@ -53,6 +56,7 @@ Printed in Switzerland
53
56
 
54
57
  {% else %}
55
58
 
59
+ [[boilerplate-copyright-default]]
56
60
  === {% if stage_int >= 40 %}COPYRIGHT PROTECTED DOCUMENT{% else %}{blank}{% endif %}
57
61
 
58
62
  [[boilerplate-year]]
@@ -12,11 +12,16 @@ module Metanorma
12
12
  class Converter < Standoc::Converter
13
13
  def metadata_ext(node, xml)
14
14
  super
15
+ metadata_ext_iso(node, xml)
16
+ end
17
+
18
+ def metadata_ext_iso(node, xml)
15
19
  structured_id(node, xml)
16
20
  metadata_stage(node, xml)
17
21
  @amd && a = node.attr("updates-document-type") and
18
22
  xml.updates_document_type a
19
23
  a = node.attr("fast-track") and xml.send "fast-track", a != "false"
24
+ a = node.attr("price-code") and xml.price_code a
20
25
  end
21
26
 
22
27
  STAGE_ERROR = [Pubid::Core::Errors::HarmonizedStageCodeInvalidError,
@@ -54,12 +54,10 @@ module Metanorma
54
54
  def contrib_committee_build(xml, agency, committee)
55
55
  name = org_abbrev.invert[agency] and agency = name
56
56
  xml.name agency
57
- xml.subdivision do |s|
58
- s.organization do |o|
57
+ xml.subdivision do |o|
59
58
  o.name committee[:name]
60
59
  committee[:abbr] and o.abbreviation committee[:abbr]
61
60
  committee[:ident] and o.identifier committee[:ident]
62
- end
63
61
  end
64
62
  end
65
63
 
@@ -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.0 -->
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">
@@ -30,6 +30,9 @@
30
30
  <optional>
31
31
  <ref name="fast_track"/>
32
32
  </optional>
33
+ <optional>
34
+ <ref name="price-code"/>
35
+ </optional>
33
36
  </define>
34
37
  <define name="bdate">
35
38
  <element name="date">
@@ -234,4 +237,9 @@
234
237
  <data type="boolean"/>
235
238
  </element>
236
239
  </define>
240
+ <define name="price-code">
241
+ <element name="price-code">
242
+ <text/>
243
+ </element>
244
+ </define>
237
245
  </grammar>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Iso
3
- VERSION = "2.8.8".freeze
3
+ VERSION = "2.9.0".freeze
4
4
  end
5
5
  end
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.test_files = `git ls-files -- {spec}/*`.split("\n")
33
33
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
34
34
 
35
- spec.add_dependency "metanorma-standoc", "~> 2.9.3"
35
+ spec.add_dependency "metanorma-standoc", "~> 2.10.0"
36
36
  spec.add_dependency "mnconvert", "~> 1.14"
37
37
  spec.add_dependency "pubid"
38
38
  spec.add_dependency "tokenizer", "~> 0.3.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-iso
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.8
4
+ version: 2.9.0
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-14 00:00:00.000000000 Z
11
+ date: 2024-11-11 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: 2.9.3
19
+ version: 2.10.0
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.9.3
26
+ version: 2.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mnconvert
29
29
  requirement: !ruby/object:Gem::Requirement