cs/Template

H

Han Holl

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.
 
S

Sean O'Dell

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)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,148
Messages
2,570,838
Members
47,385
Latest member
Joneswilliam01

Latest Threads

Top