metanorma-bipm 2.5.6 → 2.5.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -74,8 +74,8 @@ _bib)
74
74
 
75
75
  def reference_name(ref)
76
76
  super
77
- @jcgm and
78
- @xrefs.get[ref["id"]][:xref] = wrap_brackets(@xrefs.get[ref["id"]][:xref])
77
+ @jcgm and @xrefs.get[ref["id"]][:xref] =
78
+ wrap_brackets(@xrefs.get[ref["id"]][:xref])
79
79
  end
80
80
  end
81
81
  end
@@ -6,7 +6,8 @@ module IsoDoc
6
6
  @iso.middle_title(docxml)
7
7
  end
8
8
 
9
- def table1(elem)
9
+ # KILL
10
+ def table1x(elem)
10
11
  table_fn(elem)
11
12
  labelled_ancestor(elem) || elem["unnumbered"] and return
12
13
  n = @xrefs.anchor(elem["id"], :label, false)
@@ -14,6 +15,10 @@ module IsoDoc
14
15
  l10n("#{@i18n.table.capitalize} #{n}"), "name")
15
16
  end
16
17
 
18
+ def table_delim
19
+ l10n("x.<tab/>").sub("x", "") # force French " .</tab>"
20
+ end
21
+
17
22
  def figure1(elem)
18
23
  if @jcgm
19
24
  @iso.xrefs = @xrefs
@@ -22,11 +27,15 @@ module IsoDoc
22
27
  end
23
28
  end
24
29
 
30
+ def note_delim(_elem)
31
+ l10n("x:<tab/>").sub("x", "") # force French " :</tab>"
32
+ end
33
+
25
34
  # notes and remarques (list notes) are not numbered
26
35
  def note1(elem)
27
36
  elem.parent.name == "bibitem" || elem["notag"] == "true" and return
28
37
  lbl = l10n(note_label(elem))
29
- prefix_name(elem, "", lbl, "name")
38
+ prefix_name(elem, { label: note_delim(elem) }, lbl, "name")
30
39
  end
31
40
 
32
41
  def note_label(elem)
@@ -33,7 +33,8 @@ module IsoDoc
33
33
  super
34
34
  end
35
35
 
36
- def annex1(elem)
36
+ # KILL
37
+ def annex1x(elem)
37
38
  @jcgm and return super
38
39
  elem["unnumbered"] == "true" and return
39
40
  lbl = @xrefs.anchor(elem["id"], :label)
@@ -42,6 +43,11 @@ module IsoDoc
42
43
  prefix_name(elem, ".<tab/>", lbl, "title")
43
44
  end
44
45
 
46
+ def annex_delim(elem)
47
+ @jcgm and return super
48
+ ".<tab/>"
49
+ end
50
+
45
51
  def clause(docxml)
46
52
  quotedtitles(docxml)
47
53
  super
@@ -57,7 +63,8 @@ module IsoDoc
57
63
  super
58
64
  end
59
65
 
60
- def prefix_name(node, delim, number, elem)
66
+ # KILL
67
+ def prefix_namex(node, delims, number, elem)
61
68
  number.nil? || number.empty? and return
62
69
  unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
63
70
  node.at(ns("./#{elem}[@type = 'quoted']")) and return
@@ -69,6 +76,17 @@ module IsoDoc
69
76
  end
70
77
  end
71
78
 
79
+ def prefix_name(node, delims, number, elem)
80
+ if n = node.at(ns("./#{elem}[@type = 'quoted']"))
81
+ n1 = n.dup
82
+ n1.name = "fmt-#{elem}"
83
+ n.next = n1
84
+ prefix_name_postprocess(node, elem)
85
+ else
86
+ super
87
+ end
88
+ end
89
+
72
90
  def conversions(docxml)
73
91
  doccontrol docxml
74
92
  super
@@ -59,6 +59,7 @@ module IsoDoc
59
59
  "./term[#{UNNUM}] | ./terms[#{UNNUM}] | " \
60
60
  "./definitions[#{UNNUM}]".freeze
61
61
 
62
+ # KILL
62
63
  def section_name_anchors(clause, num, lvl)
63
64
  lbl = @jcgm ? "clause_jcgm" : "clause"
64
65
  @anchors[clause["id"]] =
