metanorma-bipm 2.5.4 → 2.5.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,82 @@
1
+ module IsoDoc
2
+ module Bipm
3
+ class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
4
+ def bibdata_i18n(bibdata)
5
+ super
6
+ bibdata_dates(bibdata)
7
+ bibdata_titles(bibdata)
8
+ end
9
+
10
+ def bibdata_dates(bibdata)
11
+ pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
12
+ pubdate or return
13
+ meta = metadata_init(@lang, @script, @locale, @i18n)
14
+ pubdate.next = pubdate.dup
15
+ pubdate.next["format"] = "ddMMMyyyy"
16
+ pubdate.next.children = meta.monthyr(pubdate.text)
17
+ end
18
+
19
+ def bibdata_titles(bibdata)
20
+ app = bibdata.at(ns("//bibdata/ext/" \
21
+ "structuredidentifier/part")) or return
22
+ bibdata.xpath(ns("//bibdata/title[@type = 'title-part']")).each do |t|
23
+ t.previous = t.dup
24
+ t["type"] = "title-part-with-numbering"
25
+ part = t["language"] == "en" ? "Part" : "Partie" # not looking up in YAML
26
+ t.children = l10n("#{part} #{app.text}: #{to_xml(t.children)}",
27
+ t["language"])
28
+ end
29
+ end
30
+
31
+ def norm_ref_entry_code(_ordinal, identifiers, _ids, _standard, datefn,
32
+ _bib)
33
+ ret = identifiers[0] || identifiers[1]
34
+ ret += " #{identifiers[1]}" if identifiers[0] && identifiers[1]
35
+ "#{ret}#{datefn} "
36
+ end
37
+
38
+ def biblio_ref_entry_code(ordinal, ids, _id, _standard, datefn, _bib)
39
+ # standard and id = nil
40
+ ret = ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]"
41
+ if ids[:sdo]
42
+ ret = prefix_bracketed_ref(ret)
43
+ ret += "#{ids[:sdo]}#{datefn} "
44
+ else
45
+ ret = prefix_bracketed_ref("#{ret}#{datefn}")
46
+ end
47
+ ret
48
+ end
49
+
50
+ def implicit_reference(bib)
51
+ b = bib.at(ns("./docidentifier[@primary = 'true'][@type = 'BIPM']"))
52
+ return true if @doctype == "brochure" && /^(CGPM|CIPM|CCDS|CCTF)[  ]
53
+ (Resolution|Recommendation|Declaration|Decision|Recommendation|Meeting)/x
54
+ .match?(b&.text)
55
+
56
+ super
57
+ end
58
+
59
+ def omit_docid_prefix(prefix)
60
+ %w(BIPM BIPM-long).include? prefix and return true
61
+ super
62
+ end
63
+
64
+ def render_identifier(ident)
65
+ ret = super
66
+ ret[:sdo] = ret[:sdo]&.sub(/^(BIPM)([  ])(PV|CR)([  ])(\d.*)$/,
67
+ "\\1\\2<strong>\\3</strong>,\\4\\5")
68
+ ret
69
+ end
70
+
71
+ def wrap_brackets(txt)
72
+ /^\[.*\]$/.match?(txt) ? txt : "[#{txt}]"
73
+ end
74
+
75
+ def reference_name(ref)
76
+ super
77
+ @jcgm and
78
+ @xrefs.get[ref["id"]][:xref] = wrap_brackets(@xrefs.get[ref["id"]][:xref])
79
+ end
80
+ end
81
+ end
82
+ end
@@ -7,6 +7,7 @@ module IsoDoc
7
7
  end
8
8
 
9
9
  def table1(elem)
10
+ table_fn(elem)
10
11
  labelled_ancestor(elem) || elem["unnumbered"] and return
11
12
  n = @xrefs.anchor(elem["id"], :label, false)
