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: 89950d6f16ecee59114ef4adeb31673bdb32584d6ba3c3ae20591b76e1c3f522
4
- data.tar.gz: c4da2965dae170674c58a3c1c8d879e23fcb5339df8db54da09ec5b6149c772e
3
+ metadata.gz: ded29b18d5885c94c52574e378097809e1b26c450dd499ffe7ff8dee9448aa54
4
+ data.tar.gz: 856de0f36ac5cdc36d382e2b7ea5452bf0ea1ed8c6ba36078354c8442d28c5ae
5
5
  SHA512:
6
- metadata.gz: 68a1d32eecd5aa1646d852ffb0074f09dfb306bf3251cac7d4983945a89f991149c3e959dae6c54ce2efe93c2dad4345230b2fa627db50b9e88fea2f34e933f0
7
- data.tar.gz: 6a69d4380d9fb2b8d3cfa0012509d56bea2de0c48672bd10f8033e5b5dc0c5f858aca650829ecdcf3aaa222f3e600bfc1e832cc61ac006448ffa4f74d6b1a034
6
+ metadata.gz: b293a0d4e1033e0beceb5d15120711a3725d81eb999cc63f3fdb75a751e75b24ba28b5b87b357ca2434bb4c39cf2ce4d73fe26bb2453d249cfa71a5a510405f1
7
+ data.tar.gz: 514b6dea9c2d98b34ba6a0b2ef574283619feeb198adc4b748b8bd3a818635870fc12ad478738a5120e55d22dc60c0f22702a1c1cf92ecb5fef023a6f9b38f74
@@ -818,7 +818,7 @@ module RelatonBib
818
818
  return attrs if attrs.any?
819
819
 
820
820
  docidentifier.first&.tap do |di|
821
- return { anchor: di.id }
821
+ return { anchor: di.id.gsub(" ", ".") }
822
822
  end
823
823
  end
824
824
 
@@ -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
- ret << DocumentIdentifier.new(type: type, id: id) if id
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" : ""
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.9.13".freeze
2
+ VERSION = "1.9.17".freeze
3
3
  end
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
- 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
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.13
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: 2021-12-29 00:00:00.000000000 Z
11
+ date: 2022-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug