{% load humanize madlibs %}
{# to be called via `comparatives` inclusion tag #}
<li>
    {% if index and stat_type != 'count' %}
    {{ index|comparison_index_phrase }} the {{ stat_type|stat_type_to_number_noun }} in {{ place_name }}: {% if stat_type == 'dollar' %}R{% endif %}{{ value|floatformat|intcomma|cut:".0" }}{% if stat_type == 'percentage' %}%{% endif %}
    {% if error_ratio >= 10 %}<sup>&dagger;</sup>{% endif %}
    {% else %}
    <strong>{{ place_name }}:</strong> {% if stat_type == 'dollar' %}R{% endif %}{{ value|floatformat|intcomma|cut:".0" }}{% if stat_type == 'percentage' %}%{% endif %}
    {% endif %}
    {% if numerator %}
        <span class="context">{% if stat_type == 'dollar' %}R{% endif %}{{ numerator|floatformat|intcomma|cut:".0" }}</span>
        {% if error %}
            <span class="context">(&plusmn;{% if stat_type == 'dollar' %}R{% endif %}{{ error|floatformat|intcomma|cut:".0" }}{% if stat_type == 'percentage' %}%{% endif %}{% if numerator_error %} / &plusmn;{% if stat_type == 'dollar' %}R{% endif %}{{ numerator_error|floatformat|intcomma|cut:".0" }}{% endif %})</span>
        {% endif %}
    {% elif error %}
        <span class="context">&plusmn;{% if stat_type == 'dollar' %}R{% endif %}{{ error|floatformat|intcomma|cut:".0" }}{% if stat_type == 'percentage' %}%{% endif %}</span>
    {% endif %}
</li>
