metanorma-bipm 0.0.4 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,7 +29,7 @@ module IsoDoc
29
29
  ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
30
30
  set(:docsubtitle, @c.encode(isoxml&.at(
31
31
  ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
32
- %w(appendix part subtitle).each do |e|
32
+ %w(appendix annex part subtitle).each do |e|
33
33
  set("#{e}title".to_sym, @c.encode(isoxml&.at(
34
34
  ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
35
35
  set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
@@ -51,6 +51,10 @@ module IsoDoc
51
51
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
52
52
  dn and set(:appendixid, @i18n.l10n("#{label1} #{dn&.text}"))
53
53
  dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
54
+ label1, label2 = @lang == "fr" ? %w(Appendice Annex) : %w(Annex Appendice)
55
+ dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
56
+ dn and set(:annexid, @i18n.l10n("#{label1} #{dn&.text}"))
57
+ dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
54
58
  label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
55
59
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
56
60
  dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
@@ -10,7 +10,12 @@ module IsoDoc
10
10
  super
11
11
  end
12
12
 
13
+ def configuration
14
+ Metanorma::BIPM.configuration
15
+ end
16
+
13
17
  def pdf_stylesheet(docxml)
18
+ return "jcgm.standard.xsl" if docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))&.value == "JCGM"
14
19
  doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
15
20
  doctype = "brochure" unless %w(guide mise-en-pratique rapport).
16
21
  include? doctype
@@ -18,7 +23,11 @@ module IsoDoc
18
23
  end
19
24
 
20
25
  def pdf_options(docxml)
21
- if docxml.root.name == "metanorma-collection"
26
+ if docxml.root.name == "metanorma-collection" &&
27
+ docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'fr']",
28
+ "m" => configuration.document_namespace) &&
29
+ docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'en']",
30
+ "m" => configuration.document_namespace)
22
31
  "--split-by-language"
23
32
  else
24
33
  super
@@ -1,6 +1,7 @@
1
1
  require "isodoc"
2
2
  require "metanorma-generic"
3
3
  require_relative "init"
4
+ require_relative "index"
4
5
 
5
6
  module IsoDoc
6
7
  module BIPM
@@ -108,10 +109,12 @@ module IsoDoc
108
109
  ret
109
110
  end
110
111
 
111
- def twitter_cldr_localiser()
112
- locale = :fr
113
- twitter_cldr_reader(locale)
114
- locale
112
+ def twitter_cldr_localiser_symbols
113
+ { group: " ", fraction_group: " ", fraction_group_digits: 3 }
114
+ end
115
+
116
+ def mathml1(f, locale)
117
+ localize_maths(f, locale)
115
118
  end
116
119
 
117
120
  include Init
@@ -1,17 +1,20 @@
1
1
  module IsoDoc
2
2
  module BIPM
3
+ class Counter < IsoDoc::XrefGen::Counter
4
+ end
5
+
3
6
  class Xref < IsoDoc::Xref
4
7
  def initialize(lang, script, klass, i18n, options = {})
5
8
  super
6
9
  end
7
10
 
8
11
  def clause_names(docxml, sect_num)
9
- sect_num = 0
12
+ n = Counter.new
10
13
  docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')] | "\
11
14
  "//sections/terms[not(@unnumbered = 'true')] | "\
12
15
  "//sections/definitions[not(@unnumbered = 'true')]")).
13
- each_with_index do |c, i|
14
- section_names(c, (i + sect_num), 1)
16
+ each do |c|
17
+ section_names(c, n, 1)
15
18
  end
