perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject RE: Redefining common tags? (partial solution)
Date Mon, 23 Jan 2006 17:22:04 GMT
Hi,

Sorry for my later answer...

> > I've never tried it before but I understand that Embperl 2 
> can define 
> > new tags - can it redefine common HTML tags too? I have stuff like 
> > <h2><img src='/img/h2.png?text=[+ "Title Title" +]'></h2>
> >   all over the place, it would be cool to just write <h2>Title 
> > Title</h2>
> Well, I ended up with
> 
> $self -> AddTagBlock ('h2', ['color'], undef, undef, { perlcode => q{
>         { local $escmode = 0;
>             _ep_rp(%$x%, "<img src=\"/img/h2.gif?color=%&color%&text="
>             . XML::Embperl::DOM::Node::iChildsText(%$n%)
>             . "\">");
>         }}
>     }) ;
> 
> which works, but it's ugly:
> 1) how can I make both %&color% and
> XML::Embperl::DOM::Node::iChildsText(%$n%) url-escaped? I 
> tried to play with $escmode but it doesn't seem to work and 
> anyway it looks like a hack so

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)
             . "\">");
         }}
     }) ;


> 2) how to do it with (I dont know, perhaps) _ep_rc?
> 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?

Gerald


 
** Virus checked by BB-5000 Mailfilter ** 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message