rfcbib 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rfcbib/scrapper.rb +27 -7
- data/lib/rfcbib/version.rb +1 -1
- data/rfcbib.gemspec +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07f6ab52973e93ae6aa47c9902f04be6e94a7e525cf7a81727ac5ef0b1d80df1
|
4
|
+
data.tar.gz: 607c8ea25f5885db73e8f4faae55a3285ae34aafb643616ad11b6739f5590811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d688f95967c328932b46db1240f185cd0da00d39c2cc83288a573a66542ef6b535f13cf226ebfeec49e708f86974c79c378a30edfd479b33b6ce620d9efc52df
|
7
|
+
data.tar.gz: 5ac830d72eab384e018a88d04b25527db14b0201dbde49699cfe4372479eb7128670361a01d3ee45e667731f0db0c00a68dc7f923e2730ff0f28d10bb9d73955
|
data/Gemfile.lock
CHANGED
data/lib/rfcbib/scrapper.rb
CHANGED
@@ -9,17 +9,37 @@ module RfcBib
|
|
9
9
|
|
10
10
|
# Scrapper module
|
11
11
|
module Scrapper
|
12
|
+
|
13
|
+
RFC_URI_PATTERN = "https://www.rfc-editor.org/refs/bibxml/reference.CODE"
|
14
|
+
ID_URI_PATTERN = "https://xml2rfc.tools.ietf.org/public/rfc/bibxml-ids/reference.CODE"
|
15
|
+
|
12
16
|
class << self
|
13
17
|
# @param text [String]
|
14
18
|
# @return [IsoBibItem::BibliographicItem]
|
15
19
|
def scrape_page(text)
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
|
21
|
+
# Remove initial "IETF " string if specified
|
22
|
+
ref = text.
|
23
|
+
gsub(/^IETF /, "").
|
24
|
+
sub(' ', '.') + '.xml'
|
25
|
+
|
26
|
+
uri = case ref
|
27
|
+
when /^RFC/
|
28
|
+
RFC_URI_PATTERN.dup
|
29
|
+
when /^I-D/
|
30
|
+
ID_URI_PATTERN.dup
|
31
|
+
else
|
32
|
+
warn "#{ref}: not recognised for RFC"
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
uri = uri.gsub("CODE", ref)
|
37
|
+
res = Net::HTTP.get_response(URI(uri))
|
38
|
+
if res.code != "200"
|
39
|
+
warn "No document found at #{uri}"
|
40
|
+
return
|
21
41
|
end
|
22
|
-
doc = Nokogiri::HTML Net::HTTP.get(uri)
|
42
|
+
doc = Nokogiri::HTML Net::HTTP.get(URI(uri))
|
23
43
|
@reference = doc.at('//reference')
|
24
44
|
return unless @reference
|
25
45
|
bib_item
|
@@ -158,7 +178,7 @@ module RfcBib
|
|
158
178
|
#
|
159
179
|
def dates
|
160
180
|
return unless (date = @reference.at '//front/date')
|
161
|
-
d = [date[:year], month(date[:month]),
|
181
|
+
d = [date[:year], month(date[:month]),
|
162
182
|
(date[:day] || "01")].compact.join '-'
|
163
183
|
date = Time.parse(d).strftime '%Y-%m-%d'
|
164
184
|
[IsoBibItem::BibliographicDate.new(type: 'published', on: date)]
|
data/lib/rfcbib/version.rb
CHANGED
data/rfcbib.gemspec
CHANGED
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
'using the BibliographicItem model'
|
17
17
|
spec.homepage = 'https://github.com/riboseinc/rfcbib'
|
18
18
|
spec.license = 'BSD-2-Clause'
|
19
|
+
spec.post_install_message = "The rfcbib gem has been deprecated and has been replaced by ietfbib"
|
19
20
|
|
20
21
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
22
|
f.match(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfcbib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -137,7 +137,8 @@ homepage: https://github.com/riboseinc/rfcbib
|
|
137
137
|
licenses:
|
138
138
|
- BSD-2-Clause
|
139
139
|
metadata: {}
|
140
|
-
post_install_message:
|
140
|
+
post_install_message: The rfcbib gem has been deprecated and has been replaced by
|
141
|
+
ietfbib
|
141
142
|
rdoc_options: []
|
142
143
|
require_paths:
|
143
144
|
- lib
|