metanorma-bipm 0.0.5 → 1.0.4

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
@@ -112,6 +113,10 @@ module IsoDoc
112
113
  { group: " ", fraction_group: " ", fraction_group_digits: 3 }
113
114
  end
114
115
 
116
+ def mathml1(f, locale)
117
+ localize_maths(f, locale)
118
+ end
119
+
115
120
  include Init
116
121
  end
117
122
  end
@@ -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)
@@ -96,8 +103,10 @@ module IsoDoc
96
103
  if a = single_annex_special_section(clause)
97
104
  annex_names1(a, "#{num}", 1)
98
105
  else
99
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
100
- 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)
101
110
  end
102
111
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
103
112
  unnumbered_annex_names1(c, 2)
@@ -125,8 +134,10 @@ module IsoDoc
125
134
  @anchors[clause["id"]] =
126
135
  { label: num, xref: l10n("#{@annexlbl} #{num}"),
127
136
  level: level, type: "clause" }
128
- clause.xpath(ns(NUMBERED_SUBCLAUSES)).each_with_index do |c, i|
129
- 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)
130
141
  end
131
142
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
132
143
  unnumbered_annex_names1(c, level + 1)
@@ -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.5"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -26,7 +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.8.0"
29
+ spec.add_dependency "metanorma-generic", "~> 1.9.0"
30
30
 
31
31
  spec.add_development_dependency "byebug", "~> 9.1"
32
32
  spec.add_development_dependency "sassc", "2.4.0"
data/metanorma.yml CHANGED
@@ -1,6 +1,8 @@
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
@@ -81,8 +83,8 @@ committees:
81
83
  - CCU
82
84
  - Consultative Committee for Units
83
85
  - Comité consultatif des unités
84
- - CCL-CCT
85
- - Frequency Standards Working Group
86
+ - CCL-CCTF-WGFS
87
+ - CCL-CCTF Frequency Standards Working Group
86
88
  - JCGM
87
89
  - Joint Committee for Guides in Metrology
88
90
  - Comité commun pour les guides en métrologie
@@ -108,6 +110,8 @@ metadata_extensions:
108
110
  _output: part
109
111
  appendix-id:
110
112
  _output: appendix
113
+ annex-id:
114
+ _output: annexid
111
115
  relations:
112
116
  - supersedes
113
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.5
4
+ version: 1.0.4
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-30 00:00:00.000000000 Z
11
+ date: 2021-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.8.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.8.0
26
+ version: 1.9.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -189,6 +189,7 @@ files:
189
189
  - lib/asciidoctor/bipm/bipm.rng
190
190
  - lib/asciidoctor/bipm/boilerplate-en.xml
191
191
  - lib/asciidoctor/bipm/boilerplate-fr.xml
192
+ - lib/asciidoctor/bipm/boilerplate-jcgm-en.xml
192
193
  - lib/asciidoctor/bipm/converter.rb
193
194
  - lib/asciidoctor/bipm/isodoc.rng
194
195
  - lib/asciidoctor/bipm/reqt.rng
@@ -221,14 +222,15 @@ files:
221
222
  - lib/isodoc/bipm/i18n-en.yaml
222
223
  - lib/isodoc/bipm/i18n-fr.yaml
223
224
  - lib/isodoc/bipm/i18n.rb
225
+ - lib/isodoc/bipm/index.rb
224
226
  - lib/isodoc/bipm/init.rb
227
+ - lib/isodoc/bipm/jcgm.standard.xsl
225
228
  - lib/isodoc/bipm/metadata.rb
226
229
  - lib/isodoc/bipm/pdf_convert.rb
227
230
  - lib/isodoc/bipm/presentation_xml_convert.rb
228
231
  - lib/isodoc/bipm/xref.rb
229
232
  - lib/metanorma-bipm.rb
230
233
  - lib/metanorma/bipm.rb
231
- - lib/metanorma/bipm/fonts_manifest.yaml
232
234
  - lib/metanorma/bipm/processor.rb
233
235
  - lib/metanorma/bipm/version.rb
234
236
  - metanorma-bipm.gemspec
@@ -252,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
252
254
  - !ruby/object:Gem::Version
253
255
  version: '0'
254
256
  requirements: []
255
- rubygems_version: 3.0.3
257
+ rubygems_version: 3.1.4
256
258
  signing_key:
257
259
  specification_version: 4
258
260
  summary: metanorma-bipm lets you write BIPM standards in Metanorma.
@@ -1,7 +0,0 @@
1
- ---
2
- Times New Roman:
3
- STIX Two Math:
4
- Courier New:
5
- Arial:
6
- Work Sans:
7
- Source Han Sans: