arxiv-references 0.1.1 → 0.1.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff8bba2cf9350196654a4ab2aa4935c7d72c7c35
|
4
|
+
data.tar.gz: 639122720e954ae36f82092403fc1b1c68fa24a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cbf408e861e720b15fcab59ac13d710b39c6054331bfccf3c74d6aba7cddcd4d3a020f73e6af7f03877e0f2af97e75e57f177de914a8e73228d61075e6a317a
|
7
|
+
data.tar.gz: dbc20e54e6698778f7f6fe39a85b21e5052383d80fb3dab1759f9205e2c6b91e2d0df7248522fd7586fa2364531280d91b6db823a0c2f5664aaa2bdda775fcef
|
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'thor'
|
4
4
|
require 'pathname'
|
5
5
|
lib = Pathname.new(__FILE__).dirname.join().expand_path
|
6
|
-
p lib.to_s
|
7
6
|
$:.unshift lib.to_s
|
8
7
|
require 'myUtil'
|
9
8
|
|
@@ -12,7 +11,6 @@ module ArxivReferences
|
|
12
11
|
class CLI < Thor
|
13
12
|
include ArxivUtil
|
14
13
|
desc 'url', 'Extract references from arxiv URL'
|
15
|
-
p $:
|
16
14
|
def url(urlName)
|
17
15
|
return ArxivUtil.fetchFromUrl(urlName)
|
18
16
|
end
|
@@ -9,8 +9,8 @@ require 'nokogiri'
|
|
9
9
|
require 'json'
|
10
10
|
module ArxivUtil
|
11
11
|
BASE_URL = "https://arxiv.org"
|
12
|
-
REFERENCE_START_REGEXP =
|
13
|
-
REFERENCE_REGEXP =
|
12
|
+
REFERENCE_START_REGEXP = Regexp.new('References|REFERENCES|Reference|REFERENCE')
|
13
|
+
REFERENCE_REGEXP = Regexp.new('(\[[0-9]?[0-9]\]|\[.+?\])')
|
14
14
|
def self.makeId
|
15
15
|
return Digest::SHA256.hexdigest Time.now.strftime("%F %H:%M:%S")
|
16
16
|
end
|
@@ -102,7 +102,7 @@ module ArxivUtil
|
|
102
102
|
gsub('- ','').
|
103
103
|
split("\n")
|
104
104
|
|
105
|
-
references = ref_page[(ref_page.index
|
105
|
+
references = ref_page[(ref_page.index{|i| i =~ REFERENCE_START_REGEXP}+1)..ref_page.length].
|
106
106
|
select{|i|
|
107
107
|
i.length > 5
|
108
108
|
}
|