metanorma-bipm 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require "isodoc"
2
2
  require "metanorma-generic"
3
+ require "metanorma-iso"
3
4
  require_relative "init"
4
5
  require_relative "index"
5
6
 
@@ -9,14 +10,26 @@ module IsoDoc
9
10
  def convert1(docxml, filename, dir)
10
11
  @jcgm = docxml&.at(ns("//bibdata/ext/editorialgroup/committee/"\
11
12
  "@acronym"))&.value == "JCGM"
13
+ @iso = IsoDoc::Iso::PresentationXMLConvert
14
+ .new({ language: @lang, script: @script })
15
+ i18n = @iso.i18n_init(@lang, @script, nil)
16
+ @iso.metadata_init(@lang, @script, i18n)
12
17
  super
13
18
  end
14
19
 
20
+ def eref_localities1(target, type, from, to, delim, n, lang = "en")
21
+ if @jcgm
22
+ @iso.eref_localities1(target, type, from, to, delim, n, lang)
23
+ else
24
+ super
25
+ end
26
+ end
27
+
15
28
  def table1(f)
16
29
  return if labelled_ancestor(f)
17
30
  return if f["unnumbered"]
18
31
 
19
- n = @xrefs.anchor(f['id'], :label, false)
32
+ n = @xrefs.anchor(f["id"], :label, false)
20
33
  prefix_name(f, ".<tab/>", l10n("#{@i18n.table.capitalize} #{n}"), "name")
21
34
  end
22
35
 
@@ -51,7 +64,7 @@ module IsoDoc
51
64
  <title>Document Control</title>
52
65
  <table unnumbered="true"><tbody>
53
66
  <tr><th>Authors:</th><td/><td>#{list_authors(docxml)}</td></tr>
54
- #{doccontrol_row1(docxml)} #{doccontrol_row2(docxml)} #{list_drafts(docxml)}
67
+ #{doccontrol_row1(docxml)} #{doccontrol_row2(docxml)} #{list_drafts(docxml)}
55
68
  </tbody></table></doccontrol>
56
69
  END
57
70
  docxml.root << clause
@@ -61,8 +74,8 @@ module IsoDoc
61
74
  return "" if list_draft(docxml, 1) == ["", ""] && list_cochairs(docxml).empty?
62
75
 
63
76
  <<~ROW
64
- <tr>#{list_draft(docxml, 1)&.map { |x| "<td>#{x}</td>" }&.join }
65
- <td>#{list_cochairs(docxml)}</td></tr>
77
+ <tr>#{list_draft(docxml, 1)&.map { |x| "<td>#{x}</td>" }&.join}
78
+ <td>#{list_cochairs(docxml)}</td></tr>
66
79
  ROW
67
80
  end
68
81
 
@@ -70,8 +83,8 @@ module IsoDoc
70
83
  return "" if list_draft(docxml, 2) == ["", ""] && list_chairs(docxml).empty?
71
84
 
72
85
  <<~ROW
73
- <tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join }
74
- <td>#{list_chairs(docxml)}</td></tr>
86
+ <tr>#{list_draft(docxml, 2)&.map { |x| "<td>#{x}</td>" }&.join}
87
+ <td>#{list_chairs(docxml)}</td></tr>
75
88
  ROW
76
89
  end
77
90
 
@@ -100,7 +113,8 @@ module IsoDoc
100
113
 
101
114
  def list_authors(xml)
102
115
  ret = list_people(
103
- xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person")
116
+ xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person"
117
+ )
104
118
  @i18n.multiple_and(ret, @i18n.get["and"])
105
119
  end
106
120
 
@@ -20,6 +20,19 @@ module IsoDoc
20
20
  super
21
21
  end
22
22
 
23
+ def wrap_brackets(txt)
24
+ return txt if /^\[.*\]$/.match?(txt)
25
+
26
+ "[#{txt}]"
27
+ end
28
+
29
+ def reference_names(ref)
30
+ super
31
+ if @jcgm
32
+ @anchors[ref["id"]][:xref] = wrap_brackets(@anchors[ref["id"]][:xref])
33
+ end
34
+ end
35
+
23
36
  def clause_names(docxml, sect_num)
24
37
  if @jcgm
25
38
  clause_names_jcgm(docxml, sect_num)
@@ -124,7 +137,7 @@ module IsoDoc
124
137
 
125
138
  def back_anchor_names(docxml)
126
139
  super
127
- i = @jcgm ? Counter.new("@") : Counter.new(0)
140
+ i = @jcgm ? Counter.new("@", skip_i: true) : Counter.new(0)
128
141
  docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).each do |c|
129
142
  i.increment(c)
130
143
  annex_names(c, i.print)
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "1.1.0".freeze
3
+ VERSION = "1.1.1".freeze
4
4
  end
5
5
  end
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
29
  spec.add_dependency "metanorma-generic", "~> 1.10.0"
30
+ spec.add_dependency "metanorma-iso", "~> 1.8.0"
30
31
 
31
32
  spec.add_development_dependency "byebug", "~> 9.1"
32
33
  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: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-12 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.10.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: metanorma-iso
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.8.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.8.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: byebug
29
43
  requirement: !ruby/object:Gem::Requirement