[pmwiki-users] em dashes (was: Minor markup request)

John Rankin john.rankin at affinity.co.nz
Mon Sep 26 16:54:19 CDT 2005

On Saturday, 24 September 2005 3:59 AM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
>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&mdash;$2'); to my
>> local/config.php. It works, but is this OK? Yes, I'm a
>If the above works in MarkupExtensions, it should work by
>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 "---->" 
Just be aware that a consequence of the alternate version is for
markup of the form [[link | text -- with an em dash]] won't get
converted to &mdash; -- the rule will execute after links have
been evaluated and put into the Keep function. In particular,
links in a page table of contents (:toc:) will lose em dashes.

This may or may not be an issue, depending on the site. My
approach was that em dashes ought to be recognised wherever
they fell, rather than just in running prose.

John Rankin

More information about the pmwiki-users mailing list