[pmwiki-users] Minor markup request

Patrick R. Michaud pmichaud at pobox.com
Fri Sep 23 10:59:21 CDT 2005

On Fri, Sep 23, 2005 at 11:09:28AM +0200, Robert Riebisch wrote:
> John Rankin wrote:
> > The MarkupExtensions almost does this.
> > See http://www.wikipublisher.org/wiki/index.php?n=Wikipublisher.MarkupExtensions#toc1
> But how to do it w/o MarkupExtensions?
> I just copied
> Markup("--",'>[+',"/(^|[^!-])--([^-&>]|$)/",'$1—$2'); to my
> local/config.php. It works, but is this OK? Yes, I'm a perfectionist.

If the above works in MarkupExtensions, it should work by itself.

Another version of this rule that might be slightly faster for
markup processing is:

    Markup('--', '>^----',
      '/(?<!-|<!)--(?![->])/', '&mdash;');

Essentially, we're converting any '--'s to '&mdash' except for those
that are part of HTML <!--...--> comments or are in the middle of a
long sequence of -----'s.  And doing the change as '>^----'
means that we've already handled horizontal rule and "---->" 


More information about the pmwiki-users mailing list