[pmwiki-users] ExtendedMarkup WikiWord Error

Patrick R. Michaud pmichaud at pobox.com
Wed Mar 30 15:43:26 CST 2005


On Thu, Mar 31, 2005 at 09:28:22AM +1200, John Rankin wrote:
> 
> This is a known limitation in how ExtendMarkup handles smart quotes.
> 
> In short, if an html tag < ... > breaks across more than 2 lines,
> the piece of code that ignores quotes inside < ... > breaks.

Oh!  Did you try adding the /s option to the relevant patterns?
I'm guessing that the code to handle this is given in:

    ## automatic smart quotes
    Markup('<n>','<squo',"/\s?\n\s*([^<]+?>)/",' $1');
    Markup('squo','>style',"/(<.*?>['\"]*)|(.?['\"]+)/e",
        "BypassHTML(PSS('$1'),PSS('$2'))");
    Markup('sq|','>inline',"/(\\[\\[[^|\\]]+\\|)(.*?)(\\]\\])/e",
      "'$1'.SmartenLinkText(PSS('$2')).'$3'");
    Markup('sq->','>inline',"/(\\[\\[)([^\\]]+?)(-+&gt;.*?\\]\\])/e",
      "'$1'.SmartenLinkText(PSS('$2')).'$3'");

By default the '.' in a pattern doesn't match newlines, but adding
the 's' option, as in 

    ## automatic smart quotes
    Markup('<n>','<squo',"/\s?\n\s*([^<]+?>)/",' $1');
    Markup('squo','>style',"/(<.*?>['\"]*)|(.?['\"]+)/es",
        "BypassHTML(PSS('$1'),PSS('$2'))");
    Markup('sq|','>inline',"/(\\[\\[[^|\\]]+\\|)(.*?)(\\]\\])/es",
      "'$1'.SmartenLinkText(PSS('$2')).'$3'");
    Markup('sq->','>inline',"/(\\[\\[)([^\\]]+?)(-+&gt;.*?\\]\\])/es",
      "'$1'.SmartenLinkText(PSS('$2')).'$3'");

will tell those .*?'s that they can match newlines as well.  There
may be other reasons why it's not working (or won't work), but this
is my first guess/thought about it.

Or, one could conceivably convert any newlines found inside 
< ... > into spaces before doing the rest of the pattern matches.  But
the /s solution above is probably vastly superior and faster.

Pm



More information about the pmwiki-users mailing list