Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
caesr-pub
jekyll-scholar
Commits
c01810f8
Commit
c01810f8
authored
Apr 12, 2014
by
Sylvester Keil
Browse files
Merge pull request #42 from mdave/master
Add support for multiple bibliography files
parents
82bded55
9a35ade2
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/jekyll/scholar/utilities.rb
View file @
c01810f8
...
...
@@ -18,7 +18,8 @@ module Jekyll
end
opts
.
on
(
'-f'
,
'--file FILE'
)
do
|
file
|
@bibtex_file
=
file
@bibtex_file
||=
[]
@bibtex_file
<<
file
end
opts
.
on
(
'-q'
,
'--query QUERY'
)
do
|
query
|
...
...
@@ -61,7 +62,9 @@ module Jekyll
def
bibliography
unless
@bibliography
@bibliography
=
BibTeX
.
open
(
bibtex_path
,
bibtex_options
)
tmp
=
""
bibtex_path
.
each
{
|
s
|
tmp
<<
IO
.
read
(
s
)}
@bibliography
=
BibTeX
.
parse
(
tmp
,
bibtex_options
)
@bibliography
.
replace_strings
if
replace_strings?
end
...
...
@@ -109,15 +112,22 @@ module Jekyll
def
extend_path
(
name
)
if
name
.
nil?
||
name
.
empty?
name
=
config
[
'bibliography'
]
name
=
[
config
[
'bibliography'
]
]
end
# return as is if it is an absolute path
return
name
if
name
.
start_with?
(
'/'
)
&&
File
.
exists?
(
name
)
ret
=
[]
p
=
File
.
join
(
config
[
'source'
],
name
)
name
.
each
{
|
file
|
# return as is if it is an absolute path
if
file
.
start_with?
(
'/'
)
&&
File
.
exists?
(
file
)
ret
<<
file
else
p
=
File
.
join
(
config
[
'source'
],
file
)
p
<<
'.bib'
unless
File
.
exists?
(
p
)
p
ret
<<
p
end
}
ret
end
def
reference_tag
(
entry
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment