[pmwiki-users] Markup() with _?

Patrick R. Michaud pmichaud at pobox.com
Sun Aug 21 10:02:34 CDT 2005


On Sun, Aug 21, 2005 at 01:09:18PM +0200, Thomas -Balu- Walter wrote:
> I'm a little over-worked at the moment, so I might just not see the
> reason. Just point me somewhere if it is this way.
> 
> I am trying to add a new Markup like
> Markup('somemarkup', 'inline', '/&some_markup;/', 'some replacement');
> 
> However it seems that having an underscore does not work there?
> Everything works fine, if I remove the "_".

&'s are special in the source markup, one of the first things that
the markup engine does (before processing any markup rules)
is convert all &'s, <'s, and >'s into "&amp;", "&lt;", and "&gt;".  

So, before any markup rules are processed, "&somemarkup;" and
 "&some_markup;" are converted to "&amp;somemarkup;" and 
"&amp;some_markup;".

Later, in the directives section, the '&' rule "undoes" the "&amp;"
conversion for things that are valid named character entities; i.e., it
converts "&amp;somemarkup;" back to "&somemarkup;" to be output
to the browser.  Thus your Markup rule is able to correctly find
"&somemarkup;".

However, AFAICT underscores aren't allowed in named character
entities, so the '&' rule doesn't undo the "&amp;" in "&amp;some_markup;".
So, your Markup rule isn't matching in that case.

My suggestion would be to move your rule to execute before
the '&' rule, and to match "/&amp;some_markup;/".

Pm





More information about the pmwiki-users mailing list