/upstream/templates/lists/export_as_bibtex.tmpl
Type: /type/template
body: $def with (list, editions)

$var content_type = "application/x-bibtex"

$for e in editions:
    @Book{$e.key.split("/")[-1],
        title: {$:texsafe(e.title)},
        $if e.works:
            $ authors = e.works[0].get_authors()
        $else:
            $ authors = e.get_authors()
        $if authors:
            author: {$" and ".join(texsafe(a.name or "unnamed") for a in authors)},
        $if e.publishers:
            publisher: {$:texsafe(e.publishers[0])},
        $ year = e.get_publish_year()
        $if year:
            year: {$:texsafe(str(year))},
        $if e.publish_places:
            place: {$:texsafe(e.publish_places[0])},
    }
plugin: openlibrary
title: Export as BibTex
m: edit