Refactor get_target macro to make conditions more explicit

This commit is contained in:
Fidel Ramos 2019-10-31 22:06:17 +00:00
parent fc05942499
commit 5764700be8
No known key found for this signature in database
GPG key ID: 64490E0A752C21C4

View file

@ -109,12 +109,16 @@
<ul class="list"> <ul class="list">
{# Open links in new window depending on the LINKS_IN_NEW_TAB setting #} {# Open links in new window depending on the LINKS_IN_NEW_TAB setting #}
{% macro get_target(link) -%} {% macro get_target(link) -%}
{% if LINKS_IN_NEW_TAB not in ('no', 'none', false, 0, 'external') or (LINKS_IN_NEW_TAB == "external" and not link.startswith("/") and not link.startswith(SITEURL)) %} {%- if LINKS_IN_NEW_TAB is not defined -%}
_blank _blank
{% else %} {%- elif LINKS_IN_NEW_TAB in ('all', none, true) -%}
_blank
{%- elif LINKS_IN_NEW_TAB == "external" and not link.startswith("/") and not link.startswith(SITEURL) -%}
_blank
{%- else -%}
_self _self
{% endif %} {%- endif -%}
{% endmacro %} {%- endmacro %}
{% if PAGES_SORT_ATTRIBUTE -%} {% if PAGES_SORT_ATTRIBUTE -%}
{% set pages = pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %} {% set pages = pages|sort(attribute=PAGES_SORT_ATTRIBUTE) %}