relaton-bib 1.10.5 → 1.10.6

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: 2efc0e0cc08165c731fb86e3acf37cac8fe9ba04a9091a9b4c4a9ce72880c4f6
4
- data.tar.gz: 444c0a7f14d29de5ff0a8f3eccf505541c76cf1b58a90bad535a94eddd1c7559
3
+ metadata.gz: 1609d9e48b478f743233091295cf554d9799d1e0c320379eca48e929d54f1477
4
+ data.tar.gz: 13440319619354c7aba95f519fef7cd7161da5b7282d67634b205d1b2a50018d
5
5
  SHA512:
6
- metadata.gz: ef7abaff244792b34a5d297e65b21c6643952036f07260f17b4062088b1b525319bd7478116586d2defac9342538f70b11e173c0a2687e9e7788322f117d1dd0
7
- data.tar.gz: f3e0359988479748395fde6325f0e7ff55226000906e6ff0e3541404b9fc16fc615522fe265a6754e52f4c0ca06d78774b11912d3f75a2d58cb1fdc8ac03fa05
6
+ metadata.gz: c43da7fab499c9395b7d426798674536c75b2d86086fb1f86c386eaf745c40e3c73e8dc9e8ef17c6052863b21498f03f62fc26479f8c6f05fd19ab7ad9b606e8
7
+ data.tar.gz: 35f0e51ab71f5940d079c116655199288e382dcbb4e682589c2d3f4323b8c0784b466a45a595d9f1739ff3096260efbafe348578bcb6f67b36b8785a638e1daa
@@ -834,7 +834,8 @@ module RelatonBib
834
834
  return attrs if attrs.any?
835
835
 
836
836
  docidentifier.first&.tap do |di|
837
- return { anchor: di.id.gsub(" ", ".") }
837
+ anchor = di.type == "IANA" ? di.id.split[1..-1].join(" ").upcase : di.id
838
+ return { anchor: anchor.gsub(" ", ".") }
838
839
  end
839
840
  end
840
841
 
@@ -2,6 +2,7 @@ module RelatonBib
2
2
  module BibXMLParser
3
3
  # SeriesInfo what should be saved as docidentifiers in the Relaton model.
4
4
  SERIESINFONAMES = ["DOI"].freeze
5
+ RFCPREFIXES = %w[RFC BCP FYI STD].freeze
5
6
 
6
7
  FLAVOR = nil
7
8
 
@@ -88,8 +89,14 @@ module RelatonBib
88
89
 
89
90
  %w[anchor docName number].each do |atr|
90
91
  if reference[atr]
92
+ pref, num = id_to_pref_num reference[atr]
93
+ atrid = if atr == "anchor" && RFCPREFIXES.include?(pref)
94
+ "#{pref}#{num.sub(/^-?0+/, '')}"
95
+ else
96
+ reference[atr]
97
+ end
91
98
  type = pubid_type id
92
- ret << DocumentIdentifier.new(id: reference[atr], type: type, scope: atr)
99
+ ret << DocumentIdentifier.new(id: atrid, type: type, scope: atr)
93
100
  end
94
101
  end
95
102
 
@@ -104,9 +111,8 @@ module RelatonBib
104
111
 
105
112
  def create_docid(id, ver) # rubocop:disable Metrics/MethodLength
106
113
  pref, num = id_to_pref_num(id)
107
- if %w[RFC BCP FYI STD].include?(pref)
108
- num.sub!(/^-?0+/, "")
109
- pid = "#{pref} #{num}"
114
+ if RFCPREFIXES.include?(pref)
115
+ pid = "#{pref} #{num.sub(/^-?0+/, '')}"
110
116
  type = pubid_type id
111
117
  elsif %w[I-D draft].include?(pref)
112
118
  pid = "draft-#{num}"
@@ -1,3 +1,3 @@
1
1
  module RelatonBib
2
- VERSION = "1.10.5".freeze
2
+ VERSION = "1.10.6".freeze
3
3
  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.10.5
4
+ version: 1.10.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-01 00:00:00.000000000 Z
11
+ date: 2022-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug