Hi, I am trying to create a new HTML tag <EPIMG ...> to be interpreted by Embperl as follows: I want <EPIMG SRC="foobar.gif" otherattrs=blah...> to be replaced with: <IMG SRC="foobar.gif" WIDTH=x HEIGHT=y otherattrs=blah...>
I have the following code in a subclass of Embperl::Syntax::HTML which almost gets me there: $self->AddTag('epimg', ['width', 'height'], ['src'], undef, { perlcode => 'my ($w, $h, $src); $w = %&width%; $h = %&height%; $src = %&src%; if (!defined $w && !defined $h) { ($w, $h) = my_own_func_to_get_img_dimensions($src); _ep_sa(%$t%, %$x%, "width", $w); _ep_sa(%$t%, %$x%, "height", $h); }', }); This gets me 90% of the way there. It adds the WIDTH and HEIGHT attributes to the tag (if they don't already exist). But I can't figure out a way to replace the EPIMG label with IMG. Any suggestions that someone may have would be appreciated. Another way I thought of doing this was to use _ep_rp() to replace the entire <EPIMG...> tag with a newly constructed <IMG...> tag. But I can't figure out a way to automatically copy all of the "otherattrs" mentioned in the EPIMG tag into the new replacement tag without having to specify an exhaustive list of all possible "otherattrs". For example: _ep_rp(%$x%, "<IMG SRC=\"$src\" WIDTH=$w HEIGHT=$h BORDER=%&border% ALIGN=%&align% onClick=%&onclick% onMouseOver=%&onMouseOver% .......") This is something I would like to avoid. Am I missing some obvious API that would allow me to add some simple code to my earlier piece of perlcode to replace the tag name EPIMG with IMG? Thanks, Yatin --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]