Closed cmvanb closed 1 year ago
Files are actually a special kind of alternate. (only one file is ever considered for templates that target a particular path, and it is based on the ordering of the file names, the last one found)
Instead of attempting to combine the example identifiers in the filename, the template should be created like this:
{% if yadm.class == "example" %}
This block is included for class example
{% else %}
This block is included if the class is not example
{% endif %}
Can you merge the content into a single template for the file which has different sections based on class?
Thank you for your reply. Yes I did eventually come to that solution.
I would have preferred to use separate files (it feels more cleanly separated), but the class conditional works as needed.
It wasn't clear to me from the documentation that templates and alternates cannot be combined.
Shall I close this issue?
This issue has been labeled as stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue was closed because it has been labeled as stale for 7 days with no activity.
Describe the bug
A template with an alternate condition that should be matched is not used.
To reproduce
Steps to reproduce the behavior:
yadm init
yadm config local.class example
echo "aaa" > file.txt##template
yadm add file.txt##template
echo "bbb" > file.txt##class.example,template
yadm add file.txt##class.example,template
yadm alt
Expected behavior
I expected the following:
Instead this happens:
Environment
Additional context
I was able to reproduce this with the docker image: script.gz