[pmwiki-users] Re: Modified (:markup:)
Jonathan Scott Duff
duff at pobox.com
Mon Mar 21 10:25:46 CST 2005
On Mon, Mar 21, 2005 at 09:14:54AM -0600, Patrick R. Michaud wrote:
> On Mon, Mar 21, 2005 at 08:44:40AM +0100, Joachim Durchholz wrote:
> > Patrick R. Michaud wrote:
> > >I agree, but my implementation of [== ... ==] currently breaks in
> > >the face of text containing multiple [==]'s, so I have to either come
> > >up with a much better pattern or go back to the drawing board.
> >
> > Would a backreference work?
> >
> > \[(=*)[^=](.*?)\1\]
>
> The matching code already uses a backreference and no it doesn't work.
So what doesn't work exactly? You've got multiple [=...=] and the
pattern is ... ?
/\[(=+)(.*?)\1\]/ # ???
(Sorry, this is the first message in this thread that I've
read so I'm probably missing obvious things)
> > The (=*) captures the string of =s after the opening [ and stores them
> > in the $1 variable, the [^= makes sure that a non-= is between the
> > brackest-and-equals-signs delimiters (else we'd match stuff like [==]
> > and we don't want that - might be a useful markup for other purposes),
>
> Unfortunately, [==] is already valid markup and it's already being
> used for a variety of purposes. In particular, it can be used to
> prevent Wiki[==]Words, and I've used it to avoid processing something
> that would otherwise be a beginning of line markup. Thus:
>
> [==]** Line beginning with ''asterisks'', avoid Wiki[==]Word.
>
> Unfortunately, the regexp above (and various others I've tried)
> sees this as one big escape instead of two small ones, resulting in
>
> ]** Line beginning with ''asterisks'', avoid Wiki[Word.
Couldn't you special case the [==] markup? I.e. something like
Markup('[==]', '_begin', '/\\[==\\]/se', "Keep('')");
Or if there's some valid reason for someone to use a null
many-equal form,
Markup('[==]', '_begin', '/\\[(==)+\\]/se', "Keep('')");
-Scott
--
Jonathan Scott Duff
duff at pobox.com
More information about the pmwiki-users
mailing list