[Pmwiki-users] Smart Quotes

Patrick R. Michaud pmichaud at pobox.com
Wed May 28 09:58:33 CDT 2003


On Wed, May 28, 2003 at 10:14:41AM +1200, John Rankin wrote:
> 
> My first reaction is that there probably are going to be some problems
> with the HTML, although off-hand I can't think of where.  Certainly there
> will be problems with quotes in the [[table ...]] and ||-table markups.
> WikiStyles are probably okay (so far) because quotes aren't part of
> WikiStyles (yet).
> --
> I found a problem with || [[http://... http://...gif]] || -- the align attributes are getting smart quoted (I need to investigate this further to work out exactly what's happening)

One solution might be to not smart quote anything that follows an equals
sign, since that's how attributes are always specified in PmWiki.  

> I think that for smart quotes to be truly smart one should make sure
> they're paired and in the right location--i.e., I'd do a replacement
> like along the lines of (I'm writing off the top of my head here so don't
> hold me to this):
> --
> Well, I'd expect '80s and '90s and don't all to become ’
> 
> The killer is this 'n' that, which should be ’n’ -- hence the back tick

In that case, perhaps the best thing to do is to take care of the &lsquo's
first (which are generally paired and do not stand alone), then anything 
that remains that is converted to an &rsquo, unless it's part of an HTML
tag attribute (finding this last part might be a bit tricky).  For this
last part, maybe something like:

   $InlineReplacements("/'([^>]*(<|\$))/"] = "'&rsquo;\$1'";

which says to replace any single quote that is not followed by a '>'
(the closing part of an HTML tag) up to a '<' or the end of the string--
i.e., quotes that aren't part of an HTML tag.  There might need to be
some global modifiers added to this pattern to deal with multiple
quotes outside of tags.

Just a thought.  Interesting problem.

Pm




More information about the pmwiki-users mailing list