metanorma-bipm 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +3 -0
- data/lib/asciidoctor/bipm/basicdoc.rng +52 -3
- data/lib/asciidoctor/bipm/bipm.rng +14 -1
- data/lib/asciidoctor/bipm/boilerplate-jcgm-en.xml +37 -0
- data/lib/asciidoctor/bipm/converter.rb +16 -17
- data/lib/asciidoctor/bipm/isodoc.rng +118 -4
- data/lib/isodoc/bipm/base_convert.rb +20 -7
- data/lib/isodoc/bipm/bipm.brochure.xsl +1214 -449
- data/lib/isodoc/bipm/bipm.guide.xsl +1214 -449
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +1214 -449
- data/lib/isodoc/bipm/bipm.rapport.xsl +1214 -449
- data/lib/isodoc/bipm/html/html_bipm_intro.html +1 -1
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +5 -2
- data/lib/isodoc/bipm/i18n-en.yaml +2 -0
- data/lib/isodoc/bipm/i18n-fr.yaml +6 -4
- data/lib/isodoc/bipm/index.rb +140 -0
- data/lib/isodoc/bipm/jcgm.standard.xsl +5944 -0
- data/lib/isodoc/bipm/metadata.rb +7 -1
- data/lib/isodoc/bipm/pdf_convert.rb +1 -0
- data/lib/isodoc/bipm/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/bipm/xref.rb +55 -49
- data/lib/metanorma/bipm/processor.rb +11 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +1 -1
- data/metanorma.yml +5 -2
- metadata +8 -6
- data/lib/metanorma/bipm/fonts_manifest.yaml +0 -7
data/lib/isodoc/bipm/metadata.rb
CHANGED
@@ -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,10 +51,16 @@ 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}"))
|
57
61
|
dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
|
62
|
+
set(:org_abbrev,
|
63
|
+
isoxml.at(ns("//bibdata/ext/editorialgroup/committee[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
|
58
64
|
end
|
59
65
|
|
60
66
|
def extract_person_names_affiliations(authors)
|
@@ -15,6 +15,7 @@ module IsoDoc
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def pdf_stylesheet(docxml)
|
18
|
+
return "jcgm.standard.xsl" if docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))&.value == "JCGM"
|
18
19
|
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
19
20
|
doctype = "brochure" unless %w(guide mise-en-pratique rapport).
|
20
21
|
include? doctype
|
@@ -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
|
@@ -113,7 +114,7 @@ module IsoDoc
|
|
113
114
|
end
|
114
115
|
|
115
116
|
def mathml1(f, locale)
|
116
|
-
|
117
|
+
localize_maths(f, locale)
|
117
118
|
end
|
118
119
|
|
119
120
|
include Init
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -1,24 +1,38 @@
|
|
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
|
-
|
12
|
+
if docxml&.at(ns("//bibdata/ext/editorialgroup/committee/@acronym"))&.value == "JCGM"
|
13
|
+
clause_names_jcgm(docxml, sect_num)
|
14
|
+
else
|
15
|
+
clause_names_bipm(docxml, sect_num)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def clause_names_jcgm(docxml, sect_num)
|
20
|
+
docxml.xpath(ns("//clause[parent::sections][not(@type = 'scope')][not(descendant::terms)]")).
|
21
|
+
each_with_index do |c, i|
|
22
|
+
section_names(c, sect_num, 1)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def clause_names_bipm(docxml, sect_num)
|
27
|
+
n = Counter.new
|
10
28
|
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')] | "\
|
11
29
|
"//sections/terms[not(@unnumbered = 'true')] | "\
|
12
30
|
"//sections/definitions[not(@unnumbered = 'true')]")).
|
13
|
-
|
14
|
-
section_names(c, (i + sect_num), 1)
|
15
|
-
end
|
31
|
+
each { |c| section_names(c, n, 1) }
|
16
32
|
docxml.xpath(ns("//sections/clause[@unnumbered = 'true'] | "\
|
17
33
|
"//sections/terms[@unnumbered = 'true'] | "\
|
18
34
|
"//sections/definitions[@unnumbered = 'true']")).
|
19
|
-
each
|
20
|
-
unnumbered_section_names(c, 1)
|
21
|
-
end
|
35
|
+
each { |c| unnumbered_section_names(c, 1) }
|
22
36
|
end
|
23
37
|
|
24
38
|
NUMBERED_SUBCLAUSES = "./clause[not(@unnumbered = 'true')] | "\
|
@@ -35,12 +49,13 @@ module IsoDoc
|
|
35
49
|
|
36
50
|
def section_names(clause, num, lvl)
|
37
51
|
return num if clause.nil?
|
38
|
-
num
|
39
|
-
@anchors[clause["id"]] =
|
40
|
-
|
41
|
-
|
42
|
-
clause.xpath(ns(NUMBERED_SUBCLAUSES)).
|
43
|
-
|
52
|
+
num.increment(clause)
|
53
|
+
@anchors[clause["id"]] = { label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"),
|
54
|
+
level: lvl, type: "clause" }
|
55
|
+
i = Counter.new
|
56
|
+
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
57
|
+
i.increment(c)
|
58
|
+
section_names1(c, "#{num.print}.#{i.print}", lvl + 1)
|
44
59
|
end
|
45
60
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
|
46
61
|
unnumbered_section_names1(c, lvl + 1)
|
@@ -51,8 +66,7 @@ module IsoDoc
|
|
51
66
|
def unnumbered_section_names(clause, lvl)
|
52
67
|
return if clause.nil?
|
53
68
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
54
|
-
@anchors[clause["id"]] =
|
55
|
-
{ label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl, type: "clause" }
|
69
|
+
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}), level: lvl, type: "clause" }
|
56
70
|
clause.xpath(ns(SUBCLAUSES)).each_with_index do |c, i|
|
57
71
|
unnumbered_section_names1(c, lvl + 1)
|
58
72
|
end
|
@@ -62,8 +76,10 @@ module IsoDoc
|
|
62
76
|
@anchors[clause["id"]] =
|
63
77
|
{ label: num, level: level, xref: l10n("#{@labels["subclause"]} #{num}"),
|
64
78
|
type: "clause" }
|
65
|
-
|
66
|
-
|
79
|
+
i = Counter.new
|
80
|
+
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
81
|
+
i.increment(c)
|
82
|
+
section_names1(c, "#{num}.#{i.print}", level + 1)
|
67
83
|
end
|
68
84
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
|
69
85
|
unnumbered_section_names1(c, lvl + 1)
|
@@ -83,64 +99,54 @@ module IsoDoc
|
|
83
99
|
super
|
84
100
|
@annexlbl = docxml.at(ns("//bibdata/ext/structuredidentifier/appendix")) ?
|
85
101
|
@labels["appendix"] : @labels["annex"]
|
86
|
-
docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).
|
87
|
-
|
88
|
-
docxml.xpath(ns("//
|
89
|
-
each { |c| unnumbered_annex_names(c) }
|
102
|
+
docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).each_with_index { |c, i| annex_names(c, (i+1).to_s) }
|
103
|
+
docxml.xpath(ns("//annex[@unnumbered = 'true']")).each { |c| unnumbered_annex_names(c) }
|
104
|
+
docxml.xpath(ns("//indexsect")).each { |b| preface_names(b) }
|
90
105
|
end
|
91
106
|
|
92
107
|
def annex_names(clause, num)
|
93
|
-
@anchors[clause["id"]] =
|
94
|
-
|
95
|
-
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
108
|
+
@anchors[clause["id"]] = { label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
|
109
|
+
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
96
110
|
if a = single_annex_special_section(clause)
|
97
111
|
annex_names1(a, "#{num}", 1)
|
98
112
|
else
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
unnumbered_annex_names1(c, 2)
|
113
|
+
i = Counter.new
|
114
|
+
clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
|
115
|
+
i.increment(c)
|
116
|
+
annex_names1(c, "#{num}.#{i.print}", 2)
|
104
117
|
end
|
118
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each { |c| unnumbered_annex_names1(c, 2) }
|
105
119
|
end
|
106
120
|
hierarchical_asset_names(clause, num)
|
107
121
|
end
|
108
122
|
|
109
123
|
def unnumbered_annex_names(clause)
|
110
124
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
111
|
-
@anchors[clause["id"]] =
|
112
|
-
{ label: lbl, type: "clause", value: "",
|
113
|
-
xref: l10n(%{"#{lbl}"}), level: 1 }
|
125
|
+
@anchors[clause["id"]] = { label: lbl, type: "clause", value: "", xref: l10n(%{"#{lbl}"}), level: 1 }
|
114
126
|
if a = single_annex_special_section(clause)
|
115
127
|
annex_names1(a, "#{num}", 1)
|
116
128
|
else
|
117
|
-
clause.xpath(ns(SUBCLAUSES)).each
|
118
|
-
unnumbered_annex_names1(c, 2)
|
119
|
-
end
|
129
|
+
clause.xpath(ns(SUBCLAUSES)).each { |c| unnumbered_annex_names1(c, 2) }
|
120
130
|
end
|
121
131
|
hierarchical_asset_names(clause, lbl)
|
122
132
|
end
|
123
133
|
|
124
134
|
def annex_names1(clause, num, level)
|
125
|
-
@anchors[clause["id"]] =
|
126
|
-
|
127
|
-
|
128
|
-
clause.xpath(ns(NUMBERED_SUBCLAUSES)).
|
129
|
-
|
130
|
-
|
131
|
-
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
132
|
-
unnumbered_annex_names1(c, level + 1)
|
135
|
+
@anchors[clause["id"]] = { label: num, xref: l10n("#{@annexlbl} #{num}"),
|
136
|
+
level: level, type: "clause" }
|
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)
|
133
141
|
end
|
142
|
+
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each { |c| unnumbered_annex_names1(c, level + 1) }
|
134
143
|
end
|
135
144
|
|
136
145
|
def unnumbered_annex_names1(clause, level)
|
137
146
|
lbl = clause&.at(ns("./title"))&.text || "[#{clause["id"]}]"
|
138
|
-
@anchors[clause["id"]] =
|
139
|
-
|
140
|
-
|
141
|
-
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
142
|
-
unnumbered_annex_names1(c, level + 1)
|
143
|
-
end
|
147
|
+
@anchors[clause["id"]] = { label: lbl, xref: l10n(%{"#{lbl}"}),
|
148
|
+
level: level, type: "clause" }
|
149
|
+
clause.xpath(ns(SUBCLAUSES)).each { |c| unnumbered_annex_names1(c, level + 1) }
|
144
150
|
end
|
145
151
|
|
146
152
|
def annex_name_lbl(clause, num)
|
@@ -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
|
data/metanorma-bipm.gemspec
CHANGED
@@ -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.
|
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
@@ -5,6 +5,7 @@ organization_name_long:
|
|
5
5
|
en: Bureau International des Poids et Mesures
|
6
6
|
document_namespace: https://www.metanorma.org/ns/bipm
|
7
7
|
xml_root_tag: 'bipm-standard'
|
8
|
+
docid_template: "{{ org_abbrev }} {{ docnumeric }}"
|
8
9
|
html_bodyfont: Times New Roman
|
9
10
|
html_headerfont: Times New Roman
|
10
11
|
html_normalfontsize: "15px"
|
@@ -83,8 +84,8 @@ committees:
|
|
83
84
|
- CCU
|
84
85
|
- Consultative Committee for Units
|
85
86
|
- Comité consultatif des unités
|
86
|
-
- CCL-
|
87
|
-
- Frequency Standards Working Group
|
87
|
+
- CCL-CCTF-WGFS
|
88
|
+
- CCL-CCTF Frequency Standards Working Group
|
88
89
|
- JCGM
|
89
90
|
- Joint Committee for Guides in Metrology
|
90
91
|
- Comité commun pour les guides en métrologie
|
@@ -110,6 +111,8 @@ metadata_extensions:
|
|
110
111
|
_output: part
|
111
112
|
appendix-id:
|
112
113
|
_output: appendix
|
114
|
+
annex-id:
|
115
|
+
_output: annexid
|
113
116
|
relations:
|
114
117
|
- supersedes
|
115
118
|
- 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: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-22 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.
|
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.
|
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.
|
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.
|