Wrapping a matrix block I'm outputting fields from a Matrix block, how do I then wrap all outputted fields from 'artworkFile' that are available with some HTML. Not individually wrapped, but all outputted fields.

Current Code:

{% case "artworkFile" %}
{% for asset in block.downloadUrl %}
 &lt;a href="{{ asset.getUrl() }}" target="_blank"&gt;
 &lt;div class="file {{ block.platform }} gutter-bottom--half"&gt;&lt;/div&gt;&lt;/a&gt;
{% endfor %}


Desired Output

&lt;div class="wrapper"&gt;
  &lt;a href="asseturl1.png&gt;
   &lt;div class="file exampleplatform1 gutter-bottom--half"&gt;&lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="asseturl2.png&gt;
   &lt;div class="file exampleplatform2 gutter-bottom--half"&gt;&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


Matrix Setup
Without understanding your use case or having the context of your full template and/or Matrix loop, it's very difficult to provide a good answer.

If you only want to "wrap all outputted blocks" in a container, it's as easy as putting the Matrix loop in a container, e.g.:

&lt;div class="wrapper"&gt;
    {% for block in entry.myMatrixFieldHandle %}
        {% switch block.type %}
            {% case 'artworkText' %}
                ...
            {% case 'artworkImageSingle' %}
                ...
            {% case 'artworkImageDouble' %}
                ...
            {% case 'artworkFile' %}
            {% for asset in block.downloadUrl %}
                &lt;a href="{{ asset.getUrl() }}" target="_blank"&gt;
                    &lt;div class="file {{ block.platform }} gutter-bottom--half"&gt;&lt;/div&gt;
                &lt;/a&gt;
            {% endfor %}
        {% endswitch %}
    {% endfor %}
&lt;/div&gt;


Based on your comments, however, I suspect that what you really want is to only wrap the markup for all your artworkFile blocks.

If that is the case, you have to consider the fact that if you want to wrap all of the artworkFile blocks in a single container and not the other block types, then these artworkFile blocks will necessarily be removed from the general flow/chronology of your overall Matrix field. This may be exactly what you want, or a side effect you haven't considered - just wanted to mention it. (It also means that you could actually just move the artworkFile blocks to a separate Matrix field altogether, if that'd make any of this easier).

Anyway, there's at least a couple of ways to achieve the above with your current setup. 

First, you can opt to remove the artworkFile switch case from your current Matrix loop, and create a secondary loop which only loops on artworkFile blocks somewhere else in your template. This secondary loop is then wrapped in a &lt;div class="wrapper"&gt; container, e.g.:

&lt;div class="wrapper"&gt;
    {% for block in entry.myMatrixFieldHandle.type('artworkFile') %}
        {% for asset in block.downloadUrl %}
        &lt;a href="{{ asset.getUrl() }}" target="_blank"&gt;
            &lt;div class="file {{ block.platform }} gutter-bottom--half"&gt;&lt;/div&gt;
        &lt;/a&gt;
        {% endfor %}
    {% endfor %}
&lt;/div&gt;


Another option is to leave the artworkFile switch in your current Matrix loop, but instead of outputting the markup directly, you can cache it in an array – this is done by first putting the markup in a variable by wrapping the block markup in a {% set %} tag pair, adding that variable to an array declared outside the loop, and finally print the collected markup by joining the contents of that array inside a container, e.g.:

{# Create an empty array outside the loop #}
{% set artworkFileBlocks = [] %}
{% for block in entry.myMatrixFieldHandle %}
    {% switch block.type %}
        {% case 'artworkText' %}
            ...
        {% case 'artworkImageSingle' %}
            ...
        {% case 'artworkImageDouble' %}
            ...
        {% case 'artworkFile' %}
        {# Cache the markup for the artworkFile block to a variable #}
        {% set artworkFileBlock %}
            {% for asset in block.downloadUrl %}
                &lt;a href="{{ asset.getUrl() }}" target="_blank"&gt;
                    &lt;div class="file {{ block.platform }} gutter-bottom--half"&gt;&lt;/div&gt;
                &lt;/a&gt;
            {% endfor %}
        {% endset %}
        {# Add the single artworkFile block markup to the array #}
        {% set artworkFileBlocks = artworkFileBlocks|merge([artworkFileBlock]) %}
    {% endswitch %}
{% endfor %}

{# Echo all artworkFile markup in a common container, whereever you need it #}
&lt;div class="wrapper"&gt;
    {{ artworkFileBlocks|join('')|raw }}
&lt;/div&gt;