This email doesn't seem to got to the list, so here it's again:
Please, how to URL-escape both text and color attribute in perlcode?
- Robert
$self -> AddTagBlock ('h2', ['color'], undef, undef, { perlcode => q{
{ local $escmode = 0;
_ep_rp(%$x%, "<h2><img src=\"/img/h2.gif?color=%&color%&text="
. XML::Embperl::DOM::Node::iChildsText(%$n%)
. "\"></h2>");
}}
}) ;
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
RobertCZ wrote:
> 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
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?
Thanks
- - Robert
- -------------------------------------
package Embperl::Syntax::Adria ;
use Embperl::Syntax qw{:types} ;
use Embperl::Syntax::HTML ;
use strict ;
use vars [EMAIL PROTECTED] ;
@ISA = qw(Embperl::Syntax::HTML) ;
sub new {
my $class = shift ;
my $self = Embperl::Syntax::HTML::new ($class) ;
Init ($self) ;
return $self ;
}
sub Init {
my ($self) = @_ ;
$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%)
. "\">");
}}
}) ;
}
1;
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFDzsosiDzLDya+v2wRAjj8AKDBuHkAABJJkVgAdIn74yy4uyl+XgCgumMe
6lTaVq5mE2w0hHOalh3MqXg=
=k23j
-----END PGP SIGNATURE-----
--- End Message ---
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]