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

Question: Is there a way to nest tags #311

Open
otusweb opened this issue Jul 22, 2021 · 1 comment
Open

Question: Is there a way to nest tags #311

otusweb opened this issue Jul 22, 2021 · 1 comment

Comments

@otusweb
Copy link

otusweb commented Jul 22, 2021

I'm trying to create a stencil for a document that consists of two columns and where I want the left column to be left justify and the right column right justified. ie:

abcd     efgh
abc       fgh
abcd     efgh
abc       fgh 

I could write a custom tag that would take the width of the page and the two parameters and this would work fine.
The problem I run into is that each string would itself need to be a tag/variable (the left side are localised strings, the right side is data coming from app.

Any idea on how to do this?

@djbe
Copy link
Contributor

djbe commented Jul 30, 2022

I don't see why the parameters of your tag/filter/… can't be variables. See for example the for tag, it accepts both constants & variables:

{% for item in myArray %}…{% endfor %}

{% for item in 1...3 %}…{% endfor %}

So if you have a custom tag, you could accept multiple parameters, mixes of constants and variables. See the call tag in StencilSwiftKit:

{% call myMacro "myString" myVariable "someOtherString" %}

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