relaton-bsi 1.7.pre2 → 1.8.4
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 +1 -1
- data/.rubocop.yml +1 -1
- data/README.adoc +8 -10
- data/lib/relaton_bsi.rb +1 -1
- data/lib/relaton_bsi/bsi_bibliographic_item.rb +13 -4
- data/lib/relaton_bsi/bsi_bibliography.rb +7 -10
- data/lib/relaton_bsi/processor.rb +1 -1
- data/lib/relaton_bsi/scrapper.rb +3 -2
- data/lib/relaton_bsi/version.rb +1 -1
- data/relaton_bsi.gemspec +3 -3
- metadata +12 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e0fb4166ac2e9ff1c644c4e147edf1b6535b02fc3f4304aeb2110f95ab16072
|
|
4
|
+
data.tar.gz: fa5bf3ba88c040260b41d8f47e7b5cfd8f7b32a0ab4d6f568f5d41866ece13a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 253289d6d3ec9022e168345805a1e79d0d6f48130b5d8a75fe78c33ebdf52daf57e6aa797a96d3cf2ea6f61931f8a5c465e11d3f3ad7ccfa4edd1e3655385d87
|
|
7
|
+
data.tar.gz: 289a7a93a4df4617a5c9f14a036bf99d6d46b9e4027fe1a410c0f4ee9f147d0960e0c69d821f8921beda8753b0da77bd445cc04ad2a0bedff32896374e906db2
|
data/.github/workflows/rake.yml
CHANGED
data/.rubocop.yml
CHANGED
data/README.adoc
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
= RelatonBsi retrieve BSI Standards for bibliographic use using the BibliographicItem model
|
|
2
2
|
|
|
3
3
|
image:https://img.shields.io/gem/v/relaton-bsi.svg["Gem Version", link="https://rubygems.org/gems/relaton-bsi"]
|
|
4
|
-
image:https://github.com/relaton/relaton-bsi/workflows/
|
|
5
|
-
image:https://github.com/relaton/relaton-bsi/workflows/windows/badge.svg["Build Status (Windows)", link="https://github.com/relaton/relaton-bsi/actions?workflow=windows"]
|
|
6
|
-
image:https://github.com/relaton/relaton-bsi/workflows/ubuntu/badge.svg["Build Status (Ubuntu)", link="https://github.com/relaton/relaton-bsi/actions?workflow=ubuntu"]
|
|
4
|
+
image:https://github.com/relaton/relaton-bsi/workflows/rake/badge.svg["Build Status", link="https://github.com/relaton/relaton-bsi/actions?workflow=rake"]
|
|
7
5
|
image:https://codeclimate.com/github/relaton/relaton-bsi/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/relaton/relaton-bsi"]
|
|
8
6
|
image:https://img.shields.io/github/issues-pr-raw/relaton/relaton-bsi.svg["Pull Requests", link="https://github.com/relaton/relaton-bsi/pulls"]
|
|
9
7
|
image:https://img.shields.io/github/commits-since/relaton/relaton-bsi/latest.svg["Commits since latest",link="https://github.com/relaton/relaton-bsi/releases"]
|
|
@@ -35,7 +33,7 @@ Or install it yourself as:
|
|
|
35
33
|
----
|
|
36
34
|
require 'relaton_bsi'
|
|
37
35
|
|
|
38
|
-
hit_collection = RelatonBsi::BsiBibliography.search("
|
|
36
|
+
hit_collection = RelatonBsi::BsiBibliography.search("BS EN ISO 8848")
|
|
39
37
|
=> <RelatonBsi::HitCollection:0x007fead49fe1f8 @ref=BS EN ISO 8848 @fetched=false>
|
|
40
38
|
|
|
41
39
|
item = hit_collection[1].fetch
|
|
@@ -120,15 +118,15 @@ item.to_xml bibdata: true
|
|
|
120
118
|
[source,ruby]
|
|
121
119
|
----
|
|
122
120
|
RelatonBsi::BsiBibliographicItem RelatonBsi::BsiBibliography
|
|
123
|
-
[7] pry(main)> RelatonBsi::BsiBibliography.get "
|
|
124
|
-
[relaton-bsi] ("
|
|
125
|
-
[relaton-bsi] ("
|
|
121
|
+
[7] pry(main)> RelatonBsi::BsiBibliography.get "BS EN ISO 8848:2021"
|
|
122
|
+
[relaton-bsi] ("BS EN ISO 8848:2021") fetching...
|
|
123
|
+
[relaton-bsi] ("BS EN ISO 8848:2021") found BS EN ISO 8848:2021
|
|
126
124
|
=> #<RelatonBsi::BsiBibliographicItem:0x007feb14814ca8
|
|
127
125
|
...
|
|
128
126
|
|
|
129
|
-
RelatonBsi::BsiBibliography.get "
|
|
130
|
-
[relaton-bsi] ("
|
|
131
|
-
[relaton-bsi] ("
|
|
127
|
+
RelatonBsi::BsiBibliography.get "BS EN ISO 8848", "2021"
|
|
128
|
+
[relaton-bsi] ("BS EN ISO 8848") fetching...
|
|
129
|
+
[relaton-bsi] ("BS EN ISO 8848") found BS EN ISO 8848:2021
|
|
132
130
|
=> #<RelatonBsi::BsiBibliographicItem:0x007feaf59188a8
|
|
133
131
|
...
|
|
134
132
|
----
|
data/lib/relaton_bsi.rb
CHANGED
|
@@ -27,11 +27,20 @@ module RelatonBsi
|
|
|
27
27
|
# @option opts [Boolean] :bibdata
|
|
28
28
|
# @option opts [String] :lang language
|
|
29
29
|
# @return [String] XML
|
|
30
|
-
def to_xml(**opts)
|
|
30
|
+
def to_xml(**opts) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
31
31
|
super **opts do |b|
|
|
32
|
-
if opts[:bibdata]
|
|
33
|
-
|
|
34
|
-
b.
|
|
32
|
+
if opts[:bibdata] && (has_ext_attrs? || price_code ||
|
|
33
|
+
!cen_processing.nil?)
|
|
34
|
+
b.ext do
|
|
35
|
+
b.doctype doctype if doctype
|
|
36
|
+
b.horizontal horizontal unless horizontal.nil?
|
|
37
|
+
editorialgroup&.to_xml b
|
|
38
|
+
ics.each { |i| i.to_xml b }
|
|
39
|
+
structuredidentifier&.to_xml b
|
|
40
|
+
b.stagename stagename if stagename
|
|
41
|
+
b.send "price-code", price_code if price_code
|
|
42
|
+
b.send "cen-processing", cen_processing unless cen_processing.nil?
|
|
43
|
+
end
|
|
35
44
|
end
|
|
36
45
|
end
|
|
37
46
|
end
|
|
@@ -29,15 +29,9 @@ module RelatonBsi
|
|
|
29
29
|
# @param opts [Hash] options; restricted to :all_parts if all-parts reference is required
|
|
30
30
|
# @return [String] Relaton XML serialisation of reference
|
|
31
31
|
def get(code, year = nil, opts = {}) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# code = code1
|
|
36
|
-
# year = year1
|
|
37
|
-
# end
|
|
38
|
-
# end
|
|
39
|
-
|
|
40
|
-
ret = bib_get1(code, year, opts)
|
|
32
|
+
c, y = code.split ':'
|
|
33
|
+
year ||= y
|
|
34
|
+
ret = bib_get1(c, year, opts)
|
|
41
35
|
return nil if ret.nil?
|
|
42
36
|
|
|
43
37
|
# ret = ret.to_most_recent_reference unless year || opts[:keep_year]
|
|
@@ -67,8 +61,11 @@ module RelatonBsi
|
|
|
67
61
|
end
|
|
68
62
|
|
|
69
63
|
def search_filter(code) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
|
|
70
|
-
%r{^BSI\s(?<code1>[^:]+)} =~ code
|
|
64
|
+
# %r{^BSI\s(?<code1>[^:]+)} =~ code
|
|
65
|
+
code1 = code.sub(/^BSI\s/, "")
|
|
71
66
|
warn "[relaton-bsi] (\"#{code}\") fetching..."
|
|
67
|
+
return [] unless code1
|
|
68
|
+
|
|
72
69
|
result = search(code)
|
|
73
70
|
result.select do |i|
|
|
74
71
|
next true unless i.hit[:code]
|
data/lib/relaton_bsi/scrapper.rb
CHANGED
|
@@ -36,8 +36,9 @@ module RelatonBsi
|
|
|
36
36
|
# @param doc [Mechanize::Page]
|
|
37
37
|
# @return [Array<RelatonIsobib::Ics>]
|
|
38
38
|
def fetch_ics(doc)
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
doc.xpath("//tr[th='ICS']/td/node()").map(&:text).reject { |a| a.empty? }.map do |ics|
|
|
40
|
+
RelatonIsoBib::Ics.new(ics)
|
|
41
|
+
end
|
|
41
42
|
end
|
|
42
43
|
|
|
43
44
|
# Fetch abstracts.
|
data/lib/relaton_bsi/version.rb
CHANGED
data/relaton_bsi.gemspec
CHANGED
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
|
14
14
|
"using the BibliographicItem model"
|
|
15
15
|
spec.homepage = "https://github.com/metanorma/relaton-bsi"
|
|
16
16
|
spec.license = "BSD-2-Clause"
|
|
17
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
|
17
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
|
|
18
18
|
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
|
20
20
|
spec.metadata["source_code_uri"] = spec.homepage
|
|
@@ -44,6 +44,6 @@ Gem::Specification.new do |spec|
|
|
|
44
44
|
spec.add_development_dependency "vcr", "~> 5.0.0"
|
|
45
45
|
spec.add_development_dependency "webmock"
|
|
46
46
|
|
|
47
|
-
spec.add_dependency "mechanize"
|
|
48
|
-
spec.add_dependency "relaton-iso-bib", "~> 1.
|
|
47
|
+
spec.add_dependency "mechanize", "~> 2.8.0"
|
|
48
|
+
spec.add_dependency "relaton-iso-bib", "~> 1.8.0"
|
|
49
49
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: relaton-bsi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: equivalent-xml
|
|
@@ -98,30 +98,30 @@ dependencies:
|
|
|
98
98
|
name: mechanize
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - "~>"
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version:
|
|
103
|
+
version: 2.8.0
|
|
104
104
|
type: :runtime
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version:
|
|
110
|
+
version: 2.8.0
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: relaton-iso-bib
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 1.
|
|
117
|
+
version: 1.8.0
|
|
118
118
|
type: :runtime
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 1.
|
|
124
|
+
version: 1.8.0
|
|
125
125
|
description: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem
|
|
126
126
|
model'
|
|
127
127
|
email:
|
|
@@ -172,14 +172,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
172
172
|
requirements:
|
|
173
173
|
- - ">="
|
|
174
174
|
- !ruby/object:Gem::Version
|
|
175
|
-
version: 2.
|
|
175
|
+
version: 2.5.0
|
|
176
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
177
177
|
requirements:
|
|
178
|
-
- - "
|
|
178
|
+
- - ">="
|
|
179
179
|
- !ruby/object:Gem::Version
|
|
180
|
-
version:
|
|
180
|
+
version: '0'
|
|
181
181
|
requirements: []
|
|
182
|
-
rubygems_version: 3.
|
|
182
|
+
rubygems_version: 3.2.3
|
|
183
183
|
signing_key:
|
|
184
184
|
specification_version: 4
|
|
185
185
|
summary: 'RelatonBsi: retrieve BSI Standards for bibliographic use using the BibliographicItem
|