{% macro page_title(title='', parent='', page=0) -%}
{% if title %}{{ title }}{% if page > 1 %} | {% trans page=page %}Page {{ page }}{% endtrans %}{% endif %} | {% if parent %}{{ parent }} | {% endif %}{% endif %}{{ settings.board_name }}
{%- endmacro %}

{# Guest avatar #}
{% macro avatar_guest(size=None) -%}
{{ STATIC_URL }}avatars/{% if size %}{{ size }}_{% endif %}avatar_guest.jpg
{%- endmacro %}

{# Messages list macro #}
{% macro messages_list(messages) %}
{% if messages %}
<div class="messages-list">
  {% for message in messages %}
  {{ draw_message(message) }}
  {% endfor %}
</div>
{% endif %}
{% endmacro %}

{# Render single message #}
{% macro draw_message(message, class='') %}
  <div class="alert alert-{{ message.type }}{% if class %} {{ class }}{% endif %}">
  	{{ draw_message_icon(message) }} <p><strong>{{ message.message }}</strong></p>
  </div>
{%- endmacro %}

{# Render icon #}
{% macro draw_message_icon(message) -%}
  	<div class="alert-icon"><span><i class="icon-{% if message.type == 'error' -%}remove
  		{%- elif message.type == 'success' -%}ok
  		{%- elif message.type == 'info' -%}info-sign
  		{%- else -%}warning-sign
  		{%- endif %} icon-white"></i></span></div>
{%- endmacro %}

{# Render pagination label #}
{% macro pager_label(pagination) -%}
{%- trans current_page=('<strong>' ~ pagination['page'] ~ '</strong>')|safe, pages=('<strong>' ~ pagination['total'] ~ '</strong>')|safe -%}
    Page {{ current_page }} of {{ pages }}
{%- endtrans -%}
{%- endmacro %}

{% macro itemprop_bread() -%}
itemprop="breadcrumb"
{%- endmacro %}

{% macro parents_list(forums) -%}
{% for forum in forums %}
<li><a href="{% if loop.first %}{% url 'index' %}#{{ forum.slug }}{% else %}{{ forum.type|url(forum=forum.pk, slug=forum.slug) }}{% endif %}">{{ forum.name }}</a> <span class="divider"><i class="icon-chevron-right"></i></span></li>
{% endfor %}
{%- endmacro %}

{% macro wrap(item, wrap, extra='') -%}
<{{ wrap }}{% if extra %} {{ extra|safe }}{% endif %}>{{ item }}</{{ wrap }}>
{%- endmacro %}