gbbib 0.4.1 → 0.4.2
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/.hound.yml +3 -0
- data/.rubocop.yml +9 -4
- data/Gemfile.lock +6 -6
- data/README.adoc +4 -0
- data/lib/gbbib/gb_bibliography.rb +7 -3
- data/lib/gbbib/version.rb +1 -1
- 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: 6eac6d0000a21b3dc52113ebda470cb6be672d2088e033648e090765559f0684
|
|
4
|
+
data.tar.gz: 7fb3b022408232970d3812713d14de9f32eb8ed5c3de9cec00533effd188e5c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e640701864d9f49b65a8b2842a3e6a29d0a6f4178f6598266cc95f690f9ac022fb4329a8e727e1c86d66369a64ab1e881523e51b30b2d1555f1af25a2bb88dd1
|
|
7
|
+
data.tar.gz: 13ec0e6d6e4c15a3a3475fccf541bb3ab37027bfa1f712e544fb55d58d96e4285eb6d9fc6a6e8f972352063a3ee30b3ea6e1bfe4fa7fc5f771d647874d801b20
|
data/.hound.yml
ADDED
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# This project follows the Ribose OSS style guide.
|
|
2
|
+
# https://github.com/riboseinc/oss-guides
|
|
3
|
+
# All project-specific additions and overrides should be specified in this file.
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
inherit_from:
|
|
6
|
+
- https://raw.githubusercontent.com/riboseinc/oss-guides/master/ci/rubocop.yml
|
|
7
|
+
AllCops:
|
|
8
|
+
TargetRubyVersion: 2.3
|
|
9
|
+
Rails:
|
|
10
|
+
Enabled: true
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gbbib (0.4.
|
|
4
|
+
gbbib (0.4.2)
|
|
5
5
|
cnccs (~> 0.1.1)
|
|
6
6
|
gb-agencies (~> 0.0.1)
|
|
7
7
|
iso-bib-item (~> 0.4.2)
|
|
@@ -16,18 +16,18 @@ GEM
|
|
|
16
16
|
docile (1.3.1)
|
|
17
17
|
equivalent-xml (0.6.0)
|
|
18
18
|
nokogiri (>= 1.4.3)
|
|
19
|
-
gb-agencies (0.0.
|
|
20
|
-
iso-bib-item (0.4.
|
|
19
|
+
gb-agencies (0.0.5)
|
|
20
|
+
iso-bib-item (0.4.4)
|
|
21
21
|
isoics (~> 0.1.6)
|
|
22
22
|
nokogiri (~> 1.8.4)
|
|
23
23
|
ruby_deep_clone (~> 0.8.0)
|
|
24
24
|
isoics (0.1.7)
|
|
25
25
|
json (2.1.0)
|
|
26
|
-
method_source (0.9.
|
|
26
|
+
method_source (0.9.2)
|
|
27
27
|
mini_portile2 (2.3.0)
|
|
28
28
|
nokogiri (1.8.5)
|
|
29
29
|
mini_portile2 (~> 2.3.0)
|
|
30
|
-
pry (0.
|
|
30
|
+
pry (0.12.2)
|
|
31
31
|
coderay (~> 1.1.0)
|
|
32
32
|
method_source (~> 0.9.0)
|
|
33
33
|
pry-byebug (3.6.0)
|
|
@@ -67,4 +67,4 @@ DEPENDENCIES
|
|
|
67
67
|
simplecov
|
|
68
68
|
|
|
69
69
|
BUNDLED WITH
|
|
70
|
-
1.
|
|
70
|
+
1.17.1
|
data/README.adoc
CHANGED
|
@@ -12,6 +12,10 @@ The standards scraped form:
|
|
|
12
12
|
* Social organization standards - http://www.ttbz.org.cn
|
|
13
13
|
* Sector standards - http://www.std.gov.cn/hb
|
|
14
14
|
|
|
15
|
+
NOTE: Unlike the ISO website, the GB websites require the year of publication to be included in the search.
|
|
16
|
+
So a standard will not be found successfully through this gem unless the year is included in its document
|
|
17
|
+
identifier: for example, not `CN(GB/T 1.1)`, but `CN(GB/T 1.1-2009)`.
|
|
18
|
+
|
|
15
19
|
== Installation
|
|
16
20
|
|
|
17
21
|
Add this line to your application's Gemfile:
|
|
@@ -40,6 +40,7 @@ module Gbbib
|
|
|
40
40
|
# @return [String] Relaton XML serialisation of reference
|
|
41
41
|
def get(code, year, opts)
|
|
42
42
|
code += '.1' if opts[:all_parts]
|
|
43
|
+
code, year = code.split(/-/, 2) if /-/.match(code)
|
|
43
44
|
ret = get1(code, year, opts)
|
|
44
45
|
return nil if ret.nil?
|
|
45
46
|
ret.to_most_recent_reference unless year
|
|
@@ -51,7 +52,7 @@ module Gbbib
|
|
|
51
52
|
|
|
52
53
|
def fetch_ref_err(code, year, missed_years)
|
|
53
54
|
id = year ? "#{code}:#{year}" : code
|
|
54
|
-
warn "WARNING: no match found on the
|
|
55
|
+
warn "WARNING: no match found on the GB website for #{id}. "\
|
|
55
56
|
"The code must be exactly like it is on the website."
|
|
56
57
|
warn "(There was no match for #{year}, though there were matches "\
|
|
57
58
|
"found for #{missed_years.join(', ')}.)" unless missed_years.empty?
|
|
@@ -67,14 +68,17 @@ module Gbbib
|
|
|
67
68
|
end
|
|
68
69
|
|
|
69
70
|
def get1(code, year, opts)
|
|
70
|
-
|
|
71
|
+
# search must include year whenever available
|
|
72
|
+
searchcode = code + (year.nil? ? "" : "-#{year}")
|
|
73
|
+
result = search_filter(searchcode) or return nil
|
|
71
74
|
ret = results_filter(result, year)
|
|
72
75
|
return ret[:ret] if ret[:ret]
|
|
73
76
|
fetch_ref_err(code, year, ret[:years])
|
|
74
77
|
end
|
|
75
78
|
|
|
76
79
|
def search_filter(code)
|
|
77
|
-
|
|
80
|
+
# search filter needs to incorporate year
|
|
81
|
+
docidrx = %r{^[^\s]+\s[\d\.-]+}
|
|
78
82
|
# corrigrx = %r{^[^\s]+\s[\d\.]+-[0-9]+/}
|
|
79
83
|
warn "fetching #{code}..."
|
|
80
84
|
result = search(code)
|
data/lib/gbbib/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gbbib
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -145,6 +145,7 @@ extensions: []
|
|
|
145
145
|
extra_rdoc_files: []
|
|
146
146
|
files:
|
|
147
147
|
- ".gitignore"
|
|
148
|
+
- ".hound.yml"
|
|
148
149
|
- ".rspec"
|
|
149
150
|
- ".rubocop.yml"
|
|
150
151
|
- ".travis.yml"
|