12
13
  prefix_name(elem, ".<tab/>",
@@ -6,6 +6,7 @@ require_relative "index"
6
6
  require_relative "doccontrol"
7
7
  require_relative "../../relaton/render/general"
8
8
  require_relative "presentation_blocks"
9
+ require_relative "presentation_biblio"
9
10
 
10
11
  module IsoDoc
11
12
  module Bipm
@@ -60,8 +61,7 @@ module IsoDoc
60
61
  number.nil? || number.empty? and return
61
62
  unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
62
63
  node.at(ns("./#{elem}[@type = 'quoted']")) and return
63
- (node.children.empty? and node.add_child("<#{elem}></#{elem}>")) or
64
- node.children.first.previous = "<#{elem}></#{elem}>"
64
+ node.add_first_child "<#{elem}></#{elem}>"
65
65
  name = node.children.first
66
66
  end
67
67
  if name.children.empty? then name.add_child(cleanup_entities(number))
@@ -103,33 +103,6 @@ module IsoDoc
103
103
  super
104
104
  end
105
105
 
106
- def bibdata_i18n(bibdata)
107
- super
108
- bibdata_dates(bibdata)
109
- bibdata_titles(bibdata)
110
- end
111
-
112
- def bibdata_dates(bibdata)
113
- pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
114
- pubdate or return
115
- meta = metadata_init(@lang, @script, @locale, @i18n)
116
- pubdate.next = pubdate.dup
117
- pubdate.next["format"] = "ddMMMyyyy"
118
- pubdate.next.children = meta.monthyr(pubdate.text)
119
- end
120
-
121
- def bibdata_titles(bibdata)
122
- app = bibdata.at(ns("//bibdata/ext/" \
123
- "structuredidentifier/part")) or return
124
- bibdata.xpath(ns("//bibdata/title[@type = 'title-part']")).each do |t|
125
- t.previous = t.dup
126
- t["type"] = "title-part-with-numbering"
127
- part = t["language"] == "en" ? "Part" : "Partie" # not looking up in YAML
128
- t.children = l10n("#{part} #{app.text}: #{to_xml(t.children)}",
129
- t["language"])
130
- end
131
- end
132
-
133
106
  def eref(docxml)
134
107
  super
135
108
  jcgm_eref(docxml, "//eref")
@@ -142,7 +115,7 @@ module IsoDoc
142
115
 
143
116
  def quotesource(docxml)
144
117
  super
145
- jcgm_eref(docxml, "//quote/source")
118
+ jcgm_eref(docxml, "//quote//source")
146
119
  end
147
120
 
148
121
  def jcgm_eref(docxml, xpath)
@@ -213,25 +186,6 @@ module IsoDoc
213
186
  termsource_add_modification_text(elem.at(ns("./modification")))
214
187
  end
215
188
 
216
- def norm_ref_entry_code(_ordinal, identifiers, _ids, _standard, datefn,
217
- _bib)
218
- ret = identifiers[0] || identifiers[1]
219
- ret += " #{identifiers[1]}" if identifiers[0] && identifiers[1]
220
- "#{ret}#{datefn} "
221
- end
222
-
223
- def biblio_ref_entry_code(ordinal, ids, _id, _standard, datefn, _bib)
224
- # standard and id = nil
225
- ret = ids[:ordinal] || ids[:metanorma] || "[#{ordinal}]"
226
- if ids[:sdo]
227
- ret = prefix_bracketed_ref(ret)
228
- ret += "#{ids[:sdo]}#{datefn} "
229
- else
230
- ret = prefix_bracketed_ref("#{ret}#{datefn}")
231
- end
232
- ret
233
- end
234
-
235
189
  include Init
236
190
  end
237
191
  end
@@ -23,16 +23,6 @@ module IsoDoc
23
23
  super
24
24
  end
25
25
 
26
- def wrap_brackets(txt)
27
- /^\[.*\]$/.match?(txt) ? txt : "[#{txt}]"
28
- end
29
-
30
- def reference_names(ref)
31
- super
32
- @jcgm and
33
- @anchors[ref["id"]][:xref] = wrap_brackets(@anchors[ref["id"]][:xref])
34
- end
35
-
36
26
  UNNUM = "@unnumbered = 'true'".freeze
37
27
 
38
28
  def clause_order_main(docxml)
@@ -80,7 +70,7 @@ module IsoDoc
80
70
  clause.nil? and return num
81
71
  num.increment(clause)
82
72
  @anchors[clause["id"]] = section_name_anchors(clause, num, lvl)
83
- i = Counter.new(0, prefix: "#{num.print}.")
73
+ i = Counter.new(0, prefix: num.print)
84
74
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
85
75
  section_names1(c, i.increment(c).print, lvl + 1)
86
76
  end
@@ -109,7 +99,7 @@ module IsoDoc
109
99
 
110
100
  def section_names1(clause, num, level)
111
101
  @anchors[clause["id"]] = section_name1_anchors(clause, num, level)
112
- i = Counter.new(0, prefix: "#{num}.")
102
+ i = Counter.new(0, prefix: num)
113
103
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
114
104
  section_names1(c, i.increment(c).print, level + 1)
115
105
  end
@@ -157,7 +147,7 @@ module IsoDoc
157
147
  num.to_s, 1)
158
148
  else
159
149
  prefix = @jcgm ? "" : "A"
160
- i = Counter.new(0, prefix: "#{prefix}#{num}.")
150
+ i = Counter.new(0, prefix: "#{prefix}#{num}")
161
151
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
162
152
  annex_names1(c, i.increment(c).print, 2)
163
153
  end
@@ -193,7 +183,7 @@ module IsoDoc
193
183
 
194
184
  def annex_names1(clause, num, level)
195
185
  @anchors[clause["id"]] = annex_names1_anchors(num, level)
196
- i = Counter.new(0, prefix: "#{num}.")
186
+ i = Counter.new(0, prefix: num)
197
187
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
198
188
  annex_names1(c, i.increment(c).print, level + 1)
199
189
  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">
@@ -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">
@@ -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>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module Bipm
3
- VERSION = "2.5.4".freeze
3
+ VERSION = "2.5.6".freeze
4
4
  end
5
5
  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.0"
31
- spec.add_dependency "metanorma-iso", "~> 2.8.0"
30
+ spec.add_dependency "metanorma-generic", "~> 2.7.2"
31
+ spec.add_dependency "metanorma-iso", "~> 2.9.0"
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.4
4
+ version: 2.5.6
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-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-generic
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.7.0
19
+ version: 2.7.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: 2.7.0
26
+ version: 2.7.2
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.8.0
33
+ version: 2.9.0
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.8.0
40
+ version: 2.9.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -271,6 +271,7 @@ files:
271
271
  - lib/isodoc/bipm/jcgm.standard.xsl
272
272
  - lib/isodoc/bipm/metadata.rb
273
273
  - lib/isodoc/bipm/pdf_convert.rb
274
+ - lib/isodoc/bipm/presentation_biblio.rb
274
275
  - lib/isodoc/bipm/presentation_blocks.rb
275
276
  - lib/isodoc/bipm/presentation_xml_convert.rb
276
277
  - lib/isodoc/bipm/xref.rb