{% extends "pages/patchouli/page.html.jinja" %}

{% import "macros/formatting.html.jinja" as fmt with context %}
{% import "macros/formatting.txt.jinja" as fmt_txt with context %}

{% block body %}
  {% if page.title is defined and page.title is not none %}
    {# need title_attrs for LookupPatternPage -#}
    <h4{% block title_attrs %}{% endblock %}>
      {{- page.title -}}
      {# conditionally defined in Page #}
      {%- if page_anchor_id is defined %}
        {{- fmt.permalink(page_anchor_id) -}}
      {% endif -%}
    </h4>
  {% endif %}

  {# within a separate block so we can control if the text goes before or after page-specific content #}
  {% block inner_body %}
    {{ fmt.styled(page.text) }}
  {% endblock inner_body %}
{% endblock body %}

{% block redirect_title -%}
  {{
    page.title
    if page.title is defined and page.title
    else super()
  }}
{%- endblock redirect_title %}

{% block redirect_description -%}
  {{ fmt_txt.styled(page.text) }}
{%- endblock redirect_description %}
