arxiv-references 0.1.5 → 0.1.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +4 -0
- data/lib/arxiv/references.rb +5 -0
- data/lib/arxiv/references/myUtil.rb +21 -9
- data/lib/arxiv/references/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: daa78fd2737bd135435527f1534ced7910016f66
|
4
|
+
data.tar.gz: 9d5bc8e4f8046160ff32135b450191a11e44c833
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30c204729334a420e27e2f0b5111bb00c46ccf5a3da26cc12736b8a65f109290e3cd6ca855f54c170d41578ab11a2373a03d1e7139f426b24d249a9f00ba99ed
|
7
|
+
data.tar.gz: 25e3705840d15c2e78efd358aa1680c50807f5af3ed09402d0f915acd4286631adadd820cdec89e932fa69602b3d4fbad65ce81603754575acfaf68f54f5a09e
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/arxiv-references.svg)](https://badge.fury.io/rb/arxiv-references)
|
2
|
+
[![LICENSES](https://img.shields.io/badge/LICENSE-GPL-blue.svg)](https://img.shields.io/badge/LICENSE-GPL-blue.svg)
|
3
|
+
[![Code Climate](https://codeclimate.com/github/nishimuuu/Arxiv-references/badges/gpa.svg)](https://codeclimate.com/github/nishimuuu/Arxiv-references)
|
4
|
+
[![Test Coverage](https://codeclimate.com/github/nishimuuu/Arxiv-references/badges/coverage.svg)](https://codeclimate.com/github/nishimuuu/Arxiv-references/coverage)
|
1
5
|
# Arxiv::References
|
2
6
|
|
3
7
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/arxiv/references`. To experiment with that code, run `bin/console` for an interactive prompt.
|
data/lib/arxiv/references.rb
CHANGED
@@ -55,20 +55,19 @@ module ArxivUtil
|
|
55
55
|
fetchFromUrl(target_url, work_dir)
|
56
56
|
end
|
57
57
|
|
58
|
-
def self.
|
59
|
-
job_id = makeId
|
60
|
-
makeDir(job_id, work_dir)
|
61
|
-
file_name = makeFile(job_id, work_dir)
|
62
|
-
|
58
|
+
def self.fetchPdfFile(pdfUrl,file_name)
|
63
59
|
open(file_name, 'wb') do |o|
|
64
60
|
open(pdfUrl) do |data|
|
65
61
|
o.write(data.read)
|
66
62
|
end
|
67
63
|
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.convertSingleColPdf(job_id, work_dir,file_name)
|
68
67
|
cmd = "k2pdfopt -dev kpw #{file_name}"
|
69
68
|
PTY.spawn(cmd) do |i,o|
|
70
69
|
o.sync = true
|
71
|
-
i.expect(/\S.*Enter option above \(h=help, q=quit\):/,10){
|
70
|
+
i.expect(/\S.*Enter option above \(h=help, q=quit\):/,10){
|
72
71
|
o.puts "\n"
|
73
72
|
o.flush
|
74
73
|
}
|
@@ -78,8 +77,11 @@ module ArxivUtil
|
|
78
77
|
break unless res.index('written').nil?
|
79
78
|
end
|
80
79
|
end
|
81
|
-
|
82
|
-
|
80
|
+
return getK2Pdf(job_id, work_dir)
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.fetchReference(file_name)
|
84
|
+
reader = PDF::Reader.new(file_name)
|
83
85
|
page_no = reader.
|
84
86
|
pages.
|
85
87
|
reject{|i|
|
@@ -102,10 +104,20 @@ module ArxivUtil
|
|
102
104
|
gsub('- ','').
|
103
105
|
split("\n")
|
104
106
|
|
105
|
-
|
107
|
+
return ref_page[(ref_page.index{|i| i =~ REFERENCE_START_REGEXP}+1)..ref_page.length].
|
106
108
|
select{|i|
|
107
109
|
i.length > 5
|
108
110
|
}
|
111
|
+
end
|
112
|
+
|
113
|
+
def self.fetchFromPdfUrl(pdfUrl, work_dir)
|
114
|
+
job_id = makeId
|
115
|
+
makeDir(job_id, work_dir)
|
116
|
+
file_name = makeFile(job_id, work_dir)
|
117
|
+
|
118
|
+
fetchPdfFile(pdfUrl, file_name)
|
119
|
+
executed_pdf = convertSingleColPdf(job_id, work_dir, file_name)
|
120
|
+
references = fetchReference(executed_pdf)
|
109
121
|
removeDir(job_id, work_dir)
|
110
122
|
return references
|
111
123
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arxiv-references
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.5
|
4
|
+
version: 0.1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro Nishimura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|