relaton-bib 1.9.12 → 1.9.16
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: e2b24daf1fbc819c9ca59c5c38be90c9a644d79c3f73a9a3d6462b30955a22fb
|
4
|
+
data.tar.gz: 0d370baf6ac11940a43d417661b1d306d1134d110507d371745078ad4e98a57c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63d120ba07f6b82b3ccce826f152fab3c85414a777962fbc8fed3102c4e565971e23ca5eeabca54852b41dcd9eb2dfc14d09249e5fb5a417b93dad2d4f62484
|
7
|
+
data.tar.gz: b0ee4c21adbd9a68443752b4c34bfe6b27ebeab891e8be029ec7de30ab4f8a13b1bcb7c64f30ba47c1b65e47b22741fbe6b756792a2106e0ac029c17c760687d
|
@@ -815,18 +815,13 @@ module RelatonBib
|
|
815
815
|
|
816
816
|
h[di.scope.to_sym] = di.id
|
817
817
|
end
|
818
|
-
# did = docidentifier.detect { |di| di.type == "rfc-anchor" }
|
819
818
|
return attrs if attrs.any?
|
820
819
|
|
821
820
|
docidentifier.first&.tap do |di|
|
822
|
-
return { anchor: di.id }
|
821
|
+
return { anchor: di.id.gsub(" ", ".") }
|
823
822
|
end
|
824
823
|
end
|
825
824
|
|
826
|
-
# def id_to_ref_attr(id)
|
827
|
-
# id.sub(/^(RFC|BCP)\s/, '\1').sub(/^(\d?[A-Z]+)\s/, '\1.')
|
828
|
-
# end
|
829
|
-
|
830
825
|
def render_keyword(builder)
|
831
826
|
keyword.each { |kw| builder.keyword kw.content }
|
832
827
|
end
|
@@ -67,21 +67,36 @@ module RelatonBib
|
|
67
67
|
#
|
68
68
|
def docids(reference, ver) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/AbcSize
|
69
69
|
ret = []
|
70
|
-
sfid = reference.at("./seriesInfo[@name='#{self::FLAVOR}']",
|
71
|
-
|
72
|
-
if sfid
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
else # if self::FLAVOR
|
77
|
-
id, scope = if reference[:anchor] then [reference[:anchor], "anchor"]
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
70
|
+
# sfid = reference.at("./seriesInfo[@name='#{self::FLAVOR}']",
|
71
|
+
# "./front/seriesInfo[@name='#{self::FLAVOR}']")
|
72
|
+
# if sfid
|
73
|
+
# type = sfid[:name]
|
74
|
+
# id = sfid[:value]
|
75
|
+
# # scope = "series"
|
76
|
+
# else # if self::FLAVOR
|
77
|
+
# id, scope = if reference[:anchor] then [reference[:anchor], "anchor"]
|
78
|
+
# elsif reference[:docName] then [reference[:docName], "docName"]
|
79
|
+
# elsif reference[:number] then [reference[:number], "number"]
|
80
|
+
# end
|
81
|
+
id = reference["anchor"] || reference["docName"] || reference["number"]
|
82
|
+
type_match = id&.match(/^(3GPP|W3C|[A-Z]{2,})(?:\.(?=[A-Z])|(?=\d))/)
|
83
|
+
type = self::FLAVOR || (type_match && type_match[1])
|
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)
|
83
89
|
end
|
84
|
-
|
90
|
+
%w[anchor docName number].each do |atr|
|
91
|
+
if reference[atr]
|
92
|
+
ret << DocumentIdentifier.new(id: reference[atr], type: type, scope: atr)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
# end
|
96
|
+
# if id
|
97
|
+
# ret << DocumentIdentifier.new(type: type, id: id)
|
98
|
+
# ret << DocumentIdentifier.new(type: type, id: id, scope: scope) if scope
|
99
|
+
# end
|
85
100
|
# if (id = reference[:anchor])
|
86
101
|
# ret << DocumentIdentifier.new(type: "rfc-anchor", id: id)
|
87
102
|
# end
|
@@ -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
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.16
|
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-
|
11
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: byebug
|