01293: pre markup fails when using escape merkup

Summary: pre markup fails when using escape merkup
Created: 2012-07-20 22:14
Status: Closed
Category: Bug
From: CarlosAB
Assigned:
Priority: 2
Version: latest
OS: apache/php 5.3

Description: I believe this PITS entry is better described with an example:

PreAndEscape

The PmWiki escape markups are specifically selected to be [@...@] or [=...=] because these sequences are normally never found in other places, programming languages or punctuation. When the code you want to publish contains all these sequences, it may appear broken even if it does exactly what it should do. In the test page, after the opening [@ the markup engine looks for the first @] it finds, and it happens to find in the middle of your third line. :-)

There are two limited workarounds to this. One is to add a new sequence for escaping things, for example {=...=} or <nowiki>...</nowiki> as a custom Markup() and $EscapePattern rule. Obviously, if then you want to publish code containing these new sequences, it may again stop at the first closing sequence. The other limited workaround is to change your code so that it doesn't contain the exact sequences, for example splitting+concatenating a string, or write a little differently the published regular expression. Indeed limited. --Petko July 21, 2012, at 12:13 AM

I found other ways to workaround this, and also included it on the Test page above. Thanks. CarlosAB July 21, 2012, at 09:04 PM