metanorma-bipm 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +44 -0
  3. data/README.adoc +44 -20
  4. data/lib/asciidoctor/bipm/bipm.rng +178 -20
  5. data/lib/asciidoctor/bipm/converter.rb +87 -14
  6. data/lib/asciidoctor/bipm/isodoc.rng +1 -43
  7. data/lib/isodoc/bipm/base_convert.rb +5 -0
  8. data/lib/isodoc/bipm/bipm.brochure.xsl +598 -194
  9. data/lib/isodoc/bipm/html/html_bipm_titlepage.html +21 -3
  10. data/lib/isodoc/bipm/html/htmlstyle.css +6 -2
  11. data/lib/isodoc/bipm/html/htmlstyle.scss +1 -1
  12. data/lib/isodoc/bipm/html/si-aspect/A_e.png +0 -0
  13. data/lib/isodoc/bipm/html/si-aspect/A_e_deltanu.png +0 -0
  14. data/lib/isodoc/bipm/html/si-aspect/K_k.png +0 -0
  15. data/lib/isodoc/bipm/html/si-aspect/K_k_deltanu_h.png +0 -0
  16. data/lib/isodoc/bipm/html/si-aspect/cd_Kcd.png +0 -0
  17. data/lib/isodoc/bipm/html/si-aspect/cd_Kcd_h_deltanu.png +0 -0
  18. data/lib/isodoc/bipm/html/si-aspect/full.png +0 -0
  19. data/lib/isodoc/bipm/html/si-aspect/kg_h.png +0 -0
  20. data/lib/isodoc/bipm/html/si-aspect/kg_h_c_deltanu.png +0 -0
  21. data/lib/isodoc/bipm/html/si-aspect/m_c.png +0 -0
  22. data/lib/isodoc/bipm/html/si-aspect/m_c_deltanu.png +0 -0
  23. data/lib/isodoc/bipm/html/si-aspect/mol_NA.png +0 -0
  24. data/lib/isodoc/bipm/html/si-aspect/s_deltanu.png +0 -0
  25. data/lib/isodoc/bipm/html_convert.rb +15 -0
  26. data/lib/isodoc/bipm/i18n-en.yaml +1 -0
  27. data/lib/isodoc/bipm/i18n-fr.yaml +1 -0
  28. data/lib/isodoc/bipm/metadata.rb +20 -4
  29. data/lib/isodoc/bipm/presentation_xml_convert.rb +88 -6
  30. data/lib/isodoc/bipm/xref.rb +131 -2
  31. data/lib/metanorma/bipm/version.rb +1 -1
  32. data/metanorma.yml +37 -0
  33. metadata +16 -5
  34. data/.github/workflows/macos.yml +0 -38
  35. data/.github/workflows/ubuntu.yml +0 -56
  36. data/.github/workflows/windows.yml +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 198062ce879f6837f948e113c1985c8bbdcc2aa1e753ce633bcca8c2eb580b00
4
- data.tar.gz: 771c26b923ee4adf5ddd09b77c469910b382a215bb0d0938f1616bd0d6f3e979
3
+ metadata.gz: 0d8436644152700b4a7927bd706cefb128e019ea7592721852bb227df1f3e304
4
+ data.tar.gz: 72bb82f202b91f9f31ea74718b972b315c1f69d02f66b03f7d52424d6955e274
5
5
  SHA512:
