metanorma-bipm 0.0.3 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +29 -8
- data/README.adoc +7 -138
- data/lib/asciidoctor/bipm/basicdoc.rng +50 -3
- data/lib/asciidoctor/bipm/bipm.rng +15 -3
- data/lib/asciidoctor/bipm/boilerplate-en.xml +2 -3
- data/lib/asciidoctor/bipm/boilerplate-fr.xml +3 -4
- data/lib/asciidoctor/bipm/converter.rb +49 -11
- data/lib/asciidoctor/bipm/isodoc.rng +61 -3
- data/lib/isodoc/bipm/base_convert.rb +58 -3
- data/lib/isodoc/bipm/bipm.brochure.xsl +2129 -657
- data/lib/isodoc/bipm/bipm.guide.xsl +7826 -0
- data/lib/isodoc/bipm/bipm.mise-en-pratique.xsl +7826 -0
- data/lib/isodoc/bipm/bipm.rapport.xsl +7826 -0
- data/lib/isodoc/bipm/html/html_bipm_titlepage.html +18 -3
- data/lib/isodoc/bipm/html/htmlstyle.css +50 -60
- data/lib/isodoc/bipm/html/htmlstyle.scss +52 -76
- data/lib/isodoc/bipm/html_convert.rb +17 -0
- data/lib/isodoc/bipm/i18n-en.yaml +8 -0
- data/lib/isodoc/bipm/i18n-fr.yaml +21 -4
- data/lib/isodoc/bipm/index.rb +136 -0
- data/lib/isodoc/bipm/metadata.rb +20 -8
- data/lib/isodoc/bipm/pdf_convert.rb +13 -2
- data/lib/isodoc/bipm/presentation_xml_convert.rb +20 -6
- data/lib/isodoc/bipm/xref.rb +34 -17
- data/lib/metanorma/bipm.rb +7 -0
- data/lib/metanorma/bipm/processor.rb +11 -0
- data/lib/metanorma/bipm/version.rb +1 -1
- data/metanorma-bipm.gemspec +1 -2
- data/metanorma.yml +9 -3
- metadata +8 -18
data/lib/isodoc/bipm/metadata.rb
CHANGED
@@ -24,16 +24,17 @@ module IsoDoc
|
|
24
24
|
TITLE = "//bibdata/title".freeze
|
25
25
|
|
26
26
|
def title(isoxml, _out)
|
27
|
-
lang1 = @lang == "fr" ?
|
28
|
-
lang2 = @lang == "fr" ? "en" : "fr"
|
27
|
+
lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
|
29
28
|
set(:doctitle, @c.encode(isoxml&.at(
|
30
29
|
ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
|
31
30
|
set(:docsubtitle, @c.encode(isoxml&.at(
|
32
31
|
ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
%w(appendix annex part subtitle).each do |e|
|
33
|
+
set("#{e}title".to_sym, @c.encode(isoxml&.at(
|
34
|
+
ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
|
35
|
+
set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
|
36
|
+
ns("#{TITLE}[@type='#{e}'][@language='#{lang2}']"))&.text || ""))
|
37
|
+
end
|
37
38
|
end
|
38
39
|
|
39
40
|
def status_print(status)
|
@@ -46,11 +47,22 @@ module IsoDoc
|
|
46
47
|
|
47
48
|
def docid(isoxml, _out)
|
48
49
|
super
|
49
|
-
label1 = @lang == "fr" ?
|
50
|
-
label2 = @lang == "fr" ? "Appendix" : "Annexe"
|
50
|
+
label1, label2 = @lang == "fr" ? %w(Annexe Appendix) : %w(Appendix Annexe)
|
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}"))
|
58
|
+
label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
|
59
|
+
dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
|
60
|
+
dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
|
61
|
+
dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
|
62
|
+
end
|
63
|
+
|
64
|
+
def extract_person_names_affiliations(authors)
|
65
|
+
extract_person_affiliations(authors)
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
@@ -10,12 +10,23 @@ 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)
|
14
|
-
"
|
18
|
+
doctype = docxml&.at(ns("//bibdata/ext/doctype"))&.text
|
19
|
+
doctype = "brochure" unless %w(guide mise-en-pratique rapport).
|
20
|
+
include? doctype
|
21
|
+
"bipm.#{doctype}.xsl"
|
15
22
|
end
|
16
23
|
|
17
24
|
def pdf_options(docxml)
|
18
|
-
if docxml.root.name == "metanorma-collection"
|
25
|
+
if docxml.root.name == "metanorma-collection" &&
|
26
|
+
docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'fr']",
|
27
|
+
"m" => configuration.document_namespace) &&
|
28
|
+
docxml.at("//m:bipm-standard/m:bibdata/m:language[@current = 'true'][. = 'en']",
|
29
|
+
"m" => configuration.document_namespace)
|
19
30
|
"--split-by-language"
|
20
31
|
else
|
21
32
|
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
|
@@ -9,7 +10,7 @@ module IsoDoc
|
|
9
10
|
return if labelled_ancestor(f)
|
10
11
|
return if f["unnumbered"] && !f.at(ns("./name"))
|
11
12
|
n = @xrefs.anchor(f['id'], :label, false)
|
12
|
-
prefix_name(f, ".<tab/>", l10n("#{@i18n.table} #{n}"), "name")
|
13
|
+
prefix_name(f, ".<tab/>", l10n("#{@i18n.table.capitalize} #{n}"), "name")
|
13
14
|
end
|
14
15
|
|
15
16
|
def annex1(f)
|
@@ -72,20 +73,25 @@ module IsoDoc
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def list_authors(xml)
|
75
|
-
ret = list_people(
|
76
|
+
ret = list_people(
|
77
|
+
xml, "//bibdata/contributor[xmlns:role/@type = 'author']/person")
|
76
78
|
@i18n.multiple_and(ret, @i18n.get["and"])
|
77
79
|
end
|
78
80
|
|
81
|
+
COCHAIR = "xmlns:role[contains(text(),'co-chair')]".freeze
|
82
|
+
CHAIR = "[xmlns:role[contains(text(),'chair')]"\
|
83
|
+
"[not(contains(text(),'co-chair'))]]".freeze
|
84
|
+
|
79
85
|
def list_cochairs(xml)
|
80
|
-
ret = list_people(xml, "//bibdata/contributor[
|
81
|
-
role = xml&.at(ns("//bibdata/contributor[
|
86
|
+
ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
|
87
|
+
role = xml&.at(ns("//bibdata/contributor[#{COCHAIR}]/role"))&.text
|
82
88
|
label = ret.size > 1 && role ? "#{role}s" : role
|
83
89
|
"#{label}: #{@i18n.multiple_and(ret, @i18n.get["and"])}"
|
84
90
|
end
|
85
91
|
|
86
92
|
def list_chairs(xml)
|
87
|
-
ret = list_people(xml, "//bibdata/contributor
|
88
|
-
role = xml&.at(ns("//bibdata/contributor
|
93
|
+
ret = list_people(xml, "//bibdata/contributor#{CHAIR}/person")
|
94
|
+
role = xml&.at(ns("//bibdata/contributor#{CHAIR}/role"))&.text
|
89
95
|
label = ret.size > 1 && role ? "#{role}s" : role
|
90
96
|
"#{label}: #{@i18n.multiple_and(ret, @i18n.get["and"])}"
|
91
97
|
end
|
@@ -103,6 +109,14 @@ module IsoDoc
|
|
103
109
|
ret
|
104
110
|
end
|
105
111
|
|
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)
|
118
|
+
end
|
119
|
+
|
106
120
|
include Init
|
107
121
|
end
|
108
122
|
end
|
data/lib/isodoc/bipm/xref.rb
CHANGED
@@ -1,13 +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
|
7
|
+
def initialize(lang, script, klass, i18n, options = {})
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
4
11
|
def clause_names(docxml, sect_num)
|
5
|
-
|
12
|
+
n = Counter.new
|
6
13
|
docxml.xpath(ns("//sections/clause[not(@unnumbered = 'true')] | "\
|
7
14
|
"//sections/terms[not(@unnumbered = 'true')] | "\
|
8
15
|
"//sections/definitions[not(@unnumbered = 'true')]")).
|
9
|
-
|
10
|
-
section_names(c,
|
16
|
+
each do |c|
|
17
|
+
section_names(c, n, 1)
|
11
18
|
end
|
12
19
|
docxml.xpath(ns("//sections/clause[@unnumbered = 'true'] | "\
|
13
20
|
"//sections/terms[@unnumbered = 'true'] | "\
|
@@ -31,12 +38,14 @@ module IsoDoc
|
|
31
38
|
|
32
39
|
def section_names(clause, num, lvl)
|
33
40
|
return num if clause.nil?
|
34
|
-
num
|
41
|
+
num.increment(clause)
|
35
42
|
@anchors[clause["id"]] =
|
36
|
-
{ label: num.
|
43
|
+
{ label: num.print, xref: l10n("#{@labels["clause"]} #{num.print}"),
|
37
44
|
level: lvl, type: "clause" }
|
38
|
-
|
39
|
-
|
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)
|
40
49
|
end
|
41
50
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
|
42
51
|
unnumbered_section_names1(c, lvl + 1)
|
@@ -56,10 +65,12 @@ module IsoDoc
|
|
56
65
|
|
57
66
|
def section_names1(clause, num, level)
|
58
67
|
@anchors[clause["id"]] =
|
59
|
-
{ label: num, level: level, xref: l10n("#{@labels["
|
68
|
+
{ label: num, level: level, xref: l10n("#{@labels["subclause"]} #{num}"),
|
60
69
|
type: "clause" }
|
61
|
-
|
62
|
-
|
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)
|
63
74
|
end
|
64
75
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each_with_index do |c, i|
|
65
76
|
unnumbered_section_names1(c, lvl + 1)
|
@@ -77,6 +88,8 @@ module IsoDoc
|
|
77
88
|
|
78
89
|
def back_anchor_names(docxml)
|
79
90
|
super
|
91
|
+
@annexlbl = docxml.at(ns("//bibdata/ext/structuredidentifier/appendix")) ?
|
92
|
+
@labels["appendix"] : @labels["annex"]
|
80
93
|
docxml.xpath(ns("//annex[not(@unnumbered = 'true')]")).
|
81
94
|
each_with_index { |c, i| annex_names(c, (i+1).to_s) }
|
82
95
|
docxml.xpath(ns("//annex[@unnumbered = 'true']")).
|
@@ -86,12 +99,14 @@ module IsoDoc
|
|
86
99
|
def annex_names(clause, num)
|
87
100
|
@anchors[clause["id"]] =
|
88
101
|
{ label: annex_name_lbl(clause, num), type: "clause", value: num.to_s,
|
89
|
-
xref: "#{@
|
102
|
+
xref: l10n("#{@annexlbl} #{num}"), level: 1 }
|
90
103
|
if a = single_annex_special_section(clause)
|
91
104
|
annex_names1(a, "#{num}", 1)
|
92
105
|
else
|
93
|
-
|
94
|
-
|
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)
|
95
110
|
end
|
96
111
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
97
112
|
unnumbered_annex_names1(c, 2)
|
@@ -117,10 +132,12 @@ module IsoDoc
|
|
117
132
|
|
118
133
|
def annex_names1(clause, num, level)
|
119
134
|
@anchors[clause["id"]] =
|
120
|
-
{ label: num, xref: "#{@
|
135
|
+
{ label: num, xref: l10n("#{@annexlbl} #{num}"),
|
121
136
|
level: level, type: "clause" }
|
122
|
-
|
123
|
-
|
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)
|
124
141
|
end
|
125
142
|
clause.xpath(ns(UNNUMBERED_SUBCLAUSES)).each do |c|
|
126
143
|
unnumbered_annex_names1(c, level + 1)
|
@@ -138,7 +155,7 @@ module IsoDoc
|
|
138
155
|
end
|
139
156
|
|
140
157
|
def annex_name_lbl(clause, num)
|
141
|
-
l10n("<strong>#{@
|
158
|
+
l10n("<strong>#{@annexlbl} #{num}</strong>")
|
142
159
|
end
|
143
160
|
end
|
144
161
|
end
|
data/lib/metanorma/bipm.rb
CHANGED
@@ -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
|
data/metanorma-bipm.gemspec
CHANGED
@@ -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.
|
30
|
-
spec.add_dependency "isodoc", "~> 1.2.0"
|
29
|
+
spec.add_dependency "metanorma-generic", "~> 1.8.2"
|
31
30
|
|
32
31
|
spec.add_development_dependency "byebug", "~> 9.1"
|
33
32
|
spec.add_development_dependency "sassc", "2.4.0"
|
data/metanorma.yml
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
metanorma_name: bipm
|
2
2
|
organization_name_short: BIPM
|
3
|
-
organization_name_long:
|
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-
|
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:
|
4
|
+
version: 1.0.2
|
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-01-11 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.
|
19
|
+
version: 1.8.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: 1.
|
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.8.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: byebug
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -209,6 +195,9 @@ files:
|
|
209
195
|
- lib/isodoc/bipm.rb
|
210
196
|
- lib/isodoc/bipm/base_convert.rb
|
211
197
|
- lib/isodoc/bipm/bipm.brochure.xsl
|
198
|
+
- lib/isodoc/bipm/bipm.guide.xsl
|
199
|
+
- lib/isodoc/bipm/bipm.mise-en-pratique.xsl
|
200
|
+
- lib/isodoc/bipm/bipm.rapport.xsl
|
212
201
|
- lib/isodoc/bipm/html/html_bipm_intro.html
|
213
202
|
- lib/isodoc/bipm/html/html_bipm_titlepage.html
|
214
203
|
- lib/isodoc/bipm/html/htmlstyle.css
|
@@ -232,6 +221,7 @@ files:
|
|
232
221
|
- lib/isodoc/bipm/i18n-en.yaml
|
233
222
|
- lib/isodoc/bipm/i18n-fr.yaml
|
234
223
|
- lib/isodoc/bipm/i18n.rb
|
224
|
+
- lib/isodoc/bipm/index.rb
|
235
225
|
- lib/isodoc/bipm/init.rb
|
236
226
|
- lib/isodoc/bipm/metadata.rb
|
237
227
|
- lib/isodoc/bipm/pdf_convert.rb
|