{# This template is also rendered with each entry (i.e., `rendered_templates`), and has access to all of the main entry-specific template values. Since the goal is definitions, `lexicon_entry` is relevant. Filtering by target languag ehas to happen here, so be sure to use the `xml_lang` filter if overriding. overrides here: - sorting by @rank attribute - remove target language filter of meaning groups #} {% import 'lexicon.macros' as macros with context %} {% for meaning_group in lexicon_entry|xpath('./mg')|sortby_xpath('./@rank') %} {% set translation_groups = meaning_group|xpath('./tg') %} {% if translation_groups|count > 0 %}
  • {% else %} {% continue %} {% endif %} {% for translation_group in translation_groups %} {# TODO: is it possible to avoid having to pass the global context variables in here? #} {{ templates.definition_text.render(translation_group=translation_group, _from=_from, _to=_to) }} {# TODO: examples should move to definition notes template, which will need to be rendered for each tg #} {% set examples = meaning_group|xpath('./xg') or translation_group|xpath('./xg') %} {% if examples %}
    {% for example in examples %} {% if example|xpath('@re') %}
    {{ example|xpath('./x')|first|text }} ({{ example|xpath('@re')|first }})
    {% else %}
    {{ example|xpath('./x')|first|text }}
    {% endif %}
    {{ example|xpath('./xt')|first|text }}
    {% endfor %}
    {% endif %} {% endfor %} {% set entry_source = lexicon_entry|xpath('@src')|first %} {% if entry_source %}{{ entry_source }}{% endif %}
  • {% endfor %} {# vim: set ts=4 sw=4 tw=72 syntax=htmljinja : #}