@@ -66,6 +67,17 @@ module IsoDoc
66
67
  level: lvl, type: "clause", elem: @labels[lbl] }
67
68
  end
68
69
 
70
+ def section_name_anchors(clause, num, level)
71
+ lbl = @jcgm ? "clause_jcgm" : "clause"
72
+ xref = labelled_autonum(@labels[lbl], num)
73
+ label = num
74
+ c = clause_title(clause) and title = semx(clause, c, "title")
75
+ @anchors[clause["id"]] =
76
+ { label:, xref:, title:, level:, type: "clause",
77
+ elem: @labels[lbl] }
78
+ end
79
+
80
+ # KILL
69
81
  def section_names(clause, num, lvl)
70
82
  clause.nil? and return num
71
83
  num.increment(clause)
@@ -80,9 +92,25 @@ module IsoDoc
80
92
  num
81
93
  end
82
94
 
95
+ def section_names(clause, num, lvl)
96
+ unnumbered_section_name?(clause) and return num
97
+ num.increment(clause)
98
+ lbl = semx(clause, num.print)
99
+ section_name_anchors(clause, lbl, lvl)
100
+ clause.xpath(ns(NUMBERED_SUBCLAUSES))
101
+ .each_with_object(clause_counter(0)) do |c, i|
102
+ section_names1(c, lbl, i.increment(c).print, lvl + 1)
103
+ end
104
+ clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
105
+ .each_with_object(clause_counter(0)) do |c, i|
106
+ unnumbered_section_names1(c, lvl + 1)
107
+ end
108
+ num
109
+ end
110
+
83
111
  def unnumbered_section_names(clause, lvl)
84
- clause.nil? and return num
85
112
  lbl = clause.at(ns("./title"))&.text || "[#{clause['id']}]"
113
+ lbl = semx(clause, lbl, "title")
86
114
  @anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
87
115
  level: lvl, type: "clause" }
88
116
  clause.xpath(ns(SUBCLAUSES)).each do |c|
@@ -91,17 +119,20 @@ module IsoDoc
91
119
  end
92
120
 
93
121
  def section_name1_anchors(clause, num, level)
94
- lbl = @jcgm ? "" : "#{@labels['subclause']} "
122
+ lbl = @jcgm ? "" : @labels['subclause']
123
+ xref = labelled_autonum(@labels[lbl], num)
124
+ label = num
95
125
  @anchors[clause["id"]] =
96
- { label: num, level: level, xref: l10n("#{lbl}#{num}"),
126
+ { label: num, level: level, xref: labelled_autonum(lbl, num), # l10n("#{lbl}#{num}"),
97
127
  type: "clause", elem: lbl }
98
128
  end
99
129
 
100
- def section_names1(clause, num, level)
101
- @anchors[clause["id"]] = section_name1_anchors(clause, num, level)
102
- i = Counter.new(0, prefix: num)
130
+ def section_names1(clause, parentnum, num, level)
131
+ lbl = clause_number_semx(parentnum, clause, num)
132
+ @anchors[clause["id"]] = section_name1_anchors(clause, lbl, level)
133
+ i = Counter.new(0)
103
134
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
104
- section_names1(c, i.increment(c).print, level + 1)
135
+ section_names1(c, lbl, i.increment(c).print, level + 1)
105
136
  end
106
137
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
107
138
  unnumbered_section_names1(c, lvl + 1)
@@ -110,8 +141,9 @@ module IsoDoc
110
141
 
111
142
  def unnumbered_section_names1(clause, level)
112
143
  lbl = clause.at(ns("./title"))&.text || "[#{clause['id']}]"
144
+ lbl = semx(clause, lbl, "title")
113
145
  @anchors[clause["id"]] =
114
- { label: lbl, xref: l10n(%{"#{lbl}"}), level: level, type: "clause" }
146
+ { label: lbl, xref: %{"#{lbl}"}, level: level, type: "clause" }
115
147
  clause.xpath(ns(SUBCLAUSES)).each do |c|
116
148
  unnumbered_section_names1(c, level + 1)
117
149
  end
@@ -137,33 +169,37 @@ module IsoDoc
137
169
 
138
170
  def annex_name_anchors(clause, num)
139
171
  { label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
140
- xref: l10n("#{@annexlbl} #{num}"), level: 1, elem: @annexlbl }
172
+ xref: labelled_autonum(@annexlbl, num), # #l10n("#{@annexlbl} #{num}"),
173
+ level: 1, elem: @annexlbl }
141
174
  end
