$def with (v) $ get_source_record = render_template("history/sources").get_source_record $def link(url, label): $if url: $label $else: $label $ v = process_version(v) $ record_id = v.get('machine_comment') $if record_id: $ record = get_source_record(record_id) $if v.revision == 1: $ record_type = '' $if record.source_name not in ('amazon.com', 'Better World Books'): $ record_type = 'item' if record.source_name == 'Internet Archive' else 'MARC' $:_('Imported from %(source)s %(type)s record.', source=link(record.source_url, record.source_name), url=record.url, type=record_type) $else: $:_('Found a matching record from %(source)s.', url=record.url, source=link(record.source_url, record.source_name)) $elif 'history_v2' in ctx.features: $ t = get_template('recentchanges/' + v.kind + '/comment') or get_template('recentchanges/default/comment') $:t(v, v.thing) $elif v.comment: $v.comment $else: $_("Edited without comment.")