Closed jradek closed 5 years ago
This isn't really a limitation of Bash. The error could be seen as a bug in mo
, but the real problem is that your use case falls into the category of logic, which Mustache templates do not support. If you want to demo this yourself, you could start with this demo, which uses the JavaScript library: https://codepen.io/fidian/pen/dwKGWV
This is not the right way to use a mustache template. You may want to consider writing a function to do the same thing. There's an example named demo/function-for-advanced-looping
that illustrates the function. You'll need to source mo
into the environment so it can access the functions, which is why the example says . ../mo
.
Hi,
I try to import/include files within a loop, like this.
Variables
FILENAMES=( file1.txt file2.txt )
Template
The statement
{{> .}}
triggers the errorI tried to debug the source code, with my limited knowledge about bash scripting, and the error seems to be in function
moParse
around line657
during the call ofmoPartial
. InsidemoPartial
, the local variablemoFilename
is assigned to.
. So the actual content of the current iteration, i.e.file1.txt
was not passed.I'm not sure, if the thing I try to accomplish is a limitation of bash or an actual bug in mo.
Thanks, JR