142
175
 
143
176
  def annex_names(clause, num)
144
- @anchors[clause["id"]] = annex_name_anchors(clause, num)
177
+ lbl = semx(clause, num)
178
+ prefix = @jcgm ? "" : "A"
179
+ lbl1 = semx(clause, "#{prefix}#{num}")
180
+ @anchors[clause["id"]] = annex_name_anchors(clause, lbl)
145
181
  if @klass.single_term_clause?(clause)
146
182
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
147
- num.to_s, 1)
183
+ lbl, 1)
148
184
  else
149
- prefix = @jcgm ? "" : "A"
150
- i = Counter.new(0, prefix: "#{prefix}#{num}")
185
+ i = Counter.new(0)
151
186
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
152
- annex_names1(c, i.increment(c).print, 2)
187
+ annex_names1(c, lbl1, i.increment(c).print, 2)
153
188
  end
154
189
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
155
190
  .each { |c| unnumbered_annex_names1(c, 2) }
156
191
  end
157
- hierarchical_asset_names(clause, num)
192
+ hierarchical_asset_names(clause, "#{prefix}#{num}")
158
193
  end
159
194
 
160
195
  def unnumbered_annex_anchors(lbl)
161
196
  { label: lbl, type: "clause", value: "",
162
- xref: l10n(%{"#{lbl}"}), level: 1 }
197
+ xref: (%{"#{lbl}"}), level: 1 }
163
198
  end
164
199
 
165
200
  def unnumbered_annex_names(clause)
166
201
  lbl = clause.at(ns("./title"))&.text || "[#{clause['id']}]"
202
+ lbl = semx(clause, lbl, "title")
167
203
  @anchors[clause["id"]] = unnumbered_annex_anchors(lbl)
168
204
  if @klass.single_term_clause?(clause)
169
205
  annex_names1(clause.at(ns("./references | ./terms | ./definitions")),
@@ -175,17 +211,19 @@ module IsoDoc
175
211
  hierarchical_asset_names(clause, lbl)
176
212
  end
177
213
 
178
- def annex_names1_anchors(num, level)
179
- lbl = @jcgm ? "" : "#{@annexlbl} "
180
- { label: num, xref: l10n("#{lbl}#{num}"),
214
+ def annex_name_anchors1(clause, num, level)
215
+ lbl = @jcgm ? "" : @annexlbl
216
+ @anchors[clause["id"]] =
217
+ { label: num, xref: labelled_autonum(lbl, num), #l10n("#{lbl}#{num}"),
181
218
  level: level, type: "clause", elem: lbl }
182
219
  end
183
220
 
184
- def annex_names1(clause, num, level)
185
- @anchors[clause["id"]] = annex_names1_anchors(num, level)
186
- i = Counter.new(0, prefix: num)
221
+ def annex_names1(clause, parentnum, num, level)
222
+ lbl = clause_number_semx(parentnum, clause, num)
223
+ annex_name_anchors1(clause, lbl, level)
224
+ i = Counter.new(0)
187
225
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
188
- annex_names1(c, i.increment(c).print, level + 1)
226
+ annex_names1(c, lbl, i.increment(c).print, level + 1)
189
227
  end
190
228
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
191
229
  .each { |c| unnumbered_annex_names1(c, level + 1) }
@@ -193,6 +231,7 @@ module IsoDoc
193
231
 
194
232
  def unnumbered_annex_names1(clause, level)
195
233
  lbl = clause&.at(ns("./title"))&.text || "[#{clause['id']}]"
234
+ lbl = semx(clause, lbl, "title")
196
235
  @anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
197
236
  level: level, type: "clause" }
198
237
  clause.xpath(ns(SUBCLAUSES))
@@ -200,16 +239,16 @@ module IsoDoc
200
239
  end
201
240
 
202
241
  def annex_name_lbl(_clause, num)
203
- l10n("<strong>#{@annexlbl} #{num}</strong>")
242
+ l10n("<strong>#{labelled_autonum(@annexlbl, num)}</strong>")
204
243
  end
205
244
 
206
245
  def sequential_formula_names(clause, container: false)
207
246
  c = Counter.new
208
247
  clause.xpath(ns(".//formula")).noblank.each do |t|
209
248
  @anchors[t["id"]] = anchor_struct(
210
- c.increment(t).print, container ? t : nil,
249
+ semx(t, c.increment(t).print), t,
211
250
  t["inequality"] ? @labels["inequality"] : @labels["formula"],
212
- "formula", t["unnumbered"]
251
+ "formula", { unnumb: t["unnumbered"], container: }
213
252
  )
214
253
  end
215
254
  end
@@ -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.4.0 -->
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">
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Bipm
3
- VERSION = "2.5.6".freeze
3
+ VERSION = "2.5.8".freeze
4
4
  end
5
5
  end
@@ -25,7 +25,7 @@ template:
25
25
  # TODO: omitted: author ids, additional info for component part, subsidiary titles of host resource, rights metadata, distributor, relationships
26
26
  journal: "<em>{{ title}}</em> [{{medium}}] . ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). ({{date}}). {{size}}. {{extent}}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
27
27
  # TODO subsidiary titles, rights metadata, item attributes, relationships
28
- article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ series }}. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
28
+ article: "{{ creatornames }} ({{role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} {{ series }}. [{{medium}}] {{draft}} . {{size}}. {{ extent }}. {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{ labels['at'] | capitalize}}:_{{ access_location }}. [{{ labels['viewed'] }}:_{{date_accessed}}]."
29
29
  # TODO: omitted: author ids, subsidiary titles, rights metadata, distributor, item attributes, relationships; newspapers
