$if work:
$ component_times['databarWork'] = time() $:macros.databarWork(edition or work, editions_page=True) $ component_times['databarWork'] = time() - component_times['databarWork']
$ component_times['EditTopbar'] = time() $:macros.databarView(page, edition) $ component_times['EditTopbar'] = time() - component_times['EditTopbar']
$_("An edition of") $work_title$cond(work.subtitle, ': %s' % work.subtitle) $if work.first_publish_year: ($work.first_publish_year)
$:render_template("type/edition/book_title", work, edition) $if authors_byline: $# authors_byline susceptible to xss! $ component_times['ReadlogStats'] = time() $:macros.StarRatingsStats(work) $ component_times['ReadlogStats'] = time() - component_times['ReadlogStats']
$:render_template("type/edition/publisher_line", edition) $if edition: $if edition.languages:

$def lang_span(): $:thingrepr(edition.languages) $:_('Written in %(language)s', language=lang_span())

$if edition.number_of_pages:

$edition.number_of_pages $_("pages")

$if work and work.description or edition and edition.description:
$if edition and edition.description: $:sanitize(format(edition.description)) $elif work and work.description: $:sanitize(format(work.description))
$:macros.ReadMore("book-description")
$elif edition:

$:_("This edition doesn't have a description yet. Can you add one?", url=edition.url('/edit')+"#about/about")

$:macros.SubjectTags(work, ["Subjects"])
$:macros.ReadMore("subjects")
$:macros.EditionNavBar(work.edition_count, show_observations)

$ seen = set() $if previews: Previews available in: $for e in previews: $if e.languages[0].name not in seen: $ seen.add(e.languages[0].name) $e.languages[0].name

$ component_times['EditionsTable'] = time() $:render_template("type/work/editions_datatable", work, editions=editions, edition=edition) $ component_times['EditionsTable'] = time() - component_times['EditionsTable']

$work_title

$if work and work.subtitle:

$work.subtitle

$if work and work.first_publish_year:

$_("First published in %s", work.first_publish_year)


$ component_times['SubjectsTags'] = time() $:macros.SubjectTags(work, ["Subjects", "People", "Places", "Times"]) $ component_times['SubjectsTags'] = time() - component_times['SubjectsTags']
$if not work.excerpts and work.first_sentence:

$_("First Sentence")

"$work.first_sentence"

$if work.description:

$_("Work Description")

$:sanitize(format(work.description))
$if work.original_languages:
$_("Original languages")
$', '.join(lang.name for lang in work.original_languages)

$if work.excerpts:

$_("Excerpts")

$for excerpt in work.excerpts:
$for line in excerpt.excerpt.split('\n'): $line
$if excerpt.pages: $_("Page %(page)s", page=excerpt.pages), $if excerpt.author: $def excerpt_author_link(): $excerpt.author.displayname $:_("added by %(authorlink)s.", authorlink=str(excerpt_author_link()).strip()) $else: $_("added anonymously.") $if excerpt.comment: "$excerpt.comment"
$if work.links or (work.wikipedia and work.wikipedia.startswith("http")):

$:_('Links outside Open Library')

$if work.edition_count > 1: $if (work.lc_classifications or work.dewey_number):

$_("Classifications")

$if work.lc_classifications: $if work.dewey_number:
$_('Library of Congress') $thingrepr(work.lc_classifications)
$_('Dewey') $thingrepr(work.dewey_number)
$if not page.is_fake_record(): $if page.type.key in ["/type/work", "/type/edition", "/type/author"]: $if edition and page.type.key in ["/type/work"]: $ edit_url = edition.url(suffix="/edit") $else: $ edit_url = page.url(suffix="/edit") $else: $ edit_url = page.key + "?m=edit" $if not edition:

$_("No editions available")

$if edition:

$book_title

$if edition.subtitle:

$edition.subtitle

$if edition.edition_name:
$edition.edition_name
$:render_template("type/edition/publisher_line", edition)
$if edition.first_sentence:

$_("First Sentence")

"$(edition.first_sentence)"

$if edition.description:

$_("Edition Description")

$:sanitize(format(edition.description))
$if edition: $ component_times['TableOfContents'] = time() $:macros.TableOfContents(edition, ocaid) $ component_times['TableOfContents'] = time() - component_times['TableOfContents'] $if edition.notes or edition.series or edition.volume or edition.genres or edition.other_titles or edition.copyright_date or edition.translation_of or edition.translated_from:

$_("Edition Notes")

$if edition.notes: $:format(edition.notes)
$:display_value(_("Series"), edition.series) $:display_value(_("Volume"), edition.volume) $:display_value(_("Genre"), edition.genres) $:display_value(_("Other Titles"), edition.other_titles) $:display_value(_("Copyright Date"), edition.copyright_date) $:display_value(_("Translation Of"), edition.translation_of) $:display_value(_("Translated From"), edition.translated_from)
$ classifications = edition.get_classifications().multi_items() $if classifications:

$_("Classifications")

$for name, values in classifications: $:display_identifiers(values[0].label, values)
$ links = page.get_links() $if links: $ contributors = edition.get('contributors', []) $if contributors:

$_("Contributors")

$for c in contributors: $:display_value(c.role, c.name)
$if has_any("physical_format", "pagination", "physical_dimensions", "weight"):

$_("The Physical Object")

$:display_value(_("Format"), edition.physical_format) $:display_value(_("Pagination"), edition.pagination) $:display_value(_("Number of pages"), edition.number_of_pages, itemprop="numberOfPages") $:display_value(_("Dimensions"), edition.physical_dimensions) $:display_value(_("Weight"), edition.weight)

$_("ID Numbers")

$:display_identifiers("Open Library", [storage(url=None, value=edition.key.split("/")[-1])]) $ no_index = edition.get_ia_meta_fields().get('noindex', False) $for name, values in edition.get_identifiers().multi_items(): $ identifier_label = values[0].label $if not (edition.is_in_private_collection() and identifier_label == 'Internet Archive'): $if is_privileged_user or not (no_index and identifier_label == 'Internet Archive'): $:display_identifiers(identifier_label, values, itemprop=cond(name in ["isbn_10", "isbn_13"], "isbn", None)) $:display_goodreads("Open Library", [storage(url=None, value=edition.key.split("/")[-1])]) $for name, values in edition.get_identifiers().multi_items(): $:display_goodreads(values[0].label, values)
$# BookNotes feature: $if ctx.user and ctx.user.is_beta_tester(): $if show_observations: $ reader_observations = get_observation_metrics(work['key']) $:render_template("observations/review_component", work, reader_observations, page.key)
$# pages like /books/ia:foo00bar are fake records created from metadata API. $# Adding them to lists doesn't work. Disabling it to avoid any issues. $if "lists" in ctx.features and not page.is_fake_record():

$_('Lists containing this Book')

$if work: $ component_times['WorkListTime'] = time() $:render_template("lists/widget", work, include_header=False, include_widget=False) $ component_times['WorkListTime'] = time() - component_times['WorkListTime'] $if edition: $ component_times['EditionListTime'] = time() $:render_template("lists/widget", edition, include_header=False, include_widget=False) $ component_times['EditionListTime'] = time() - component_times['EditionListTime']
$ component_times['RelatedWorksCarousel'] = time()
$ component_times['RelatedWorksCarousel'] = time() -component_times['RelatedWorksCarousel'] $ component_times['HistoryTable'] = time() $:render_template("lib/history", page) $ component_times['HistoryTable'] = time() - component_times['HistoryTable'] $ component_times['TotalTime'] = time() - component_times['TotalTime'] $if query_param('debug'): $:macros.Profile(component_times)