Generating citation lists

This commit is contained in:
Oliver Kennedy 2017-05-11 09:45:25 +02:00
parent cc1e88fc49
commit 9451fdb285

View file

@ -188,3 +188,32 @@ end
task :collab => "artifacts/okennedy_collaborators.tsv"
file "artifacts/oracle_papers.txt" => [ $db.files, "artifacts", "Rakefile" ].flatten do
File.open("artifacts/oracle_papers.txt", "w+") do |fh|
fh.puts $db["publications"].
where { |pub| pub.fetch("projects", []).include? "mimir" }.
map { |pub|
pub = LabMetadata::complete_venue(pub)
case pub["type"]
when "conference", "journal", "workshop", "abstract" then
[ pub["title"],
pub["authors"].join(", "),
"#{LabMetadata::venue_name(pub, size: :full_parens)} #{pub["year"]}",
pub["urls"].map { |k,v| "#{k.capitalize}: #{v}" },
LabMetadata.bibtex_for(pub).split("\n")
].flatten
when "thesis" then
[ pub["title"],
pub["authors"].join(", "),
"Thesis #{pub["degree"]} #{pub["year"]}",
pub["urls"].map { |k,v| "#{k.capitalize}: #{v}" },
LabMetadata.bibtex_for(pub).split("\n")
].flatten
else nil
end
}.
compact.
map { |record| "> #{record.join("\n ")}" }.
join("\n\n")
end
end