<div id="macros">
{% macro make_link(view, label) -%}
<a href="{{ url_for(view, **kwargs) }}">{{label}}</a>
{%- endmacro %}


{% macro statslink(stats, stat, playbook, host) %}
<td>
{% if stats[stat] and stats[stat] >= 1 -%}
{{ make_link('playbook.playbook_results', stats[stat],
   playbook=playbook.id, host=host.name, status=stat) }}
{% else -%}
0
{% endif %}
</td>
{% endmacro %}

{% macro render_value_type(value, type) %}
{% if type == 'json' %}
    <pre>{{ value |to_nice_json |safe }}</pre>
{% elif type == 'url' %}
    <a href="{{ value }}" target="_blank">{{ value }}</a>
{% else %}
    <pre>{{ value }}</pre>
{% endif %}
{% endmacro %}
</div>