6
- metadata.gz: 75194ca626816201d59884e40fcead12afaa115f1935a8a4722c18591c4a7ae91565c7166b7cab75fa10e948f740e11acbea53845055a9cc64bff9cbb92750cf
7
- data.tar.gz: 0531d6c46349852dfc6253563d6dc1ce14a4fe771626bc375b130962a9d162071216f1cd112197b19a7daaae24d8f259387abf055fec6cf9acd3633ccfbe6893
6
+ metadata.gz: 2e3c3175ef01047372bbcd0f22807d5ac04cb61a87d51c4fc05faf12af40a066c3e8d1ee5a34d31b77f7c66cc2f82f556b214bc365c3e45f49f187726d269332
7
+ data.tar.gz: 032ceebe7c4688f8c617998b8b3aa2a047be8fb0c8b20914a3d4927d6cfafaa6a26bc1c9cb6ec191233b978721cc3152b2312d8a17daaf29ebc3c2ddb2d75060
@@ -0,0 +1,44 @@
1
+ # Auto-generated by Cimas: Do not edit it manually!
2
+ # See https://github.com/metanorma/cimas
3
+ name: rake
4
+
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+
10
+ jobs:
11
+ rake:
12
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
13
+ runs-on: ${{ matrix.os }}
14
+ continue-on-error: ${{ matrix.experimental }}
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ ruby: [ '2.6', '2.5', '2.4' ]
19
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
20
+ experimental: [ false ]
21
+ include:
22
+ - ruby: '2.7'
23
+ os: 'ubuntu-latest'
24
+ experimental: true
25
+ - ruby: '2.7'
26
+ os: 'windows-latest'
27
+ experimental: true
28
+ - ruby: '2.7'
29
+ os: 'macos-latest'
30
+ experimental: true
31
+ steps:
32
+ - uses: actions/checkout@master
33
+
34
+ - name: Use Ruby
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+
40
+ - name: Update gems
41
+ run: bundle install --jobs 4 --retry 3
42
+
43
+ - name: Run specs
44
+ run: bundle exec rake
@@ -86,10 +86,17 @@ metadata about the document. These include:
86
86
  the document was issued
87
87
 
88
88
  `:supersedes:`:: One or more BIPM document that this BIPM document standard supersedes; the superseded
89
- document may still remain in effect. Comma delimited.
89
+ document may still remain in effect. Identified with document identifier. Comma delimited.
90
90
 
91
91
  `:superseded-by:`:: One or more BIPM document that this BIPM document standard is superseded by; this
92
- document may still remain in effect. Comma delimited.
92
+ document may still remain in effect. Identified with document identifier. Comma delimited.
93
+
94
+ `:supersedes-date_{i}:`:: Date of the document draft or version which this document supersedes.
95
+ Assumes superseded document does not have distinct identifier.
96
+ `:supersedes-draft_{i}:`:: Draft of the document which this document supersedes.
97
+ Assumes superseded document does not have distinct identifier.
98
+ `:supersedes-edition{i}:``:: Version of the document which this document supersedes.
99
+ Assumes superseded document does not have distinct identifier.
93
100
 
94
101
  `:doctype:`:: The document type (mandatory). The permitted types are:
95
102
  +
@@ -110,29 +117,32 @@ document may still remain in effect. Comma delimited.
110
117
  `:status:``:: The document status. The permitted types are: `draft-proposal`,
111
118
  `draft-development`, `in-force`, `retired`.
112
119
 
113
- `:committee:`:: The name of the relevant committee (mandatory):
120
+ `:committee-en:`:: The name of the relevant committee in English (mandatory)
121
+ `:committee-fr:`:: The name of the relevant committee in French (mandatory)
122
+ `:committee-acronym:`:: The acronym of the relevant committee (mandatory)
114
123
  +
115
124
  --