16
19
  docxml.xpath(ns("//sections/clause[@unnumbered = 'true'] | "\
17
20
  "//sections/terms[@unnumbered = 'true'] | "\
@@ -35,12 +38,14 @@ module IsoDoc
35
38
 
36
39
  def section_names(clause, num, lvl)
37
40
  return num if clause.nil?
38
- num = num + 1
41
+ num.increment(clause)
39
42
  @anchors[clause["id"]] =
40
- { label: num.to_s, xref: l10n("#{@labels["clause"]} #{num}"),
43
+ { label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"),
41
44
  level: lvl, type: "clause" }
42
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
43
- section_names1(c, "#{num}.#{i + 1}", lvl + 1)
45
+ i = Counter.new
46
+ clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
47
+ i.increment(c)
48
+ section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
44
49
  end
45
50
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
46
51
  unnumbered_section_names1(c, lvl + 1)
@@ -62,8 +67,10 @@ module IsoDoc
62
67
  @anchors[clause["id"]] =
63
68
  { label: num, level: level, xref: l10n("#{@labels["subclause"]} #{num}"),
64
69
  type: "clause" }
65
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
66
- section_names1(c, "#{num}.#{i + 1}", level + 1)
70
+ i = Counter.new
71
+ clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
72
+ i.increment(c)
73
+ section_names1(c, "#{num}.#{i.print}", level + 1)
67
74
  end
68
75
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
69
76
  unnumbered_section_names1(c, lvl + 1)
@@ -81,6 +88,8 @@ module IsoDoc
81
88
 
82
89
  def back_anchor_names(docxml)
83
90
  super
91
+ @annexlbl = docxml.at(ns("//bibdata/ext/structuredidentifier/appendix")) ?
92
+ @labels["appendix"] : @labels["annex"]
84
93
  docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).
85
94
  each_with_index { |c, i| annex_names(c, (i+1).to_s) }
86
95
  docxml.xpath(ns("//annex[@unnumbered = 'true']")).
@@ -90,12 +99,14 @@ module IsoDoc
90
99
  def annex_names(clause, num)
91
100
  @anchors[clause["id"]] =
92
101
  { label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
93
- xref: l10n("#{@labels["annex"]} #{num}"), level: 1 }
102
+ xref: l10n("#{@annexlbl} #{num}"), level: 1 }
94
103
  if a = single_annex_special_section(clause)
95
104
  annex_names1(a, "#{num}", 1)
96
105
  else
97
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
98
- annex_names1(c, "#{num}.#{i + 1}", 2)
106
+ i = Counter.new
107
+ clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
108
+ i.increment(c)
109
+ annex_names1(c, "#{num}.#{i.print}", 2)
99
110
  end
100
111
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
101
112
  unnumbered_annex_names1(c, 2)
@@ -121,10 +132,12 @@ module IsoDoc
121
132
 
122
133
  def annex_names1(clause, num, level)
123
134
  @anchors[clause["id"]] =
124
- { label: num, xref: l10n("#{@labels["annex"]} #{num}"),
135
+ { label: num, xref: l10n("#{@annexlbl} #{num}"),
125
136
  level: level, type: "clause" }
126
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
127
- annex_names1(c, "#{num}.#{i + 1}", level + 1)
137
+ i = Counter.new
138
+ clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
139
+ i.increment(c)
140
+ annex_names1(c, "#{num}.#{i.print}", level + 1)
128
141
  end
129
142
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
130
143
  unnumbered_annex_names1(c, level + 1)
@@ -142,7 +155,7 @@ module IsoDoc
142
155
  end
143
156
 
144
157
  def annex_name_lbl(clause, num)
145
- l10n("<strong>#{@labels["annex"]} #{num}</strong>")
158
+ l10n("<strong>#{@annexlbl} #{num}</strong>")
146
159
  end
147
160
  end
148
161
  end
@@ -4,6 +4,13 @@ require "metanorma/bipm/processor"
4
4
 
5
5
  module Metanorma
6
6
  module BIPM
7
+ def self.fonts_used
8
+ {
9
+ html: ["Times New Roman", "STIX", "Courier New"],
10
+ pdf: ["Arial", "Times New Roman", "Work Sans", "STIX"]
11
+ }
12
+ end
13
+
7
14
  class Configuration < Metanorma::Generic::Configuration
8
15
  def initialize(*args)
9
16
  super
@@ -14,6 +14,17 @@ module Metanorma
14
14
  ).tap { |hs| hs.delete(:doc) }
15
15
  end
16
16
 
17
+ def fonts_manifest
18
+ {
19
+ "Arial" => nil,
20
+ "Times New Roman" => nil,
21
+ "Work Sans" => nil,
22
+ "STIX Two Math" => nil,
23
+ "Source Han Sans" => nil,
24
+ "TeX Gyre Chorus" => nil,
25
+ }
26
+ end
27
+
17
28
  def version
18
29
  "Metanorma::BIPM #{Metanorma::BIPM::VERSION}"
19
30
  end
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "0.0.4"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -26,8 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
28
28
 
29
- spec.add_dependency "metanorma-generic", "~> 1.7.0"
30
- spec.add_dependency "isodoc", "~> 1.2.0"
29
+ spec.add_dependency "metanorma-generic", "~> 1.9.0"
31
30
 
32
31
  spec.add_development_dependency "byebug", "~> 9.1"
33
32
  spec.add_development_dependency "sassc", "2.4.0"
@@ -1,10 +1,14 @@
1
1
  metanorma_name: bipm
2
2
  organization_name_short: BIPM
3
- organization_name_long: Bureau International des poids et mesures
3
+ organization_name_long:
4
+ fr: Bureau international des poids et mesures
5
+ en: Bureau International des Poids et Mesures
4
6
  document_namespace: https://www.metanorma.org/ns/bipm
5
7
  xml_root_tag: 'bipm-standard'
6
8
  html_bodyfont: Times New Roman
7
9
  html_headerfont: Times New Roman
10
+ html_normalfontsize: "15px"
11
+ html_footnotefontsize: "0.9em"
8
12
  logo_path: lib/isodoc/bipm/html/logo.png
9
13
  i18nyaml:
10
14
  en: lib/isodoc/bipm/i18n-en.yaml
@@ -79,8 +83,8 @@ committees:
79
83
  - CCU
80
84
  - Consultative Committee for Units
81
85
  - Comité consultatif des unités
82
- - CCL-CCT
83
- - Frequency Standards Working Group
86
+ - CCL-CCTF-WGFS
87
+ - CCL-CCTF Frequency Standards Working Group
84
88
  - JCGM
85
89
  - Joint Committee for Guides in Metrology
86
90
  - Comité commun pour les guides en métrologie
@@ -106,6 +110,8 @@ metadata_extensions:
106
110
  _output: part
107
111
  appendix-id:
108
112
  _output: appendix
113
+ annex-id:
114
+ _output: annexid
109
115
  relations:
110
116
  - supersedes
111
117
  - superseded-by
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: 0.0.4
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-09 00:00:00.000000000 Z
11
+ date: 2021-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,28 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.0
19
+ version: 1.9.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: 1.7.0
27
- - !ruby/object:Gem::Dependency
28
- name: isodoc
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 1.2.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.2.0
26
+ version: 1.9.0
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: byebug
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -203,6 +189,7 @@ files:
203
189
  - lib/asciidoctor/bipm/bipm.rng
204
190
  - lib/asciidoctor/bipm/boilerplate-en.xml
205
191
  - lib/asciidoctor/bipm/boilerplate-fr.xml
192
+ - lib/asciidoctor/bipm/boilerplate-jcgm-en.xml
206
193
  - lib/asciidoctor/bipm/converter.rb
207
194
  - lib/asciidoctor/bipm/isodoc.rng
208
195
  - lib/asciidoctor/bipm/reqt.rng
@@ -235,7 +222,9 @@ files:
235
222
  - lib/isodoc/bipm/i18n-en.yaml
236
223
  - lib/isodoc/bipm/i18n-fr.yaml
237
224
  - lib/isodoc/bipm/i18n.rb
225
+ - lib/isodoc/bipm/index.rb
238
226
  - lib/isodoc/bipm/init.rb
227
+ - lib/isodoc/bipm/jcgm.standard.xsl
239
228
  - lib/isodoc/bipm/metadata.rb
240
229
  - lib/isodoc/bipm/pdf_convert.rb
241
230
  - lib/isodoc/bipm/presentation_xml_convert.rb