21 Aug 11:09
Re: Bug report: Dollar follwed by a name gets lost
From: Mark Holland <mark@...>
Subject: Re: Bug report: Dollar follwed by a name gets lost
Newsgroups: gmane.comp.lang.perl.modules.petal
Date: 2008-08-21 09:09:51 GMT
Subject: Re: Bug report: Dollar follwed by a name gets lost
Newsgroups: gmane.comp.lang.perl.modules.petal
Date: 2008-08-21 09:09:51 GMT
On 21/08/08 06:48, Thedi Gerber wrote: > We are currently starting a new project and would like to use Petal. > While doing some exercises to get to know it, i tried to include a small > example perl script in a template. To my surprise, variable names in the > perl source were lost. > > After some more tests, I came to this conclusion: > > $variable IN THE template magically disappears > $1000 is ok > $n is ok (single letter following a $) > <span tal:content="xx">...</span> replaces the content always ok Petal is interpolating $variable with parameters passed through ->process(). If you were to pass through 'variable' as a argument you would see it printed. ($1000 and $n are not regarded as valid variable names). E.g. if you were to change the following in your example: my %content_data = (nn => 'foo'); my $task_result = $task->process( \%content_data ); you will see the output: "but nn dollars disappear <b>foo</b>!" I've forgotten if there's a proper way to escape dollar characters in Petal, but one work around would be to use html entites, e.g.: This costs $45 Cheers ~mark
RSS Feed