{# Overrides contained within: * lemma_ref - link to a different entry ("see also") This is the main entry template that is called each time in the loop of main page entry results. Variables are passed in for the `lexicon_entry`, and morphological `analyses`. Some of the work here is sent out to `definition.template`. If you need to override this template, keep in mind that there is a somewhat specific structure as relates to Twitter Bootstrap, however the freedom that is available is that everything must be within:
#} {%- macro reference_link(has_reference) -%} {{- rendered_templates.entry_text -}} → {{ has_reference }} {%- endmacro -%} {%- import "lexicon.macros" as macros with context -%} {%- set first_l = lexicon_entry|xpath('lg/l')|first %} {%- set morph_ex = lexicon_entry|xpath('mg/tg/morph_expl') %} {% if morph_ex %} {% set morph_ex_text = morph_ex[0]|text %} {% else %} {% set morph_ex_text = 'xxxx' %} {% endif %} {% set cmp_list = [] %} {% for item in analyses[0].tag_raw if not 'true' in cmp_list %} {% if 'Cmp' in item %} {% do cmp_list.append('true') %} {% endif %} {% endfor %} {% set der_list = ['Der/', 'VAbess', 'VGen', 'Ger', 'Comp', 'Superl'] %} {% set if_der = [] %} {% for item in der_list %} {% if item in first_l|text %} {% do if_der.append('true') %} {% endif %} {% endfor %} {% if 'true' not in if_der %} {% if user_input in first_l|text %}
{% if lexicon_entry|count > 0 %} {% set has_reference = lexicon_entry.xpath('./lg/lemma_ref/text()')|first %}

{%- if has_reference -%} {{ reference_link(has_reference) }} {%- else -%} {{- rendered_templates.entry_text -}} {% endif %}

    {{- rendered_templates.definition -}}
{% else %} {% endif %}
{{- rendered_templates.analyses -}}
{% else %} {% if ('true' in cmp_list) and (analyses[0].tag_raw[0]|length < user_input|length) %}
{% if lexicon_entry|count > 0 %} {% set has_reference = lexicon_entry.xpath('./lg/lemma_ref/text()')|first %}

{%- if has_reference -%} {{ reference_link(has_reference) }} {%- else -%} {{- rendered_templates.entry_text -}} {% endif %}

    {{- rendered_templates.definition -}}
{% else %} {% endif %}
{# Uncomment div below to show analyses of first word in cmp #} {#
{{- rendered_templates.analyses -}}
#}
{% else %}
{% if lexicon_entry|count > 0 %} {% set has_reference = lexicon_entry.xpath('./lg/lemma_ref/text()')|first %}

{%- if has_reference -%} {{ reference_link(has_reference) }} {%- else -%} {{- rendered_templates.entry_text -}} {% endif %}

    {{- rendered_templates.definition -}}
{% else %} {% endif %}
{{- rendered_templates.analyses -}}
{% endif %} {% endif %} {% else %}

+

{% if lexicon_entry|count > 0 %} {% set has_reference = lexicon_entry.xpath('./lg/lemma_ref/text()')|first %}

{%- if has_reference -%} {{ reference_link(has_reference) }} {%- else -%}

{{morph_ex_text}}

{% endif %}
    {{- rendered_templates.definition -}}
{% else %} {% endif %}
{% endif %} {# vim: set ts=4 sw=4 tw=72 syntax=htmljinja : #}