Nunjucks: Passing an object as parameter in macro
<p>I'd like to create some nested macros. One for a section, and in there I'd like to call the macro of any component dynamically. (In this case the component I want to call is <code>article</code>.)</p>

<p>Here's my section macro:</p>

<pre><code>  &lt;!-- section.nunjucks --&gt;
  {% macro section(config) %}
    &lt;section class="site__section section"&gt;
      {% for item in config %}
        {{ item.macro(item.settings) }}
      {% endfor %}
    &lt;/section&gt;
  {% endmacro %}
</code></pre>

<p>Component macro:</p>

<pre><code>  &lt;!-- article.nunjucks --&gt;
  {% macro article(settings) %}
    &lt;article class="article {{ settings.classes }}"&gt;
      &lt;h1 class="article__title"&gt;Hello World&lt;/h1&gt;
      &lt;p class="article__body"&gt;Lorem ipsum dolor.&lt;/p&gt;
    &lt;/article&gt;
  {% endmacro %}
</code></pre>

<p>And i'm trying to call it here:</p>

<pre><code>{{ section([{'macro': article, 'settings': {'classes': 'article--large'}}]) }}
</code></pre>

<p>I get a syntax error for this bit: <code>'settings': {'classes': 'article--large'}</code></p>

<p>How can I pass in <code>settings.classes</code> as a parameter, when calling my <code>settings</code> macro?</p>