relaton-bipm 1.5.0 → 1.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68cfd5dced834d94c0bdaf55fc7593e4b5174dbe8b08404489cb2060d73cd9ce
4
- data.tar.gz: 2402fa8b93b5234bb9b25804803791c498233b6cdffc0ab9bce00462e901ef5c
3
+ metadata.gz: d4c652a640cdcb04816ae94cdd687b3f083cce7d93f8f9991b5175e4df8f12ef
4
+ data.tar.gz: 77eeadcdb4ac0a15b5ded03d25ee8c9c0fff368750bbedf228d97f2679db3a39
5
5
  SHA512:
6
- metadata.gz: 5a18546b6f0e83bcd2b17806564d9652ddc629800f78c048dbf2e4c39926be30954833cfdb849bf2f4eda277f9eddc796c06e3614e29c32fa03914afc54f6122
7
- data.tar.gz: 7b5f50e5a49fb041a74d3581fa22362bc3851515afb2c28e5a83a25d238f3a5ec33e0241313c4f143bcbea968b6146af143a9b2e14ba88c853c692ed7f5f0efc
6
+ metadata.gz: e3f6946a1f5896f90bb56dcbf79566a96c54ed1c5dce313995d6ab7de4de9875c7ff6458f8a7b53c810273d59fb4684ab8e1e789a974cbebe59704793ee8b6aa
7
+ data.tar.gz: e93576e6162aed338841e7c6ddbef08283616168e595218371dd2d842cfd154b73c0eb13d6f7d670676f956271c9beaf5f1def8ffdaa947fd5e86fbf78cf96df
@@ -0,0 +1,46 @@
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, main ]
8
+ tags: [ v* ]
9
+ pull_request:
10
+
11
+ jobs:
12
+ rake:
13
+ name: Test on Ruby ${{ matrix.ruby }} ${{ matrix.os }}
14
+ runs-on: ${{ matrix.os }}
15
+ continue-on-error: ${{ matrix.experimental }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: [ '2.7', '2.6', '2.5', '2.4' ]
20
+ os: [ ubuntu-latest, windows-latest, macos-latest ]
21
+ experimental: [ false ]
22
+ include:
23
+ - ruby: '3.0'
24
+ os: 'ubuntu-latest'
25
+ experimental: true
26
+ - ruby: '3.0'
27
+ os: 'windows-latest'
28
+ experimental: true
29
+ - ruby: '3.0'
30
+ os: 'macos-latest'
31
+ experimental: true
32
+ steps:
33
+ - uses: actions/checkout@v2
34
+ with:
35
+ submodules: true
36
+
37
+ # https://github.com/ruby-debug/debase/issues/89#issuecomment-686827382
38
+ - if: matrix.os == 'macos-latest' && matrix.ruby == '2.5'
39
+ run: echo BUNDLE_BUILD__DEBASE="--with-cflags=\"-Wno-error=implicit-function-declaration\"" >> $GITHUB_ENV
40
+
41
+ - uses: ruby/setup-ruby@v1
42
+ with:
43
+ ruby-version: ${{ matrix.ruby }}
44
+ bundler-cache: true
45
+
46
+ - run: bundle exec rake
data/README.adoc ADDED
@@ -0,0 +1,153 @@
1
+ = RelatonBipm: retrieve BIPM Standards for bibliographic use using the BibliographicItem model
2
+
3
+ image:https://img.shields.io/gem/v/relaton-bipm.svg["Gem Version", link="https://rubygems.org/gems/relaton-bipm"]
4
+ image:https://github.com/relaton/relaton-bipm/workflows/macos/badge.svg["Build Status (macOS)", link="https://github.com/relaton/relaton-bipm/actions?workflow=macos"]
5
+ image:https://github.com/relaton/relaton-bipm/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bipm/actions?workflow=windows"]
6
+ image:https://github.com/relaton/relaton-bipm/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bipm/actions?workflow=ubuntu"]
7
+ image:https://codeclimate.com/github/relaton/relaton-bipm/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bipm"]
8
+ image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bipm.svg["Pull Requests", link="https://github.com/relaton/relaton-bipm/pulls"]
9
+ image:https://img.shields.io/github/commits-since/relaton/relaton-bipm/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bipm/releases"]
10
+
11
+ RelatonIec is a Ruby gem that implements the https://github.com/metanorma/metanorma-model-iso#iso-bibliographic-item[IsoBibliographicItem model].
12
+
13
+ You can use it to retrieve metadata of BIPM Standards from https://www.bipm.org, and access such metadata through the `BipmBibliographicItem` object.
14
+
15
+ == Installation
16
+
17
+ Add this line to your application's Gemfile:
18
+
19
+ [source,ruby]
20
+ ----
21
+ gem 'relaton-bipm'
22
+ ----
23
+
24
+ And then execute:
25
+
26
+ $ bundle install
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install relaton-bipm
31
+
32
+ == Usage
33
+
34
+ === Search for a standard using keywords
35
+
36
+ [source,ruby]
37
+ ----
38
+ require 'relaton_bipm'
39
+ => true
40
+
41
+ # get BIPM brochure
42
+ item = RelatonBipm::BipmBibliography.get "BIPM si-brochure"
43
+ [relaton-bipm] ("BIPM si-brochure") fetching...
44
+ [relaton-bipm] ("BIPM si-brochure") found si-brochure
45
+ => #<RelatonBipm::BipmBibliographicItem:0x007ffb83982fe8
46
+ ...
47
+
48
+ # get BIPM Metrologia article
49
+ RelatonBipm::BipmBibliography.get "BIPM Metrologia 29 6 373"
50
+ [relaton-bipm] ("BIPM Metrologia 29 6 373") fetching...
51
+ [relaton-bipm] ("BIPM Metrologia 29 6 373") found Metrologia 29 6 373
52
+ => #<RelatonBipm::BipmBibliographicItem:0x007f8857f94d40
53
+ ...
54
+ ----
55
+
56
+ === XML serialization
57
+
58
+ [source,ruby]
59
+ ----
60
+ item.to_xml
61
+ => "<bibitem id="si-brochure" type="standard">
62
+ <fetched>2021-01-10</fetched>
63
+ <title format="text/plain" language="en" script="Latn">The International System of Units (SI)</title>
64
+ <title format="text/plain" language="fr" script="Latn">Le Système international d’unités (SI)</title>
65
+ <docidentifier type="BIPM">si-brochure</docidentifier>
66
+ <date type="updated">
67
+ <on>2019-05-20</on>
68
+ </date>
69
+ <edition>9</edition>
70
+ <abstract format="text/plain" language="en" script="Latn">The BIPM and the Metre Convention</abstract>
71
+ <abstract format="text/plain" language="fr" script="Latn">Le BIPM et la Convention du Mètre</abstract>
72
+ <copyright>
73
+ <from>2019</from>
74
+ <owner>
75
+ <organization>
76
+ <name>Bureau International des ponds et mesures</name>
77
+ <abbreviation>BIPM</abbreviation>
78
+ </organization>
79
+ </owner>
80
+ </copyright>
81
+ </bibitem>"
82
+ ----
83
+
84
+ With argument `bibdata: true` it ouputs XML wrapped by `bibdata` element and adds flavour `ext` element.
85
+
86
+ [source,ruby]
87
+ ----
88
+ item.to_xml bibdata: true
89
+ => "<bibdata type="standard">
90
+ <fetched>2021-01-10</fetched>
91
+ <title format="text/plain" language="en" script="Latn">The International System of Units (SI)</title>
92
+ <title format="text/plain" language="fr" script="Latn">Le Système international d’unités (SI)</title>
93
+ <docidentifier type="BIPM">si-brochure</docidentifier>
94
+ <date type="updated">
95
+ <on>2019-05-20</on>
96
+ </date>
97
+ <edition>9</edition>
98
+ <abstract format="text/plain" language="en" script="Latn">The BIPM and the Metre Convention</abstract>
99
+ <abstract format="text/plain" language="fr" script="Latn">Le BIPM et la Convention du Mètre</abstract>
100
+ <copyright>
101
+ <from>2019</from>
102
+ <owner>
103
+ <organization>
104
+ <name>Bureau International des ponds et mesures</name>
105
+ <abbreviation>BIPM</abbreviation>
106
+ </organization>
107
+ </owner>
108
+ </copyright>
109
+ <ext>
110
+ <doctype>brochure</doctype>
111
+ </ext>
112
+ </bibdata>"
113
+ ----
114
+
115
+ === Create bibliographic item from XML
116
+
117
+ [source,ruby]
118
+ ----
119
+ RelatonBipm::XMLParser.from_xml File.read('spec/fixtures/bipm_item.xml')
120
+ => #<RelatonBipm::BipmBibliographicItem:0x007ffb83827a90
121
+ ...
122
+ ----
123
+
124
+ === Create bibliographic item from YAML
125
+ [source,ruby]
126
+ ----
127
+ hash = YAML.load_file 'spec/fixtures/bipm_item.yml'
128
+ => {"id"=>"Draft-Agenda-NMI-Dir-Meeting-2017-v10",
129
+ ...
130
+
131
+ bib_hash = RelatonBipm::HashConverter.hash_to_bib hash
132
+ => {:id=>"Draft-Agenda-NMI-Dir-Meeting-2017-v10",
133
+ ...
134
+
135
+ RelatonBipm::BipmBibliographicItem.new bib_hash
136
+ => #<RelatonBipm::BipmBibliographicItem:0x007ffb668755a0
137
+ ...
138
+ ----
139
+
140
+ == Development
141
+
142
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
143
+
144
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
145
+
146
+ == Contributing
147
+
148
+ Bug reports and pull requests are welcome on GitHub at https://github.com/relaton/relaton-bipm.
149
+
150
+
151
+ == License
152
+
153
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/grammars/bipm.rng CHANGED
@@ -42,9 +42,158 @@
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>
45
50
  <text/>
46
51
  </element>
47
52
  </define>
53
+ <define name="Clause-Section">
54
+ <optional>
55
+ <attribute name="id">
56
+ <data type="ID"/>
57
+ </attribute>
58
+ </optional>
59
+ <optional>
60
+ <attribute name="language"/>
61
+ </optional>
62
+ <optional>
63
+ <attribute name="script"/>
64
+ </optional>
65
+ <optional>
66
+ <attribute name="inline-header">
67
+ <data type="boolean"/>
68
+ </attribute>
69
+ </optional>
70
+ <optional>
71
+ <attribute name="obligation">
72
+ <choice>
73
+ <value>normative</value>
74
+ <value>informative</value>
75
+ </choice>
76
+ </attribute>
77
+ </optional>
78
+ <optional>
79
+ <attribute name="type"/>
80
+ </optional>
81
+ <optional>
82
+ <attribute name="unnumbered">
83
+ <data type="boolean"/>
84
+ </attribute>
85
+ </optional>
86
+ <optional>
87
+ <ref name="section-title"/>
88
+ </optional>
89
+ <group>
90
+ <choice>
91
+ <group>
92
+ <zeroOrMore>
93
+ <ref name="BasicBlock"/>
94
+ </zeroOrMore>
95
+ <zeroOrMore>
96
+ <ref name="note"/>
97
+ </zeroOrMore>
98
+ </group>
99
+ <ref name="amend"/>
100
+ </choice>
101
+ <zeroOrMore>
102
+ <choice>
103
+ <ref name="clause-subsection"/>
104
+ <ref name="terms"/>
105
+ <ref name="definitions"/>
106
+ </choice>
107
+ </zeroOrMore>
108
+ </group>
109
+ </define>
110
+ <define name="Annex-Section">
111
+ <optional>
112
+ <attribute name="id">
113
+ <data type="ID"/>
114
+ </attribute>
115
+ </optional>
116
+ <optional>
117
+ <attribute name="language"/>
118
+ </optional>
119
+ <optional>
120
+ <attribute name="script"/>
121
+ </optional>
122
+ <optional>
123
+ <attribute name="inline-header">
124
+ <data type="boolean"/>
125
+ </attribute>
126
+ </optional>
127
+ <optional>
128
+ <attribute name="obligation">
129
+ <choice>
130
+ <value>normative</value>
131
+ <value>informative</value>
132
+ </choice>
133
+ </attribute>
134
+ </optional>
135
+ <optional>
136
+ <attribute name="unnumbered">
137
+ <data type="boolean"/>
138
+ </attribute>
139
+ </optional>
140
+ <optional>
141
+ <ref name="section-title"/>
142
+ </optional>
143
+ <group>
144
+ <group>
145
+ <zeroOrMore>
146
+ <ref name="BasicBlock"/>
147
+ </zeroOrMore>
148
+ <zeroOrMore>
149
+ <ref name="note"/>
150
+ </zeroOrMore>
151
+ </group>
152
+ <zeroOrMore>
153
+ <choice>
154
+ <ref name="annex-subsection"/>
155
+ <ref name="terms"/>
156
+ <ref name="definitions"/>
157
+ <ref name="references"/>
158
+ </choice>
159
+ </zeroOrMore>
160
+ </group>
161
+ </define>
162
+ <define name="ol">
163
+ <element name="ol">
164
+ <attribute name="id">
165
+ <data type="ID"/>
166
+ </attribute>
167
+ <optional>
168
+ <attribute name="keep-with-next">
169
+ <data type="boolean"/>
170
+ </attribute>
171
+ </optional>
172
+ <optional>
173
+ <attribute name="keep-lines-together">
174
+ <data type="boolean"/>
175
+ </attribute>
176
+ </optional>
177
+ <attribute name="type">
178
+ <choice>
179
+ <value>roman</value>
180
+ <value>alphabet</value>
181
+ <value>arabic</value>
182
+ <value>roman_upper</value>
183
+ <value>alphabet_upper</value>
184
+ </choice>
185
+ </attribute>
186
+ <optional>
187
+ <attribute name="start"/>
188
+ </optional>
189
+ <oneOrMore>
190
+ <ref name="li"/>
191
+ </oneOrMore>
192
+ <zeroOrMore>
193
+ <ref name="note"/>
194
+ </zeroOrMore>
195
+ </element>
196
+ </define>
48
197
  <define name="DocumentType">
49
198
  <choice>
50
199
  <value>brochure</value>
@@ -65,9 +214,9 @@
65
214
  <oneOrMore>
66
215
  <ref name="committee"/>
67
216
  </oneOrMore>
68
- <oneOrMore>
217
+ <zeroOrMore>
69
218
  <ref name="workgroup"/>
70
- </oneOrMore>
219
+ </zeroOrMore>
71
220
  </element>
72
221
  </define>
73
222
  <define name="structuredidentifier">
@@ -98,6 +247,9 @@
98
247
  <optional>
99
248
  <ref name="si-aspect"/>
100
249
  </optional>
250
+ <optional>
251
+ <ref name="meeting-note"/>
252
+ </optional>
101
253
  <ref name="structuredidentifier"/>
102
254
  </define>
103
255
  </include>
@@ -132,30 +284,41 @@
132
284
  </define>
133
285
  <define name="committee">
134
286
  <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>
287
+ <attribute name="acronym">
288
+ <choice>
289
+ <value>CGPM</value>
290
+ <value>CIPM</value>
291
+ <value>BIPM</value>
292
+ <value>CCAUV</value>
293
+ <value>CCEM</value>
294
+ <value>CCL</value>
295
+ <value>CCM</value>
296
+ <value>CCPR</value>
297
+ <value>CCQM</value>
298
+ <value>CCRI</value>
299
+ <value>CCT</value>
300
+ <value>CCTF</value>
301
+ <value>CCU</value>
302
+ <value>CCL-CCTF</value>
303
+ <value>JCGM</value>
304
+ <value>JCRB</value>
305
+ <value>JCTLM</value>
306
+ <value>INetQI</value>
307
+ </choice>
308
+ </attribute>
309
+ <ref name="LocalizedString"/>
155
310
  </element>
156
311
  </define>
157
312
  <define name="workgroup">
158
313
  <element name="workgroup">
314
+ <optional>
315
+ <attribute name="acronym"/>
316
+ </optional>
317
+ <text/>
318
+ </element>
319
+ </define>
320
+ <define name="meeting-note">
321
+ <element name="meeting-note">
159
322
  <text/>
160
323
  </element>
161
324
  </define>
@@ -182,7 +345,9 @@
182
345
  <zeroOrMore>
183
346
  <ref name="annex"/>
184
347
  </zeroOrMore>
185
- <ref name="bibliography"/>
348
+ <optional>
349
+ <ref name="bibliography"/>
350
+ </optional>
186
351
  </element>
187
352
  </define>
188
353
  </grammar>