You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Documentation says that template can "contain arbitrary number of functions".
But is it a requirement?
Say I don't need code reuse in my template. I just have some literal text inside {% %} block, and text of this block contains variables {%s strvar %} here and loops {% for _, v := range arr %}{%s v %}{% endfor %} there.
Do I need to wrap this into some function?
If not, what method do I call to get rendered result?
Example:
{%
Some verbatim text of my template. Lorem ipsum maybe.
But then I want to insert some {%s string %}.
And even iterate over a loop:
{% for i, v := arr %}
{% if i < 5 %}{%s v %}{% endif %}
{% endfor %}
The end!
%}
Is this a legal template?
The text was updated successfully, but these errors were encountered:
Documentation says that template can "contain arbitrary number of functions".
But is it a requirement?
Say I don't need code reuse in my template. I just have some literal text inside
{% %}
block, and text of this block contains variables{%s strvar %}
here and loops{% for _, v := range arr %}{%s v %}{% endfor %}
there.Do I need to wrap this into some function?
If not, what method do I call to get rendered result?
Example:
Is this a legal template?
The text was updated successfully, but these errors were encountered: