Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect whether children are defined #36

Open
mschoettle opened this issue Mar 4, 2023 · 1 comment
Open

Detect whether children are defined #36

mschoettle opened this issue Mar 4, 2023 · 1 comment

Comments

@mschoettle
Copy link
Contributor

I wanted to build a component where the children are optional and that depending on the presence of children the output is different.

I tried to detect it via children|length but since it also contains whitespace (see example below) that did not work.

    {% #menu title="Test" %}
    {% /menu %}

In this example children|length returns a number > 0 since there is whitespace.

    {% #menu title="Test" %}{% /menu %}

Here children|length returns 0.

Is this possible at all to detect this?

@vsajip
Copy link

vsajip commented Aug 4, 2023

Have you tried children.strip|length?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants