Skip to content

includes

Nat! edited this page Mar 1, 2023 · 3 revisions

includes predictably reads in another file. It's like copy/paste but MulleScion does the work for you. The contents are parsed just like any regular template text.

There is a special includes verbatim. It reads the contents of a file but doesn't parse it. You can also use includes optionally, which doesn't raise an error, if the file doesn't exist. And you can combine both into includes optionally verbatim

Here we include the file set.scion and have the comments parsed away

Example 1

{% includes "__demo.scion" %}

Output:

Here is just some plaintext and an expression

and the file included verbatim

Example 2

{% includes verbatim "__demo.scion" %}

Output:

{% block demo %}
Here is just some plaintext and {{ @"an expression" }}
{% endblock %}

includes can't be used in multi-line statements.

There is a "hack" method to perform some filtering on includes. You can add a -NSData method after includes, that will filter the included data.

Example 3

self does nothing (but it also produces no error):

{% includes verbatim self "__demo.scion" %}

Output:

{% block demo %}
Here is just some plaintext and {{ @"an expression" }}
{% endblock %}
Clone this wiki locally