30
30
  software: "{{ creatornames }} ({{ role | capitalize}}) ({{date}} ({{ labels['updated'] }}_{{date_updated}}) {% if date %}){% endif %} <em>{{ title }}</em> . {{ labels['version'] | capitalize }}_{{ edition_raw }} {{draft}} . [{{medium | capitalize}}]. ({% if place %}{{place}}{%else%}{{ labels['no_place']}}{%endif%}:_{{publisher}}). {{ authoritative_identifier | join: '. ' }}. {{ uri }}. {{size}}. {{ extent}}. [{{ labels['viewed'] }}:_{{date_accessed}}]. "
31
31
  # TODO: omitted: author ids, subsidiary titles, subsidiary creators, copyright, license, distributor, system requirements, relationships
@@ -1,4 +1,5 @@
1
1
  require "relaton-render"
2
+ require_relative "parse"
2
3
 
3
4
  module Relaton
4
5
  module Render
@@ -16,7 +17,7 @@ module Relaton
16
17
  @sizetemplateklass = Relaton::Render::Template::Size
17
18
  @generaltemplateklass = Relaton::Render::Template::General
18
19
  @fieldsklass = Relaton::Render::Fields
19
- @parseklass = Relaton::Render::Parse
20
+ @parseklass = Relaton::Render::Bipm::Parse
20
21
  end
21
22
  end
22
23
  end
@@ -14,6 +14,14 @@ module Relaton
14
14
  .include?(r[:nonpersonal])
15
15
  end
16
16
  end
17
+
18
+ def authoritative_identifier(doc)
19
+ if %w(article journal book).include?(doc.type)
20
+ [] # we don't want BIPM identifiers for these!
21
+ else
22
+ super
23
+ end
24
+ end
17
25
  end
18
26
  end
19
27
  end
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
  spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
29
29
 
30
- spec.add_dependency "metanorma-generic", "~> 2.7.2"
31
- spec.add_dependency "metanorma-iso", "~> 2.9.0"
30
+ spec.add_dependency "metanorma-generic", "~> 2.7.4"
31
+ spec.add_dependency "metanorma-iso", "~> 2.9.2"
32
32
 
33
33
  spec.add_development_dependency "debug"
34
34
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
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: exe
10
10
  cert_chain: []
11
- date: 2024-11-11 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.2
19
+ version: 2.7.4
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.7.2
26
+ version: 2.7.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-iso
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.9.0
33
+ version: 2.9.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.9.0
40
+ version: 2.9.2
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement