2023-02-25 15:42:59 +01:00
|
|
|
{% macro place_dl(place, label="", iso_code_prefix="") -%}
|
|
|
|
{%- if place -%}
|
|
|
|
{%- if format=="text/html" %}
|
2023-02-24 00:42:15 +01:00
|
|
|
{% if label %}<dt>{{label}}</dt>{% endif %}
|
2023-02-18 13:09:22 +01:00
|
|
|
<dd>{{place.name}} {% if place.iso_code%}({% if iso_code_prefix %}{{iso_code_prefix}}-{% endif %}{{place.iso_code}}){% endif %}</dd>
|
2023-02-25 15:42:59 +01:00
|
|
|
{% else -%}
|
|
|
|
* {% if label %}{{label}}: {% endif %}{{place.name}}{% if place.iso_code%} ({% if iso_code_prefix %}{{iso_code_prefix}}-{% endif %}{{place.iso_code}}){% endif %}
|
2023-02-25 18:32:09 +01:00
|
|
|
{% endif -%}
|
2023-02-25 15:42:59 +01:00
|
|
|
{%- endif -%}
|
|
|
|
{%- endmacro place_dl %}
|
2023-02-18 13:09:22 +01:00
|
|
|
|
2023-02-23 21:24:35 +01:00
|
|
|
{% macro dig_link(extra, name) %}
|
|
|
|
{{ extra.base_url }}/dig/{{ name | trim_end_matches(pat=".") | urlencode_strict | replace(from="%2e", to=".") | safe }}
|
|
|
|
{% endmacro dig_link %}
|
|
|
|
|
|
|
|
{% macro dig(extra, name, fqdn=false, prefix="") %}
|
|
|
|
<a href="{{ self::dig_link(extra=extra, name=name) }}">{% if prefix %}{{ prefix }} {% endif %}{% if fqdn or name=="." %}{{ name }}{% else %}{{ name | trim_end_matches(pat=".") }}{% endif %}</a>
|
|
|
|
{% endmacro dig %}
|
|
|
|
|
2023-08-06 02:08:54 +02:00
|
|
|
{% macro ip(extra, ip, text="") %}
|
|
|
|
<a href="{{ extra.base_url }}/ip/{{ ip | urlencode_strict | replace(from="%2e", to=".") | replace(from="%3a", to=":") | safe }}"><code>{{ text | default(value=ip) }}</code></a>
|
2023-02-23 21:24:35 +01:00
|
|
|
{% endmacro dig %}
|
|
|
|
|
2023-02-24 00:01:51 +01:00
|
|
|
{% macro breadcrumb_domain(extra, name) %}
|
|
|
|
{% set_global dot = "" %}
|
|
|
|
{% set crumbs = name | split(pat=".") %}
|
|
|
|
{% set_global i = 0 %}
|
|
|
|
{% for crumb in crumbs %}
|
|
|
|
{{-dot}}<a href="{{self::dig_link(extra=extra, name=crumbs | slice(start=i) | join(sep="."))}}">{{crumb}}</a>
|
|
|
|
{%- set_global dot = "." -%}
|
|
|
|
{%- set_global i = i+1 -%}
|
|
|
|
{% endfor %}
|
|
|
|
|
2023-08-05 23:19:53 +02:00
|
|
|
{%- endmacro breadcrumb_domain %}
|
2023-02-25 15:42:59 +01:00
|
|
|
|
|
|
|
{% macro ip_info(ip_info) -%}
|
|
|
|
{{ip_info.scope | title}} {{ip_info.cast | title}} IPv{% if ip_info.is_v6_address %}6{% else %}4{% endif %}
|
|
|
|
{%- endmacro ip_info %}
|