{% if resources %}
  {% for format_name, format in resources.items %}
      <div class="btn-group">
      {% for f in format %}
          {% if forloop.first %}
              <a type="button" class="btn {{ button_class }}" href="{{ f.0 }}">{{ format_name|upper }}</a>
          {% else %}
              {% if forloop.counter0 == 1 %}
                  <button type="button" class="btn {{ button_class }} dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                      <span class="caret"></span>&nbsp
                  </button>
                  <ul class="dropdown-menu" role="menu">
              {% endif %}
              <li><a href="{{ f.0 }}">{{ f.1 }}</a></li>
              {% if forloop.last %}
                  </ul>
              {% endif %}
          {% endif %}
      {% endfor %}
      </div>
  {% endfor %}
{% endif %}