$def with (book) $if book.subtitle: $ title = book.title + ": " + book.subtitle $else: $ title = book.title $if book.pagination: $ pages = book.pagination $else: $ pages = book.number_of_pages $ work = book.works and book.works[0] $if work: $ authors = work.get_authors() $else: $ authors = book.get_authors() $ contributors = book.get('contributors', []) $def display(tag, value): $if isinstance(value, list): $for x in value: <$tag>$x $elif value: <$tag>$value $if work: $for a in authors: $a.name $if contributors: $for c in contributors: $c.name $:display("dcterms:contributor", book.contributions) $:display("dcterms:title", title) $:display("dcterms:publisher", book.publishers) $:display("rdvocab:placeOfPublication", book.publish_places) $:display("dcterms:issued", book.publish_date) $:display("dcterms:extent", pages) $:display("rdvocab:dimensions", book.physical_dimensions) $:display("bibo:edition", book.edition_name) $:display("dc:subject", book.subjects) $for DDC in book.dewey_decimal_class: $DDC $for LCC in book.lc_classifications: $LCC $:display("dcterms:description", book.description) $:display("rdvocab:note", book.notes) $for lang in book.languages: $lang.code $:display("dcterms:identifier", book.key) $:display("bibo:oclcnum", book.oclc_numbers) $:display("bibo:lccn", book.lccn) $:display("bibo:isbn10", book.isbn_10) $:display("bibo:isbn13", book.isbn_13) $book.last_modified.isoformat() $book.created.isoformat() $book.revision