From: Marc P. <ma...@an...> - 2006-03-27 10:01:41
|
On 27 Mar 2006, at 02:47, Sven Schliesing wrote: > That's exactly what I looked for. > There's another, potentially cleaner way... ----------------- "mymacros.wmm": #macro formatDate($d) $Text.formatDate($d, "dd.MM.yyyy, HH:mm") #end ----------------- "yourtemplate.wmt": #include as macro "mymacros.wmm" #formatDate($createdAt) That's the way I would do it, as the usage is cleaner. However using directives/macros has the disadvantage of whitespace confusion/ issues. i.e. <img alt="#formatDate($createdAt)"/> is problematic, you have to do <img alt=" #formatDate($createdAt)"/> ... intuitive eh :( ! Personally, I wish that #macro or a similar macro function did not define what looks like a "directive". "#directive" would have been the right name for #macrom with hindsight (although caveats about not really being a directive!)... and in a strict sense I think it would have been nicer (with hindsight) to make it so that you have to use a directive to eval them. Injecting directive look-alikes into the templates like this is potentially confusing. cheers |