116
- * CGPM: General Conference on Weights and Measures
117
- * CIPM: International Committee for Weights and Measures
118
- * BIPM: International Bureau of Weights and Measures
119
- * CCAUV: Consultative Committee for Acoustics, Ultrasound and Vibration
120
- * CCEM: Consultative Committee for Electricity and Magnetism
121
- * CCL: Consultative Committee for Length
122
- * CCM: Consultative Committee for Mass and Related Quantities
123
- * CCPR: Consultative Committee for Photometry and Radiometry
124
- * CCQM: Consultative Committee for Amount of Substance:: Metrology in Chemistry and Biology
125
- * CCRI: Consultative Committee for Ionizing Radiation
126
- * CCT: Consultative Committee for Thermometry
127
- * CCTF: Consultative Committee for Time and Frequency
128
- * CCU: Consultative Committee for Units
125
+ * CGPM: General Conference on Weights and Measures / Conférence générale des poids et mesures
126
+ * CIPM: International Committee for Weights and Measures / Comité international des poids et mesures
127
+ * BIPM: International Bureau of Weights and Measures / Bureau International des Poids et Mesures
128
+ * CCAUV: Consultative Committee for Acoustics, Ultrasound and Vibration / Comité consultatif de l'acoustique, des ultrasons et des vibrations
129
+ * CCEM: Consultative Committee for Electricity and Magnetism / Comité consultatif d'électricité et magnétisme
130
+ * CCL: Consultative Committee for Length / Comité consultatif des longueurs
131
+ * CCM: Consultative Committee for Mass and Related Quantities / Comité consultatif pour la masse et les grandeurs apparentées
132
+ * CCPR: Consultative Committee for Photometry and Radiometry / Comité consultatif de photométrie et radiométrie
133
+ * CCQM: Consultative Committee for Amount of Substance: Metrology in Chemistry and Biology / Comité consultatif pour la quantité de matière : métrologie en chimie et biologie
134
+ * CCRI: Consultative Committee for Ionizing Radiation / Comité consultatif des rayonnements ionisants
135
+ * CCT: Consultative Committee for Thermometry / Comité consultatif de thermométrie
136
+ * CCTF: Consultative Committee for Time and Frequency / Comité consultatif du temps et des fréquences
137
+ * CCU: Consultative Committee for Units / Comité consultatif des unités
129
138
  * CCL-CCTF: Frequency Standards Working Group
130
- * JCGM: Joint Committee for Guides in Metrology
131
- * JCRB: Joint Committee of the Regional Metrology Organizations and the BIPM
132
- * JCTLM: Joint Committee for Traceability in Laboratory Medicine
133
- * INetQI: International Network on Quality Infrastructure
139
+ * JCGM: Joint Committee for Guides in Metrology / Comité commun pour les guides en métrologie
140
+ * JCRB: Joint Committee of the Regional Metrology Organizations and the BIPM / Comité mixte des organisations régionales de métrologie et du BIPM
141
+ * JCTLM: Joint Committee for Traceability in Laboratory Medicine / Comité commun pour la traçabilité en médecine de laboratoire
142
+ * INetQI: International Network on Quality Infrastructure
134
143
  --
135
144
  `:workgroup:`:: The name of the relevant workgroup (mandatory)
145
+ `:workgroup-acronym:`:: The acronym of the relevant workgroup (mandatory)
136
146
 
137
147
  `:language:` :: The language of the document (`en` or `fr`) (mandatory)
138
148
 
@@ -142,6 +152,16 @@ document may still remain in effect. Comma delimited.
142
152
  `:obsoleted-date:`:: The date a document was superseded
143
153
  `:implemented-date:`:: The date a document became effective
144
154
 
