relaton-bib 1.9.13 → 1.9.17
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ded29b18d5885c94c52574e378097809e1b26c450dd499ffe7ff8dee9448aa54
|
4
|
+
data.tar.gz: 856de0f36ac5cdc36d382e2b7ea5452bf0ea1ed8c6ba36078354c8442d28c5ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b293a0d4e1033e0beceb5d15120711a3725d81eb999cc63f3fdb75a751e75b24ba28b5b87b357ca2434bb4c39cf2ce4d73fe26bb2453d249cfa71a5a510405f1
|
7
|
+
data.tar.gz: 514b6dea9c2d98b34ba6a0b2ef574283619feeb198adc4b748b8bd3a818635870fc12ad478738a5120e55d22dc60c0f22702a1c1cf92ecb5fef023a6f9b38f74
|
@@ -81,7 +81,12 @@ module RelatonBib
|
|
81
81
|
id = reference["anchor"] || reference["docName"] || reference["number"]
|
82
82
|
type_match = id&.match(/^(3GPP|W3C|[A-Z]{2,})(?:\.(?=[A-Z])|(?=\d))/)
|
83
83
|
type = self::FLAVOR || (type_match && type_match[1])
|
84
|
-
|
84
|
+
if id
|
85
|
+
/^(?<pref>I-D|3GPP|W3C|[A-Z]{2,})[._]?(?<num>.+)/ =~ id
|
86
|
+
num.sub!(/^-?0+/, "") if %w[RFC BCP FYI STD].include?(pref)
|
87
|
+
pid = pref ? "#{pref} #{num}" : id
|
88
|
+
ret << DocumentIdentifier.new(type: type, id: pid)
|
89
|
+
end
|
85
90
|
%w[anchor docName number].each do |atr|
|
86
91
|
if reference[atr]
|
87
92
|
ret << DocumentIdentifier.new(id: reference[atr], type: type, scope: atr)
|
@@ -20,7 +20,7 @@ module RelatonBib
|
|
20
20
|
def remove_part
|
21
21
|
case @type
|
22
22
|
when "Chinese Standard" then @id.sub!(/\.\d+/, "")
|
23
|
-
when "ISO", "IEC" then @id.sub!(/-[^:]+/, "")
|
23
|
+
when "ISO", "IEC", "BSI" then @id.sub!(/-[^:]+/, "")
|
24
24
|
when "URN" then remove_urn_part
|
25
25
|
end
|
26
26
|
end
|
@@ -28,7 +28,7 @@ module RelatonBib
|
|
28
28
|
def remove_date
|
29
29
|
case @type
|
30
30
|
when "Chinese Standard" then @id.sub!(/-[12]\d\d\d/, "")
|
31
|
-
when "ISO", "IEC" then @id.sub!(/:[12]\d\d\d/, "")
|
31
|
+
when "ISO", "IEC", "BSI" then @id.sub!(/:[12]\d\d\d/, "")
|
32
32
|
when "URN"
|
33
33
|
@id.sub!(/^(urn:iec:std:[^:]+:[^:]+:)[^:]*/, '\1')
|
34
34
|
end
|
@@ -69,8 +69,8 @@ module RelatonBib
|
|
69
69
|
# @param prefix [String]
|
70
70
|
# @param count [Integer] number of docids
|
71
71
|
# @return [String]
|
72
|
-
def to_asciibib(prefix = "", count = 1)
|
73
|
-
pref = prefix.empty? ? prefix : prefix
|
72
|
+
def to_asciibib(prefix = "", count = 1) # rubocop:disable Metrics/CyclomaticComplexity
|
73
|
+
pref = prefix.empty? ? prefix : "#{prefix}."
|
74
74
|
return "#{pref}docid:: #{id}\n" unless type || scope
|
75
75
|
|
76
76
|
out = count > 1 ? "#{pref}docid::\n" : ""
|
data/lib/relaton_bib/version.rb
CHANGED
data/lib/relaton_bib.rb
CHANGED
@@ -42,10 +42,10 @@ module RelatonBib
|
|
42
42
|
# @param array [Array]
|
43
43
|
# @return [Array<String>, String]
|
44
44
|
def single_element_array(array)
|
45
|
-
if array.size > 1
|
46
|
-
|
47
|
-
else
|
48
|
-
|
49
|
-
end
|
45
|
+
# if array.size > 1
|
46
|
+
array.map { |e| e.is_a?(String) ? e : e.to_hash }
|
47
|
+
# else
|
48
|
+
# array.first.is_a?(String) ? array[0] : array.first&.to_hash
|
49
|
+
# end
|
50
50
|
end
|
51
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relaton-bib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|