{% load submission %}

{% for ref in references %}
{% if ref.section == section %}
  {% if ref.block_label %}
    <div class="par">{{ ref.block_label_html }}</div>
  {% endif %}
  
  <div class="par">
    {% if not ref.collection %}
      {% if ref.inline_label %}{{ ref.inline_label_html }}{% endif %}
      
      {% dereference_block ref submission %}
      
    {% else %}
    
      {% collection_items items ref.collection as items %}
      {% for item in items %}
        {% if not ref.inline_combine %}
        <div class="item"
          {% if not ref.combined and not forloop.first %}
             style="display: none;"
          {% endif %}>
        {% endif %}
        
          {% if ref.name %}
            {% dereference_item_field ref item %}
          
          {% else %}
            {% dereference_item_file item as file_info %}
            
            {% with file=file_info.0 meta=file_info.1 %}
              {% include "./submission_file.html" %}
            {% endwith %}
          {% endif %}
          
        {% if not ref.inline_combine %}</div>{% endif %}
      {% endfor %}
    
    {% endif %}
  </div>

{% endif %}
{% endfor %}
