perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RobertCZ <rob...@robert.cz>
Subject Re: Redefining common tags? (partial solution)
Date Mon, 23 Jan 2006 23:18:13 GMT
Gerald Richter wrote:

>Try
>
>$self -> AddTagBlock ('h2', undef, ['color'], undef, { perlcode => q{
>         { local $escmode = 0;
>             _ep_rp(%$x%, "<img src=\"/img/h2.gif?color=" 
>             . $epreq -> Escape (%&'color%, 2) . "&text="
>             . $epreq -> Escape (XML::Embperl::DOM::Node::iChildsText(%$n%),
>2)
>             . "\">");
>         }}
>     }) ;
>  
>

Excellent!!! It works!

One more problem: the escaping ( initial local $escmode = 0 ) stops 
workins after first use and only is restore when some Embperl processed 
HTML is found eg

<h2 color="#F00">111</h2><br>
<h2>222</h2><br>
<h2>333</h2><br>
<ul></ul>
<h2>444</h2><br>
<h2>555</h2><br>

results in

<img src="/img/h2.png?color=%23F00&text=111"><br>
&lt;img src=&quot;/img/h2.png?color=&amp;text=222&quot;&gt;<br>
&lt;img src=&quot;/img/h2.png?color=&amp;text=333&quot;&gt;<br>
<ul></ul>
<img src="/img/h2.png?color=&text=444"><br>
&lt;img src=&quot;/img/h2.png?color=&amp;text=555&quot;&gt;<br>


One more help, please... Thank you very much.

- Robert


>>3) it doesn't output outmost <h2> which is usefull for CSS 
>>styling, how can I add it so it down't go into endless loop?
>>    
>>
>
>I don't understand the last question, could you give an example?
>  
>

I had problem when <h2> tag was replaced by <h2><stuff> and I supposed 
it dumps core because of some endless loop, but it was an unrelated 
problem. My mistake.



Mime
View raw message