155
+ `:meeting-note:`:: Note on when and where a guide was adopted.
156
+
157
+ `:role_{i}:`:: If provided and is other than "author" or "editor" (e.g. "WG-N co-chair"),
158
+ is treated as a subclass of "editor".
159
+
160
+ `:supersedes-date_{i}:`:: Date of the document draft or version which this document supersedes.
161
+ `:supersedes-draft_{i}:`:: Draft of the document which this document supersedes.
162
+ `:supersedes-version_{i}:``:: Version of the document which this document supersedes.
163
+
164
+
145
165
  The attribute `:draft:`, if present, includes review notes in the XML output;
146
166
  these are otherwise suppressed.
147
167
 
@@ -150,6 +170,10 @@ these are otherwise suppressed.
150
170
  Cross-references formatted as `<<{{anchor}},pagenumber%>>` are rendered in PDF as just the page number;
151
171
  they are used for tables of content. In HTML output, they are treated as normal cross-references.
152
172
 
173
+ Clauses and annexes may be marked as `[%unnumbered]`, in which case they do not receive section numbering, and are cross-referenced by their title.
174
+
175
+ Unlike the Metanorma default, ordered lists do not have a fixed sequence of numbering styles: the type set for each ordered list (including nested lists) is respected. The default numbering style for ordered lists is always arabic.
176
+
153
177
  == Data Models
154
178
 
155
179
  The document model for BIPM is given in https://github.com/metanorma/metanorma-model-bipm[metanorma-model-bipm].
@@ -45,6 +45,150 @@
45
45
  <text/>
46
46
  </element>
47
47
  </define>
48
+ <define name="Clause-Section">
49
+ <optional>
50
+ <attribute name="id">
51
+ <data type="ID"/>
52
+ </attribute>
53
+ </optional>
54
+ <optional>
55
+ <attribute name="language"/>
56
+ </optional>
57
+ <optional>
58
+ <attribute name="script"/>
59
+ </optional>
60
+ <optional>
61
+ <attribute name="inline-header">
62
+ <data type="boolean"/>
63
+ </attribute>
64
+ </optional>
65
+ <optional>
66
+ <attribute name="obligation">
67
+ <choice>
68
+ <value>normative</value>
69
+ <value>informative</value>
70
+ </choice>
71
+ </attribute>
72
+ </optional>
73
+ <optional>
74
+ <attribute name="type"/>
75
+ </optional>
76
+ <optional>
77
+ <attribute name="unnumbered">
78
+ <data type="boolean"/>
79
+ </attribute>
80
+ </optional>
81
+ <optional>
82
+ <ref name="section-title"/>
83
+ </optional>
84
+ <group>
85
+ <choice>
86
+ <group>
87
+ <zeroOrMore>
88
+ <ref name="BasicBlock"/>
89
+ </zeroOrMore>
90
+ <zeroOrMore>
91
+ <ref name="note"/>
92
+ </zeroOrMore>
93
+ </group>
94
+ <ref name="amend"/>
95
+ </choice>
96
+ <zeroOrMore>
97
+ <choice>
98
+ <ref name="clause-subsection"/>
99
+ <ref name="terms"/>
100
+ <ref name="definitions"/>
101
+ </choice>
102
+ </zeroOrMore>
103
+ </group>
104
+ </define>
105
+ <define name="Annex-Section">
106
+ <optional>
107
+ <attribute name="id">
108
+ <data type="ID"/>
109
+ </attribute>
110
+ </optional>
111
+ <optional>
112
+ <attribute name="language"/>
113
+ </optional>
114
+ <optional>
115
+ <attribute name="script"/>
116
+ </optional>
117
+ <optional>
118
+ <attribute name="inline-header">
119
+ <data type="boolean"/>
120
+ </attribute>
121
+ </optional>
122
+ <optional>
123
+ <attribute name="obligation">
124
+ <choice>
125
+ <value>normative</value>
126
+ <value>informative</value>
127
+ </choice>
128
+ </attribute>
129
+ </optional>
130
+ <optional>
131
+ <attribute name="unnumbered">
132
+ <data type="boolean"/>
133
+ </attribute>
134
+ </optional>
135
+ <optional>
136
+ <ref name="section-title"/>
137
+ </optional>
138
+ <group>
139
+ <group>
140
+ <zeroOrMore>
141
+ <ref name="BasicBlock"/>
142
+ </zeroOrMore>
143
+ <zeroOrMore>
144
+ <ref name="note"/>
145
+ </zeroOrMore>
146
+ </group>
147
+ <zeroOrMore>
148
+ <choice>
149
+ <ref name="annex-subsection"/>
150
+ <ref name="terms"/>
151
+ <ref name="definitions"/>
152
+ <ref name="references"/>
153
+ </choice>
154
+ </zeroOrMore>
155
+ </group>
156
+ </define>
157
+ <define name="ol">
158
+ <element name="ol">
159
+ <attribute name="id">
160
+ <data type="ID"/>
161
+ </attribute>
162
+ <optional>
163
+ <attribute name="keep-with-next">
164
+ <data type="boolean"/>
165
+ </attribute>
166
+ </optional>
167
+ <optional>
168
+ <attribute name="keep-lines-together">
169
+ <data type="boolean"/>
170
+ </attribute>
171
+ </optional>
172
+ <attribute name="type">
173
+ <choice>
174
+ <value>roman</value>
175
+ <value>alphabet</value>
176
+ <value>arabic</value>
177
+ <value>roman_upper</value>
178
+ <value>alphabet_upper</value>
179
+ </choice>
180
+ </attribute>
181
+ <optional>
182
+ <attribute name="start"/>
183
+ </optional>
184
+ <oneOrMore>
185
+ <ref name="li"/>
186
+ </oneOrMore>
187
+ <zeroOrMore>
188
+ <ref name="note"/>
189
+ </zeroOrMore>
190
+ </element>
191
+ </define>
48
192
  <define name="DocumentType">
49
193
  <choice>
50
194
  <value>brochure</value>
@@ -98,6 +242,9 @@
98
242
  <optional>
99
243
  <ref name="si-aspect"/>
100
244
  </optional>
245
+ <optional>
246
+ <ref name="meeting-note"/>
247
+ </optional>
101
248
  <ref name="structuredidentifier"/>
102
249
  </define>
103
250
  </include>
@@ -132,30 +279,41 @@
132
279
  </define>
133
280
  <define name="committee">
134
281
  <element name="committee">
135
- <choice>
136
- <value>CGPM</value>
137
- <value>CIPM</value>
138
- <value>BIPM</value>
139
- <value>CCAUV</value>
140
- <value>CCEM</value>
141
- <value>CCL</value>
142
- <value>CCM</value>
143
- <value>CCPR</value>
144
- <value>CCQM</value>
145
- <value>CCRI</value>
146
- <value>CCT</value>
147
- <value>CCTF</value>
148
- <value>CCU</value>
149
- <value>CCL-CCTF</value>
150
- <value>JCGM</value>
151
- <value>JCRB</value>
152
- <value>JCTLM</value>
153
- <value>INetQI</value>
154
- </choice>
282
+ <attribute name="acronym">
283
+ <choice>
284
+ <value>CGPM</value>
285
+ <value>CIPM</value>
286
+ <value>BIPM</value>
287
+ <value>CCAUV</value>
288
+ <value>CCEM</value>
289
+ <value>CCL</value>
290
+ <value>CCM</value>
291
+ <value>CCPR</value>
292
+ <value>CCQM</value>
293
+ <value>CCRI</value>
294
+ <value>CCT</value>
295
+ <value>CCTF</value>
296
+ <value>CCU</value>
297
+ <value>CCL-CCTF</value>
298
+ <value>JCGM</value>
299
+ <value>JCRB</value>
300
+ <value>JCTLM</value>
301
+ <value>INetQI</value>
302
+ </choice>
303
+ </attribute>
304
+ <ref name="LocalizedString"/>
155
305
  </element>
156
306
  </define>
157
307
  <define name="workgroup">
158
308
  <element name="workgroup">
309
+ <optional>
310
+ <attribute name="acronym"/>
311
+ </optional>
312
+ <text/>
313
+ </element>
314
+ </define>
315
+ <define name="meeting-note">
316
+ <element name="meeting-note">
159
317
  <text/>
160
318
  </element>
161
319
  </define>
@@ -3,9 +3,6 @@ require 'asciidoctor/generic/converter'
3
3
 
4
4
  module Asciidoctor
5
5
  module BIPM
6
- # A {Converter} implementation that generates RSD output, and a document
7
- # schema encapsulation of the document for validation
8
- #
9
6
  class Converter < Asciidoctor::Generic::Converter
10
7
  register_for "bipm"
11
8
 
@@ -14,23 +11,85 @@ module Asciidoctor
14
11
  end
15
12
 
16
13
  def metadata_committee(node, xml)
17
- return unless node.attr("committee")
14
+ return unless node.attr("committee-en") || node.attr("committee-fr")
18
15
  xml.editorialgroup do |a|
19
- a.committee node.attr("committee")
20
- i = 2
21
- while node.attr("committee_#{i}") do
22
- a.committee node.attr("committee_#{i}")
23
- i += 1
16
+ metadata_committee1(node, a)
17
+ metadata_committee2(node, a)
18
+ metadata_workgroup(node, a)
19
+ end
20
+ end
21
+
22
+ def metadata_committee1(node, a)
23
+ a.committee **attr_code(acronym: node.attr("committee-acronym")) do |c|
24
+ e = node.attr("committee-en") and
25
+ c.variant e, language: "en", script: "Latn"
26
+ e = node.attr("committee-fr") and
27
+ c.variant e, language: "fr", script: "Latn"
28
+ end
29
+ end
30
+
31
+ def metadata_committee2(node, a)
32
+ i = 2
33
+ while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}") do
34
+ a.committee **attr_code(acronym: node.attr("committee-acronym_#{i}")) do |c|
35
+ e = node.attr("committee-en_#{i}") and
36
+ c.variant e, language: "en", script: "Latn"
37
+ e = node.attr("committee-fr_#{i}") and
38
+ c.variant e, language: "fr", script: "Latn"
24
39
  end
25
- a.workgroup node.attr("workgroup")
26
- i = 2
27
- while node.attr("workgroup_#{i}") do
28
- a.workgroup node.attr("workgroup_#{i}")
29
- i += 1
40
+ i += 1
41
+ end
42
+ end
43
+
44
+ def metadata_workgroup(node, a)
45
+ a.workgroup node.attr("workgroup"),
46
+ **attr_code(acronym: node.attr("workgroup-acronym"))
47
+ i = 2
48
+ while node.attr("workgroup_#{i}") do
49
+ a.workgroup node.attr("workgroup_#{i}"),
50
+ **attr_code(acronym: node.attr("workgroup-acronym_#{i}"))
51
+ i += 1
52
+ end
53
+ end
54
+
55
+ def metadata_relations(node, xml)
56
+ super
57
+ relation_supersedes_self(node, xml, "")
58
+ i = 2
59
+ while relation_supersedes_self(node, xml, "_#{i}")
60
+ i += 1
61
+ end
62
+ end
63
+
64
+ def relation_supersedes_self(node, xml, suffix)
65
+ d = node.attr("supersedes-date#{suffix}")
66
+ draft = node.attr("supersedes-draft#{suffix}")
67
+ edition = node.attr("supersedes-edition#{suffix}")
68
+ return false unless d || draft || edition
69
+ relation_supersedes_self1(xml, d, edition, draft)
70
+ end
71
+
72
+ def relation_supersedes_self1(xml, d, edition, draft)
73
+ xml.relation **{ type: "supersedes" } do |r|
74
+ r.bibitem do |b|
75
+ d and b.date d, **{ type: edition ? "published" : "circulated" }
76
+ edition and b.edition edition
77
+ draft and b.version do |v|
78
+ v.draft draft
79
+ end
30
80
  end
31
81
  end
32
82
  end
33
83
 
84
+ def personal_role(node, c, suffix)
85
+ role = node.attr("role#{suffix}") || "author"
86
+ unless %w(author editor).include?(role.downcase)
87
+ desc = role
88
+ role = "editor"
89
+ end
90
+ c.role desc, **{ type: role.downcase }
91
+ end
92
+
34
93
  def title(node, xml)
35
94
  ["en", "fr"].each do |lang|
36
95
  at = { language: lang, format: "text/plain" }
@@ -67,6 +126,20 @@ module Asciidoctor
67
126
  page ? super.merge(pagenumber: true) : super
68
127
  end
69
128
 
129
+ def clause_parse(attrs, xml, node)
130
+ node.option?("unnumbered") and attrs[:unnumbered] = true
131
+ super
132
+ end
133
+
134
+ def annex_parse(attrs, xml, node)
135
+ node.option?("unnumbered") and attrs[:unnumbered] = true
136
+ super
137
+ end
138
+
139
+ def ol_attrs(node)
140
+ super.merge(start: node.attr("start"))
141
+ end
142
+
70
143
  def outputs(node, ret)
71
144
  File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
72
145
  presentation_xml_converter(node).convert(@filename + ".xml")