[pmwiki-users] Programmatically disabling MarkupExtensions

John Rankin john.rankin at affinity.co.nz
Tue Sep 3 16:08:06 CDT 2013

> My new reciped PmwikiGists has a conflict with one of the MarkupExtensions
> components -- "digit en-dash digit", specifically
> http://www.pmwiki.org/wiki/Cookbook/Gists
> http://www.pmwiki.org/wiki/Cookbook/MarkupExtensions
> The gist markup looks like this: (:gist id=5457652 line="2-4":) which will
> render as <code data-gist-id="5457652" data-gist-line="2-4"</code>
> The MarkupExtensions option "-d" converts the hyphen to an en-dash.
> They look almost visually identical, but the en-dash is not recognized by
> the third-party javascript library used in PmwikiGists.
> The only solution I've been able to come up with is adding
> $MarkupExtensions['-d'] = false;
> to local/config.php prior to including the MarkupExtensions recipe (as
> indicated in the MarkupExtensions documentation).
> The inclusion of a line parameter, or a range of lines is something that
> may only happen sometimes -- perhaps never -- on a particular page or
> entire wiki using this recipe.
> Is there any way to disable something like this only when that bit of
> markup is invoked?

I think the answer is for the gists recipe to "hide" the "2-4" from the
markup extension rule for -d. The d-d rule evaluates late in the sequence,
after links, whereas gist evaluates early, as part of inline.

Instead of return $gist; try return Keep($gist); -- this should prevent
subsequent markup rules from processing the contents of $gist.

John Rankin

More information about the pmwiki-users mailing list