Hi (especially Sean O'Dell),
First of all, congratulations and thanks for cs/Template.
At last a simple to use and fast template system that is not a clone
of some overengineered Java monster.
Eminently useful.
But of course it could be even better: the main thing I have a (slight)
problem with, is the include macro.
${include /absolute/path/name} is problematic in maintenance,
${include relative/path/name} isn't too flexible.
It would be lovely if I could do: ${include /path/include} where
/path/include is a path in template data. Or maybe:
${include ${var /path/include}}
Something along the line of:
while ( '${' remaining in input)
input = macro_expand(input)
Cheers,
Han Holl
PS Tomorrow I'm leaving on a vacation, which means I will not
be able to express admiration and gratitude if you come up with something
brilliant for quite some time.
I think I'll make all macro parameters expect a data path, but create a new
way to specify literals.
It could work both like this:
${include data_path}
...and:
${include << /dir/filename}
You could also do something like this with ${each}:
${each << [a, b, c]}
${end}
...and this with ${with}:
${with << {a => "A"}}
${end}
It would apply to all macros, of course. I guess the literal could just be
any Ruby expression that returns a hash, array or value. So I suppose I
could do away with the ${eval} macro completely in favor of:
${var << eval_expression}
Thanks for the heads-up, and I'm glad you're getting good use from the
library.
Sean O'Dell
···
On Tuesday 13 July 2004 12:22, Han Holl wrote:
It would be lovely if I could do: ${include /path/include} where
/path/include is a path in template data. Or maybe:
${include ${var /path/include}}
Something along the line of:
while ( '${' remaining in input)
input = macro_expand(input)