$def with (page) $ h = None $if "superfast" in ctx.features and "history_v2" not in ctx.features: $ h = page.get_history_preview() $if not h: $ h = get_history(page) $ versions = h.recent + h.initial $ cur_v = query_param("v", None) $ show_wikipedia_citation_link = page.wp_citation_fields

## $_("History")

$if h.initial:
- $_("Created %(date)s", date=datestr(h.initial[0].created))
$if page.url: $ url = page.url(m='history') $else: $ url = changequery(m='history') $ latest = versions[0]
- $ungettext('%(count)d revision', '%(count)d revisions', latest.revision, count=latest.revision)

$if page.key.startswith("/works") or page.key.startswith("/books") or page.key.startswith("/authors"): $if cur_v: $ hist_addition = "?v=" + cur_v $else: $ hist_addition = "" $ rdf = page.key + ".rdf" + hist_addition $ json = page.key + ".json" + hist_addition $ opds = page.key + ".opds" + hist_addition $_('Download catalog record:') $_("RDF") / $_("JSON") $if page.key.startswith("/books"): / $_("OPDS") $if show_wikipedia_citation_link: | $_('Wikipedia citation') $if show_wikipedia_citation_link:

## $_("Wikipedia citation")

×$_("Close")

$_("Copy and paste this code into your Wikipedia page.") $_('Need help?')

$ cite = " |".join([k + '=' + v for k, v in page.wp_citation_fields.items() if v]) {{cite book|$cite}}

$def render_row(v,): $datestr(v.created) | $if v.author: $ author_link = v.author.render_link(cls="truncate") $elif v.ip and v.ip != "127.0.0.1": $ author_link = '%s' % (v.ip, _('an anonymous user'), v.ip) $else: $ author_link = '%s' % (_('an anonymous user')) $if v.revision == 1: $:_("Created by %(user)s", user=author_link) $else: $:_("Edited by %(user)s", user=author_link) | $:render_template("history/comment", v) $for v in h.recent:
$:render_row(v)
$if h.initial: $for v in h.initial:
$:render_row(v)