relaton-bipm 1.13.2 → 1.13.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +22 -0
- data/README.adoc +1 -0
- data/lib/relaton_bipm/bipm_bibliography.rb +23 -14
- data/lib/relaton_bipm/data_fetcher.rb +3 -2
- data/lib/relaton_bipm/version.rb +1 -1
- data/lib/relaton_bipm/xml_parser.rb +12 -12
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f3d34a19f9952368e46e0287dc3121b14b2bf2524613caa67e8810b17c0ad44
|
4
|
+
data.tar.gz: 024e1fa96b0082b61bc80ddd49fe9e2d906607d538badbb8df5a4e58c5603236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8948a30ac51fbc1626ad445ffba402a781b7fe931ea0305ed50b1cd82b4d807ed6cfe4cbbbdd28cd133284e14ea5e616cb66160cbef251690b9f657181cc175a
|
7
|
+
data.tar.gz: efad783da2ee6f69c42384b7d1b2c198783ddb44e19a95547a6a3d4574bca0af87bb545c130f3835e8fd36e603112fa6ae79c0fb30dd9b3ae36bbf98ba136dbb
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Auto-generated by Cimas: Do not edit it manually!
|
2
|
+
# See https://github.com/metanorma/cimas
|
3
|
+
name: release
|
4
|
+
|
5
|
+
on:
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
next_version:
|
9
|
+
description: |
|
10
|
+
Next release version. Possible values: x.y.z, major, minor, patch or pre|rc|etc
|
11
|
+
required: true
|
12
|
+
default: 'skip'
|
13
|
+
push:
|
14
|
+
tags: [ v* ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
release:
|
18
|
+
uses: relaton/support/.github/workflows/release.yml@master
|
19
|
+
with:
|
20
|
+
next_version: ${{ github.event.inputs.next_version }}
|
21
|
+
secrets:
|
22
|
+
rubygems-api-key: ${{ secrets.RELATON_CI_RUBYGEMS_API_KEY }}
|
data/README.adoc
CHANGED
@@ -239,7 +239,7 @@ module RelatonBipm
|
|
239
239
|
# @param ish [String]
|
240
240
|
# @param agent [Mechanize]
|
241
241
|
# @return [RelatonBipm::BipmBibliographicItem]
|
242
|
-
def get_article(path, vol, ish, agent) # rubocop:disable Metrics/AbcSize
|
242
|
+
def get_article(path, vol, ish, agent) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
243
243
|
rsp = agent.get path
|
244
244
|
check_response rsp
|
245
245
|
url = rsp.uri
|
@@ -247,16 +247,19 @@ module RelatonBipm
|
|
247
247
|
rsp = agent.get bib
|
248
248
|
check_response rsp
|
249
249
|
bt = BibTeX.parse(rsp.body).first
|
250
|
-
bibitem(
|
251
|
-
|
252
|
-
|
250
|
+
bibitem(
|
251
|
+
docid: btdocid(bt), title: titles(bt.title.to_s), date: btdate(bt),
|
252
|
+
abstract: btabstract(bt), doctype: bt.type.to_s, series: series,
|
253
|
+
link: btlink(bt, url), contributor: btcontrib(bt),
|
254
|
+
extent: btextent(vol, ish, bt.pages.to_s)
|
255
|
+
)
|
253
256
|
end
|
254
257
|
|
255
258
|
# @param args [Hash]
|
256
259
|
# @return [RelatonBipm::BipmBibliographicItem]
|
257
260
|
def bibitem(**args)
|
258
261
|
BipmBibliographicItem.new(
|
259
|
-
fetched: Date.today.to_s, type: "
|
262
|
+
fetched: Date.today.to_s, type: "article", language: ["en"], script: ["Latn"], **args,
|
260
263
|
)
|
261
264
|
end
|
262
265
|
|
@@ -269,7 +272,10 @@ module RelatonBipm
|
|
269
272
|
# @return [Array<RelatonBib::DocumentIdentifier>]
|
270
273
|
def btdocid(bibtex)
|
271
274
|
id = "#{bibtex.journal} #{bibtex.volume} #{bibtex.number} #{bibtex.pages.match(/^\d+/)}"
|
272
|
-
[
|
275
|
+
[
|
276
|
+
RelatonBib::DocumentIdentifier.new(type: "BIPM", id: id, primary: true),
|
277
|
+
RelatonBib::DocumentIdentifier.new(type: "DOI", id: bibtex.doi),
|
278
|
+
]
|
273
279
|
end
|
274
280
|
|
275
281
|
# @param bibtex [BibTeX::Entry]
|
@@ -309,14 +315,17 @@ module RelatonBipm
|
|
309
315
|
]
|
310
316
|
end
|
311
317
|
|
312
|
-
#
|
313
|
-
# @param
|
314
|
-
# @param
|
318
|
+
#
|
319
|
+
# @param vol [String] volume
|
320
|
+
# @param ish [String] issue
|
321
|
+
# @param pgs [String] pages
|
322
|
+
#
|
315
323
|
# @return [Array<RelatonBib::BibItemLocality>]
|
316
|
-
|
317
|
-
|
318
|
-
ext
|
319
|
-
ext << RelatonBib::
|
324
|
+
#
|
325
|
+
def btextent(vol, ish = nil, pgs = nil)
|
326
|
+
ext = [RelatonBib::Locality.new("volume", vol)]
|
327
|
+
ext << RelatonBib::Locality.new("issue", ish) if ish
|
328
|
+
ext << RelatonBib::Locality.new("page", *pgs.split("--")) if pgs
|
320
329
|
ext
|
321
330
|
end
|
322
331
|
|
@@ -342,7 +351,7 @@ module RelatonBipm
|
|
342
351
|
if rsp.code == "302"
|
343
352
|
warn "[relaton-bipm] This source employs anti-DDoS measures that unfortunately affects automated requests."
|
344
353
|
warn "[relaton-bipm] Please visit this link in your browser to resolve the CAPTCHA, then retry: #{rsp.uri}"
|
345
|
-
warn "[relaton-bipm] #{rsp.uri} is redirected to #{rsp.header['location']}"
|
354
|
+
# warn "[relaton-bipm] #{rsp.uri} is redirected to #{rsp.header['location']}"
|
346
355
|
raise RelatonBib::RequestError, "cannot access #{rsp.uri}"
|
347
356
|
elsif rsp.code != "200"
|
348
357
|
warn "[read_bipm] can't acces #{rsp.uri} #{rsp.code}"
|
@@ -218,7 +218,7 @@ module RelatonBipm
|
|
218
218
|
#
|
219
219
|
def fetch_resolution(**args) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
220
220
|
args[:en]["resolutions"].each.with_index do |r, i| # rubocop:disable Metrics/BlockLength
|
221
|
-
hash = { fetched: Date.today.to_s, title: [], doctype: r["type"] }
|
221
|
+
hash = { type: "proceedings", fetched: Date.today.to_s, title: [], doctype: r["type"] }
|
222
222
|
hash[:title] << title(r["title"], "en") if r["title"]
|
223
223
|
fr_resolution = args[:fr]["resolutions"].fetch(i, nil)
|
224
224
|
if fr_resolution
|
@@ -300,7 +300,8 @@ module RelatonBipm
|
|
300
300
|
# @return [Hash] Hash of BIPM meeting/resolution
|
301
301
|
#
|
302
302
|
def bibitem(**args) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
303
|
-
hash = { title: [], doctype: args[:type],
|
303
|
+
hash = { title: [], type: "proceedings", doctype: args[:type],
|
304
|
+
fetched: Date.today.to_s }
|
304
305
|
hash[:title] << title(args[:en]["title"], "en") if args[:en]["title"]
|
305
306
|
hash[:title] << title(args[:fr]["title"], "fr") if args[:fr]["title"]
|
306
307
|
hash[:date] = [{ type: "published", on: args[:en]["date"] }]
|
data/lib/relaton_bipm/version.rb
CHANGED
@@ -23,18 +23,18 @@ module RelatonBipm
|
|
23
23
|
BipmBibliographicItem.new(**item_hash)
|
24
24
|
end
|
25
25
|
|
26
|
-
def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
end
|
26
|
+
# def fetch_dates(item) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
27
|
+
# item.xpath("./date").reduce([]) do |a, d|
|
28
|
+
# type = d[:type].to_s.empty? ? "published" : d[:type]
|
29
|
+
# if (on = d.at("on"))
|
30
|
+
# a << BibliographicDate.new(type: type, on: on.text,
|
31
|
+
# to: d.at("to")&.text)
|
32
|
+
# elsif (from = d.at("from"))
|
33
|
+
# a << BibliographicDate.new(type: type, from: from.text,
|
34
|
+
# to: d.at("to")&.text)
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
# end
|
38
38
|
|
39
39
|
# @param item [Nokogiri::XML::Element]
|
40
40
|
# @param klass [RelatonBipm::DocumentRelation.class]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bipm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.13.
|
4
|
+
version: 1.13.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|
@@ -187,6 +187,7 @@ extensions: []
|
|
187
187
|
extra_rdoc_files: []
|
188
188
|
files:
|
189
189
|
- ".github/workflows/rake.yml"
|
190
|
+
- ".github/workflows/release.yml"
|
190
191
|
- ".gitignore"
|
191
192
|
- ".rspec"
|
192
193
|
- ".rubocop.yml"
|