Commit 9a35ade2 authored by David Moxey's avatar David Moxey

Add support for multiple bibliography files to Utilities

parent 82bded55
...@@ -18,7 +18,8 @@ module Jekyll ...@@ -18,7 +18,8 @@ module Jekyll
end end
opts.on('-f', '--file FILE') do |file| opts.on('-f', '--file FILE') do |file|
@bibtex_file = file @bibtex_file ||= []
@bibtex_file << file
end end
opts.on('-q', '--query QUERY') do |query| opts.on('-q', '--query QUERY') do |query|
...@@ -61,7 +62,9 @@ module Jekyll ...@@ -61,7 +62,9 @@ module Jekyll
def bibliography def bibliography
unless @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? @bibliography.replace_strings if replace_strings?
end end
...@@ -109,15 +112,22 @@ module Jekyll ...@@ -109,15 +112,22 @@ module Jekyll
def extend_path(name) def extend_path(name)
if name.nil? || name.empty? if name.nil? || name.empty?
name = config['bibliography'] name = [config['bibliography']]
end end
# return as is if it is an absolute path ret = []
return name if name.start_with?('/') && File.exists?(name)
p = File.join(config['source'], name) name.each { |file|
p << '.bib' unless File.exists?(p) # return as is if it is an absolute path
p if file.start_with?('/') && File.exists?(file)
ret << file
else
p = File.join(config['source'], file)
p << '.bib' unless File.exists?(p)
ret << p
end
}
ret
end end
def reference_tag(entry) def reference_tag(entry)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment