metanorma-bipm 0.0.3 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0d8436644152700b4a7927bd706cefb128e019ea7592721852bb227df1f3e304
4
- data.tar.gz: 72bb82f202b91f9f31ea74718b972b315c1f69d02f66b03f7d52424d6955e274
3
+ metadata.gz: a0e8acf33a7fceea3050a35b6d104de2a50936c05f29a5e30025cad7fe45c835
4
+ data.tar.gz: 5a7b43fd90b235369e3aa8456821d121ff994dec4a34e9133bdd1e64c5aea236
5
5
  SHA512:
6
- metadata.gz: 2e3c3175ef01047372bbcd0f22807d5ac04cb61a87d51c4fc05faf12af40a066c3e8d1ee5a34d31b77f7c66cc2f82f556b214bc365c3e45f49f187726d269332
7
- data.tar.gz: 032ceebe7c4688f8c617998b8b3aa2a047be8fb0c8b20914a3d4927d6cfafaa6a26bc1c9cb6ec191233b978721cc3152b2312d8a17daaf29ebc3c2ddb2d75060
6
+ metadata.gz: 38fed8bc9d7b0b7624d3924d9503d8073fef2fdea8fbb56975642160713d48a053e46073d4ec5a23ca22916cccd6c31d22d0e8a5dc5b9fe62624ecc1fd964adc
7
+ data.tar.gz: 95b610c7b041e243c14a2c98dfa36aa8647798327b7fff5b8acb5ae6915dc6a0e82a5cdcced4f0b423ae08e351159393e7676f58ebf835a1913a0da4d55846ad
@@ -4,7 +4,8 @@ name: rake
4
4
 
5
5
  on:
6
6
  push:
7
- branches: [ master ]
7
+ branches: [ master, main ]
8
+ tags: [ v* ]
8
9
  pull_request:
9
10
 
10
11
  jobs:
@@ -31,14 +32,34 @@ jobs:
31
32
  steps:
32
33
  - uses: actions/checkout@master
33
34
 
34
- - name: Use Ruby
35
- uses: ruby/setup-ruby@v1
35
+ - uses: ruby/setup-ruby@v1
36
36
  with:
37
37
  ruby-version: ${{ matrix.ruby }}
38
- bundler-cache: true
39
38
 
40
- - name: Update gems
41
- run: bundle install --jobs 4 --retry 3
39
+ - if: matrix.os == 'macos-latest'
40
+ run: brew install autoconf automake libtool
42
41
 
43
- - name: Run specs
44
- run: bundle exec rake
42
+ - uses: actions/cache@v2
43
+ with:
44
+ path: vendor/bundle
45
+ key: bundle-${{ matrix.os }}-${{ matrix.ruby }}-${{ hashFiles('**/*.gemspec') }}
46
+ restore-keys: bundle-${{ matrix.os }}-${{ matrix.ruby }}
47
+
48
+ - run: bundle config set path 'vendor/bundle'
49
+
50
+ - run: bundle install --jobs 4 --retry 3
51
+
52
+ - run: bundle exec rake
53
+
54
+ tests-passed:
55
+ needs: rake
56
+ runs-on: ubuntu-latest
57
+ steps:
58
+ - name: Trigger tests passed event
59
+ uses: Sibz/github-status-action@v1
60
+ with:
61
+ authToken: ${{ secrets.METANORMA_CI_PAT_TOKEN || secrets.GITHUB_TOKEN }}
62
+ context: 'tests-passed-successfully'
63
+ description: 'Tests passed successfully'
64
+ state: 'success'
65
+ sha: ${{ github.event.pull_request.head.sha || github.sha }}
@@ -1,17 +1,14 @@
1
1
  = Metanorma for BIPM: Metanorma processor for Bureau International de Poids et Mesures
2
2
 
3
- image:https://img.shields.io/gem/v/metanorma-bimp.sbimp["Gem Version", link="https://rubygems.org/gems/metanorma-bimp"]
4
- image:https://github.com/metanorma/metanorma-bimp/workflows/macos/badge.sbimp["Build Status (macOS)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=macos"]
5
- image:https://github.com/metanorma/metanorma-bimp/workflows/ubuntu/badge.sbimp["Build Status (ubuntu)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=ubuntu"]
6
- image:https://github.com/metanorma/metanorma-bimp/workflows/windows/badge.sbimp["Build Status (Windows)", link="https://github.com/metanorma/metanorma-bimp/actions?workflow=windows"]
7
- image:https://codeclimate.com/github/metanorma/metanorma-bimp/badges/gpa.sbimp["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-bimp"]
8
- image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-bimp.sbimp["Pull Requests", link="https://github.com/metanorma/metanorma-bimp/pulls"]
9
- image:https://img.shields.io/github/commits-since/metanorma/metanorma-bimp/latest.sbimp["Commits since latest",link="https://github.com/metanorma/metanorma-bimp/releases"]
3
+ image:https://img.shields.io/gem/v/metanorma-bipm.svg["Gem Version", link="https://rubygems.org/gems/metanorma-bipm"]
4
+ image:https://github.com/metanorma/metanorma-bipm/workflows/rake/badge.svg["Build Status", link="https://github.com/metanorma/metanorma-bipm/actions?workflow=rake"]
5
+ image:https://codeclimate.com/github/metanorma/metanorma-bipm/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/metanorma-bipm"]
6
+ image:https://img.shields.io/github/issues-pr-raw/metanorma/metanorma-bipm.svg["Pull Requests", link="https://github.com/metanorma/metanorma-bipm/pulls"]
7
+ image:https://img.shields.io/github/commits-since/metanorma/metanorma-bipm/latest.svg["Commits since latest",link="https://github.com/metanorma/metanorma-bipm/releases"]
10
8
 
11
9
  == Functionality
12
10
 
13
- This gem processes http://asciidoctor.org/[Asciidoctor] documents following
14
- a template for generating BIPM standards.
11
+ This gem processes https://www.metanorma.com[Metanorma documents] following a template for generating BIPM standards.
15
12
 
16
13
  == Usage
17
14
 
@@ -42,138 +39,10 @@ scripts such as this one. You need only run the following in a Terminal console:
42
39
  [source,console]
43
40
  ----
44
41
  $ bash <(curl -s https://raw.githubusercontent.com/riboseinc/metanorma-macos-setup/master/metanorma-setup)
45
- $ gem install metanorma-vg
42
+ $ gem install metanorma-bipm
46
43
  ----
47
44
 
48
45
 
49
- == Document Attributes
50
-
51
- The gem relies on Asciidoctor document attributes to provide necessary
52
- metadata about the document. These include:
53
-
54
- `:edition:`:: The document edition
55
-
56
- `:revdate:`:: The date the document was last updated
57
-
58
- `:title-en:`:: The title of the document in English (mandatory)
59
- `:title-fr:`:: The title of the document in French (mandatory)
60
- `:title-cover-en:`:: The title of the front cover of the document in English (where different from the title proper)
61
- `:title-cover-fr:`:: The title of the front cover of the document in French (where different from the title proper)
62
- `:title-appendix-en:`:: The title of the appendix in English, if this document is an appendix published separately; `title-en` becomes the title of the main document, as presented within the standalone appendix.
63
- `:title-appendix-fr:`:: The title of the appendix in English, if this document is an appendix published separately; `title-en` becomes the title of the main document, as presented within the standalone appendix.
64
-
65
- `:appendix-id:`:: The number of the appendix, if this document is an appendix published separately
66
-
67
- `:si-aspect:`:: The domain of SI covered by the document; used to select logo in PDF cover page. The logo nominates one primary SI base units, and defining consonants for that unit and possibly others as well. The permitted values are:
68
- +
69
- --
70
- * A_e_deltanu (ampere; time)
71
- * A_e (ampere)
72
- * cd_Kcd_h_deltanu (candela; mass, time)
73
- * cd_Kcd (candela)
74
- * full (all units)
75
- * K_k_deltanu (kelvin; mass, time)
76
- * K_k (kelvin)
77
- * kg_h_c_deltanu (kilogram; length, time)
78
- * kg_h (kilogram)
79
- * m_c_deltanu (metre; time)
80
- * m_c (metre)
81
- * mol_NA (mole)
82
- * s_deltanu (second)
83
- --
84
-
85
- `:copyright-year:`:: The year which will be claimed as when the copyright for
86
- the document was issued
87
-
88
- `:supersedes:`:: One or more BIPM document that this BIPM document standard supersedes; the superseded
89
- document may still remain in effect. Identified with document identifier. Comma delimited.
90
-
91
- `:superseded-by:`:: One or more BIPM document that this BIPM document standard is superseded by; this
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.
100
-
101
- `:doctype:`:: The document type (mandatory). The permitted types are:
102
- +
103
- --
104
- * brochure (default)
105
- * mise-en-pratique
106
- * rapport
107
- * monographie
108
- * guide
109
- * meeting-report
110
- * technical-report
111
- * working-party-note
112
- * strategy
113
- * cipm-mra
114
- * resolution
115
- --
116
-
117
- `:status:``:: The document status. The permitted types are: `draft-proposal`,
118
- `draft-development`, `in-force`, `retired`.
119
-
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)
123
- +
124
- --
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
138
- * CCL-CCTF: Frequency Standards Working Group
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
143
- --
144
- `:workgroup:`:: The name of the relevant workgroup (mandatory)
145
- `:workgroup-acronym:`:: The acronym of the relevant workgroup (mandatory)
146
-
147
- `:language:` :: The language of the document (`en` or `fr`) (mandatory)
148
-
149
- `:comment-period-from:`:: Start of the period during which comments are allowed on the document draft
150
- `:comment-period-to:`:: End of the period during which comments are allowed on the document draft (optional)
151
-
152
- `:obsoleted-date:`:: The date a document was superseded
153
- `:implemented-date:`:: The date a document became effective
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
-
165
- The attribute `:draft:`, if present, includes review notes in the XML output;
166
- these are otherwise suppressed.
167
-
168
- == Markup
169
-
170
- Cross-references formatted as `<<{{anchor}},pagenumber%>>` are rendered in PDF as just the page number;
171
- they are used for tables of content. In HTML output, they are treated as normal cross-references.
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
-
177
46
  == Data Models
178
47
 
179
48
  The document model for BIPM is given in https://github.com/metanorma/metanorma-model-bipm[metanorma-model-bipm].
@@ -596,6 +596,7 @@
596
596
  <ref name="bookmark"/>
597
597
  <ref name="image"/>
598
598
  <ref name="index"/>
599
+ <ref name="index-xref"/>
599
600
  </choice>
600
601
  </define>
601
602
  <define name="PureTextElement">
@@ -728,15 +729,61 @@
728
729
  </define>
729
730
  <define name="index">
730
731
  <element name="index">
731
- <attribute name="primary"/>
732
+ <attribute name="to">
733
+ <data type="IDREF"/>
734
+ </attribute>
735
+ <element name="primary">
736
+ <oneOrMore>
737
+ <ref name="PureTextElement"/>
738
+ </oneOrMore>
739
+ </element>
732
740
  <optional>
733
- <attribute name="secondary"/>
741
+ <element name="secondary">
742
+ <oneOrMore>
743
+ <ref name="PureTextElement"/>
744
+ </oneOrMore>
745
+ </element>
734
746
  </optional>
735
747
  <optional>
736
- <attribute name="tertiary"/>
748
+ <element name="tertiary">
749
+ <oneOrMore>
750
+ <ref name="PureTextElement"/>
751
+ </oneOrMore>
752
+ </element>
737
753
  </optional>
738
754
  </element>
739
755
  </define>
756
+ <define name="index-xref">
757
+ <element name="index-xref">
758
+ <attribute name="also">
759
+ <data type="boolean"/>
760
+ </attribute>
761
+ <element name="primary">
762
+ <oneOrMore>
763
+ <ref name="PureTextElement"/>
764
+ </oneOrMore>
765
+ </element>
766
+ <optional>
767
+ <element name="secondary">
768
+ <oneOrMore>
769
+ <ref name="PureTextElement"/>
770
+ </oneOrMore>
771
+ </element>
772
+ </optional>
773
+ <optional>
774
+ <element name="tertiary">
775
+ <oneOrMore>
776
+ <ref name="PureTextElement"/>
777
+ </oneOrMore>
778
+ </element>
779
+ </optional>
780
+ <element name="target">
781
+ <oneOrMore>
782
+ <ref name="PureTextElement"/>
783
+ </oneOrMore>
784
+ </element>
785
+ </element>
786
+ </define>
740
787
  <!-- bare ID element, used for referencing arbitrary spans of text -->
741
788
  <define name="bookmark">
742
789
  <element name="bookmark">
@@ -42,6 +42,16 @@
42
42
  <data type="boolean"/>
43
43
  </attribute>
44
44
  </optional>
45
+ <optional>
46
+ <attribute name="nosee">
47
+ <data type="boolean"/>
48
+ </attribute>
49
+ </optional>
50
+ <optional>
51
+ <attribute name="nopage">
52
+ <data type="boolean"/>
53
+ </attribute>
54
+ </optional>
45
55
  <text/>
46
56
  </element>
47
57
  </define>
@@ -209,9 +219,9 @@
209
219
  <oneOrMore>
210
220
  <ref name="committee"/>
211
221
  </oneOrMore>
212
- <oneOrMore>
222
+ <zeroOrMore>
213
223
  <ref name="workgroup"/>
214
- </oneOrMore>
224
+ </zeroOrMore>
215
225
  </element>
216
226
  </define>
217
227
  <define name="structuredidentifier">
@@ -333,7 +343,9 @@
333
343
  <optional>
334
344
  <ref name="boilerplate"/>
335
345
  </optional>
336
- <ref name="preface"/>
346
+ <optional>
347
+ <ref name="preface"/>
348
+ </optional>
337
349
  <oneOrMore>
338
350
  <ref name="sections"/>
339
351
  </oneOrMore>
@@ -1,7 +1,7 @@
1
1
  <boilerplate>
2
2
  <copyright-statement>
3
3
  <clause>
4
- <p align="center"> © Bureau International des poids et mesures {{ docyear }} all rights reserved</p>
4
+ <p align="center"> © Bureau International des Poids et Mesures {{ docyear }} all rights reserved</p>
5
5
  </clause>
6
6
  </copyright-statement>
7
7
  <license-statement>
@@ -13,8 +13,7 @@
13
13
  <feedback-statement>
14
14
  <p>BIPM<br/>
15
15
  Pavillon de Breteuil<br/>
16
- F-92312 Sèvres<br/>
17
- Cedex<br/>
16
+ F-92312 Sèvres Cedex<br/>
18
17
  FRANCE</p>
19
18
  </feedback-statement>
20
19
  </boilerplate>
@@ -1,20 +1,19 @@
1
1
  <boilerplate>
2
2
  <copyright-statement>
3
3
  <clause>
4
- <p align="center"> © Bureau International des poids et mesures {{ docyear }} tous droits réservés</p>
4
+ <p align="center"> © Bureau international des poids et mesures {{ docyear }} tous droits réservés</p>
5
5
  </clause>
6
6
  </copyright-statement>
7
7
  <license-statement>
8
8
  <clause>
9
9
  <title>Note concernant les droits d’auteur</title>
10
- <p>Ce document est distribué selon les termes et conditions de la licence Creative Commons Attribution 4.0 International (<link target="http://creativecommons.org/licenses/by/4.0/"/>), qui permet l’utilisation sans restriction, la distribution et la reproduction sur quelque support que soit, sous réserve de mentionner dûment l’auteur ou les auteurs originaux ainsi que la source de l’œuvre, d’intégrer un lien vers la licence Creative Commons et d’indiquer si des modifications ont été effectuées.</p>
10
+ <p>Ce document est distribué selon les termes et conditions de la licence Creative Commons Attribution 4.0 International (<link target="http://creativecommons.org/licenses/by/4.0/"/>), qui permet l’utilisation sans restriction, la distribution et la reproduction sur quelque support que soit, sous réserve de mentionner dûment l’auteur ou les auteurs originaux ainsi que la source de l’œuvre, d’intégrer un lien vers la licence Creative Commons et d’indiquer si des modifications ont été effectuées.</p>
11
11
  </clause>
12
12
  </license-statement>
13
13
  <feedback-statement>
14
14
  <p>BIPM<br/>
15
15
  Pavillon de Breteuil<br/>
16
- F-92312 Sèvres<br/>
17
- Cedex<br/>
16
+ F-92312 Sèvres Cedex<br/>
18
17
  FRANCE</p>
19
18
  </feedback-statement>
20
19
  </boilerplate>
@@ -10,6 +10,18 @@ module Asciidoctor
10
10
  Metanorma::BIPM.configuration
11
11
  end
12
12
 
13
+ def org_name_long
14
+ configuration.organization_name_long[@lang]
15
+ end
16
+
17
+ def default_publisher
18
+ org_name_long
19
+ end
20
+
21
+ def org_abbrev
22
+ { org_name_long => configuration.organization_name_short }
23
+ end
24
+
13
25
  def metadata_committee(node, xml)
14
26
  return unless node.attr("committee-en") || node.attr("committee-fr")
15
27
  xml.editorialgroup do |a|
@@ -32,10 +44,8 @@ module Asciidoctor
32
44
  i = 2
33
45
  while node.attr("committee-en_#{i}") || node.attr("committee-fr_#{i}") do
34
46
  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"
47
+ e = node.attr("committee-en_#{i}") and c.variant e, language: "en", script: "Latn"
48
+ e = node.attr("committee-fr_#{i}") and c.variant e, language: "fr", script: "Latn"
39
49
  end
40
50
  i += 1
41
51
  end
@@ -97,8 +107,9 @@ module Asciidoctor
97
107
  t1 << Asciidoctor::Standoc::Utils::asciidoc_sub(
98
108
  node.attr("title-#{lang}"))
99
109
  end
100
- typed_title(node, xml, lang, "cover")
101
- typed_title(node, xml, lang, "appendix")
110
+ %w(cover appendix annex part subpart).each do |w|
111
+ typed_title(node, xml, lang, w)
112
+ end
102
113
  end
103
114
  end
104
115
 
@@ -119,11 +130,15 @@ module Asciidoctor
119
130
  end
120
131
 
121
132
  def inline_anchor_xref_attrs(node)
122
- if /pagenumber%/.match(node.text)
123
- node.text = node.text.sub(/pagenumber%/, "")
124
- page = true
133
+ flags = %w(pagenumber nosee nopage).each_with_object({}) do |w, m|
134
+ if /#{w}%/.match(node.text)
135
+ node.text = node.text.sub(/#{w}%/, "")
136
+ m[w] = true
137
+ end
125
138
  end
126
- page ? super.merge(pagenumber: true) : super
139
+ ret = super
140
+ flags.keys.each { |k| ret[k.to_sym] = true }
141
+ ret
127
142
  end
128
143
 
129
144
  def clause_parse(attrs, xml, node)
@@ -137,7 +152,30 @@ module Asciidoctor
137
152
  end
138
153
 
139
154
  def ol_attrs(node)
140
- super.merge(start: node.attr("start"))
155
+ super.merge(attr_code(start: node.attr("start")))
156
+ end
157
+
158
+ def section_names_terms_cleanup(x)
159
+ end
160
+
161
+ def committee_validate(xml)
162
+ committees = Array(configuration&.committees) || return
163
+ committees.empty? and return
164
+ xml.xpath("//bibdata/ext/editorialgroup/committee/variant").each do |c|
165
+ committees.include? c.text or
166
+ @log.add("Document Attributes", nil,
167
+ "#{c.text} is not a recognised committee")
168
+ end
169
+ xml.xpath("//bibdata/ext/editorialgroup/committee/@acronym").each do |c|
170
+ committees.include? c.text or
171
+ @log.add("Document Attributes", nil,
172
+ "#{c.text} is not a recognised committee")
173
+ end
174
+ end
175
+
176
+ def mathml_mi_italics
177
+ { uppergreek: false, upperroman: false,
178
+ lowergreek: false, lowerroman: true }
141
179
  end
142
180
 
143
181
  def outputs(node, ret)