Skip to content

Commit

Permalink
cleaning up generation of keywords and author bibs to conform with ne…
Browse files Browse the repository at this point in the history
…w OA icons
  • Loading branch information
houshuang committed Jan 14, 2013
1 parent e1c75e8 commit e0d725e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions bibtex-batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
keywordopt = true
#######################################################################

# dt = app('BibDesk')
# dt.document.save
def pdfpath(citekey)
if File.exists?("#{PDF_path}/#{citekey.to_s}.pdf")
return "[[skimx://#{citekey}|PDF]]"
end
end
try { dt = app('BibDesk') }
try { dt.document.save }

def sort_pubs(pubs)
return pubs.sort {|x,y| x.to_s.scan(/[0-9]+/)[0].to_i <=> y.to_s.scan(/[0-9]+/)[0].to_i}
Expand Down Expand Up @@ -207,9 +202,9 @@ def make_rss_feed
sort_pubs(pubs).each do |i|
item = b[i]
if File.exists?("#{Wiki_path}/data/pages/ref/#{item.key}.txt")
out1 << "| [#:ref:#{item.key}|#{item.key}] | #{item[:cit]}|#{pdfpath(item.key)}|\n"
out1 << "| [@#{item.key}] | #{item[:cit]}|\n"
else
out2 << "| #{item.key} | #{item[:cit]}|#{pdfpath(item.key)}|\n"
out2 << "| [@#{item.key}] | #{item[:cit]}|\n"
end
end

Expand Down Expand Up @@ -246,9 +241,9 @@ def make_rss_feed
sort_pubs(pubs).each do |i|
item = b[i]
if File.exists?("#{Wiki_path}/data/pages/ref/#{item.key}.txt")
out1 << "| [#:ref:#{item.key}|#{item.key}] | #{item[:cit]}| #{pdfpath(item.key)} |\n"
out1 << "| [@#{item.key}] | #{item[:cit]}|\n"
else
out2 << "| #{item.key} | #{item[:cit]} | #{pdfpath(item.key)}|\n"
out2 << "| [@#{item.key}] | #{item[:cit]}|\n"
end
end

Expand Down Expand Up @@ -287,9 +282,9 @@ def make_rss_feed
sort_pubs(pubs).each do |i|
item = b[i]
if File.exists?("#{Wiki_path}/data/pages/ref/#{item.key}.txt")
out1 << "| [#:ref:#{item.key}|#{item.key}] | #{item[:cit]}|#{pdfpath(item.key)}|\n"
out1 << "| [@#{item.key}] | #{item[:cit]}|\n"
else
out2 << "| #{item.key} | #{item[:cit]}|#{pdfpath(item.key)}|\n"
out2 << "| [@#{item.key}] | #{item[:cit]}|\n"
end
end

Expand Down

0 comments on commit e0d725e

Please sign in to comment.