Konafets / antlers-idea

Adds support for Antlers, the templating language of Statamic

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parse Antlers inside a parameter string value of another Antlers region.

Konafets opened this issue · comments

Antlers support the concept of interpolated statements, which means, one can insert Antlers into a Antlers node:

{{ items = {collection:products sort="rating:desc" limit="5"} }}

While this already works, I discovered a special case, where an Antlers switch statement is inserted into the string value of a class attribute:

{{ svg
    :src="type"
    alt=""
    aria-hidden="true"
    class="
        h-5 w-5 fill-current motion-safe:transition-colors
        { switch(
            (type == 'success') => 'text-green-800',
            (type == 'notice') => 'text-yellow-800',
            (type == 'error') => 'text-red-800',
            () => 'text-gray-800'
        )}
    "
}}