identifiers 0.12.0 → 0.12.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 +4 -4
- data/CHANGELOG.md +8 -2
- data/lib/identifiers/doi.rb +1 -1
- data/lib/identifiers/isbn.rb +4 -4
- data/spec/identifiers/isbn_spec.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 423438daad2350706eced26425401a5d97ae715095b54853fe55ba4f8dbbaf2d
|
4
|
+
data.tar.gz: 2776accbdccfc17965dd69507a0b326b2a57e275811828b05e76b47c0f54bb28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e319511db960df762b3a646239edf45ff683bef6227736c673072de6ef5d1649dd300232f93c0af0be1d7744308de4f07ebfd53582add6069c6b3f425249722b
|
7
|
+
data.tar.gz: 1ebd31499facbc5a51ec0dcf30fadb920e86ad6e53c20f4bb5dd66fa11c9f9cc7842a8b703348f13aac2675c0415c2c0f9464c42baafd055669c881342c33217
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,17 @@
|
|
2
2
|
All notable changes to this project will be documented in this file. This
|
3
3
|
project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.12.1] - 2018-04-09
|
6
|
+
### Fixed
|
7
|
+
- Restored support for extracting hyphenated ISBN-10s with registration group
|
8
|
+
identifiers longer than one digit
|
9
|
+
|
5
10
|
## [0.12.0] - 2018-04-06
|
6
11
|
### Added
|
7
12
|
- Added support for extracting more old Wiley DOIs
|
8
13
|
|
9
14
|
### Changed
|
10
|
-
- Performance improvements when extracting DOIs with trailing punctuation
|
15
|
+
- Performance improvements when extracting DOIs with trailing punctuation
|
11
16
|
|
12
17
|
## [0.11.0] - 2018-03-12
|
13
18
|
### Fixed
|
@@ -61,7 +66,7 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
|
61
66
|
|
62
67
|
## [0.2.0] - 2016-11-01
|
63
68
|
### Changed
|
64
|
-
- Strip leading 0s from Pubmed IDs. 0 is no longer a valid Pubmed ID
|
69
|
+
- Strip leading 0s from Pubmed IDs. 0 is no longer a valid Pubmed ID
|
65
70
|
|
66
71
|
## [0.1.0] - 2016-10-21
|
67
72
|
### Added
|
@@ -82,3 +87,4 @@ project adheres to [Semantic Versioning](http://semver.org/).
|
|
82
87
|
[0.10.0]: https://github.com/altmetric/identifiers/releases/tag/v0.10.0
|
83
88
|
[0.11.0]: https://github.com/altmetric/identifiers/releases/tag/v0.11.0
|
84
89
|
[0.12.0]: https://github.com/altmetric/identifiers/releases/tag/v0.12.0
|
90
|
+
[0.12.1]: https://github.com/altmetric/identifiers/releases/tag/v0.12.1
|
data/lib/identifiers/doi.rb
CHANGED
@@ -20,7 +20,7 @@ module Identifiers
|
|
20
20
|
|
|
21
21
|
[^[:space:]]+ # Suffix...
|
22
22
|
\([^[:space:])]+\) # Ending in balanced parentheses...
|
23
|
-
(?![^[:space:]\p{P}]) # Not followed by more suffix
|
23
|
+
(?![^[:space:]\p{P}]) # Not followed by more suffix
|
24
24
|
|
|
25
25
|
[^[:space:]]+(?![[:space:]])\p{^P} # Suffix ending in non-punctuation
|
26
26
|
)
|
data/lib/identifiers/isbn.rb
CHANGED
@@ -20,12 +20,12 @@ module Identifiers
|
|
20
20
|
)
|
21
21
|
\b
|
22
22
|
(
|
23
|
-
\d
|
23
|
+
\d{1,5} # Registration group identifier
|
24
24
|
([\p{Pd}\p{Zs}])? # Optional hyphenation
|
25
25
|
(?:
|
26
26
|
\d # Digit
|
27
27
|
\2? # Optional hyphenation
|
28
|
-
){8}
|
28
|
+
){4,8}
|
29
29
|
[\dX] # Check digit
|
30
30
|
)
|
31
31
|
\b
|
@@ -85,7 +85,7 @@ module Identifiers
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def self.valid_isbn_13?(isbn)
|
88
|
-
return false unless isbn =~ ISBN_13_REGEXP
|
88
|
+
return false unless String(isbn).length == 13 && isbn =~ ISBN_13_REGEXP
|
89
89
|
|
90
90
|
result = digits_of(isbn).zip([1, 3].cycle).map { |digit, weight| digit * weight }.reduce(:+)
|
91
91
|
|
@@ -93,7 +93,7 @@ module Identifiers
|
|
93
93
|
end
|
94
94
|
|
95
95
|
def self.valid_isbn_10?(isbn)
|
96
|
-
return false unless isbn =~ ISBN_10_REGEXP
|
96
|
+
return false unless String(isbn).length == 10 && isbn =~ ISBN_10_REGEXP
|
97
97
|
|
98
98
|
result = digits_of(isbn).with_index.map { |digit, weight| digit * weight.succ }.reduce(:+)
|
99
99
|
|
@@ -118,4 +118,9 @@ RSpec.describe Identifiers::ISBN do
|
|
118
118
|
it 'does not extract ISBN-10s if they have less than four groups' do
|
119
119
|
expect(described_class.extract('0-80506909-7')).to be_empty
|
120
120
|
end
|
121
|
+
|
122
|
+
it 'extracts ISBN-10s with variable width registration group identifiers' do
|
123
|
+
expect(described_class.extract('99921-58-10-7 9971-5-0210-0 960-425-059-0 80-902734-1-6'))
|
124
|
+
.to contain_exactly('9789992158104', '9789971502102', '9789604250592', '9788090273412')
|
125
|
+
end
|
121
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identifiers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Hernandez
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: urn
|