newsclipperdevlist  

Re: parsing ' or \' in NewsClipper tags

David Coppit
Tue, 13 Jul 1999 09:02:03 -0700

On Sun, 11 Jul 1999, Ryan wrote:

> I want to do something like this:
> 
> <filter name=map filter=hash2string format='
>    <a href="%{url}" onMouseOver="popup('%{description}');">%{name}</a>'>
> 
> But it gets parsed wrong because of the internal single quotes in the
> format tag.  Escaping (\') the internal single quotes doesn't work.  Any
> ideas?  Could NW be made to look for escaped characters (or at least a
> single quote ;-)?

Hm... I rely on HTML::parser to take care of this. You might try this: in
HTML::Parser, line 172, change:
                    } elsif ($$buf =~ s|(^=\s*([\"\'])(.*?)\2\s*)||s) {
to
                    } elsif ($$buf =~ s|(^=\s*([\"\'])(.*?)[^\\]\2\s*)||s) {
which *should* allow you to escape the ' with a \.

RFC1866 doesn't allow the quote to be in the string, and says you have to use
&#34; for double quotes and &#39; for single quotes.
(http://www.faqs.org/rfcs/rfc1866.html) Try that, I guess. BTW, are you sure
you need to put single quotes in the popup? You could use EscapeHTMLChars
(from HTMLTools) on %{description} in the handler.

Good luck,
David

_________________________________________________________________________
David Coppit - Graduate Student        [EMAIL PROTECTED]      
The University of Virginia             http://coppit.org/
    "Yes," said Piglet, "Rabbit has Brain." There was a long silence.
"I suppose," said Pooh, "that that's why he never understands anything."


-
If you would like to unsubscribe from this mailing list send an email to 
[EMAIL PROTECTED] with the body "unsubscribe newsclipperdevlist 
YOUR_EMAIL_ADDRESS" (without the quotes) or use the form provided at 
http://www.NewsClipper.com/TechSup.htm#MailingList.