[Pmwiki-users] Re: Acrobatics while typing [:...:] and math markup

Patrick R. Michaud pmichaud
Fri Oct 1 13:53:49 CDT 2004


On Fri, Oct 01, 2004 at 09:44:17PM +0200, chr at home.se wrote:
> On Fri, 1 Oct 2004, Patrick R. Michaud wrote:
> > On Fri, Oct 01, 2004 at 06:04:48PM +0200, chr at home.se wrote:
> > 
> >    $ROSPatterns['/\\(:.*?:\\)/'] = '[:$1:]';
> 
> Would this also handle something like this:
> 	some long complicated text (:Some directive \
> 	continued directive:)
> Or is line continuation not allowed inside directives?

I haven't considered the possibility of line continuations within directives
yet.  But the pattern as written above wouldn't handle it (but could
probably be made to do so).

> > Doesn't need to -- it's looking for the (: ... :) pattern, not the
> > directive name.
> Ok, so it's only a matter of really bad luck if an author would manage to 
> write something like:
> 	I was miserable when I woke up (:, but then I got cake :)
> which then on save would be converted into:
> 	I was miserable when I woke up [:, but then I got cake :]
> Anyway, this seems very unlikely, so I could probably live with it that 
> minor problem.

And, we can make things a bit stricter still, by requiring directives
to always begin with a letter:

     $ROSPatterns['/\\(:([[:alpha:]].*?):\\)/'] = '[:$1:]';

> Just like we have a 'replace on save pattern', could we have a 'replace
> before edit pattern'? The idea is that this pattern would replace all
> [:xxx:] with (:xxx:) before the author sees the source in the edit form.

Although I don't plan to support it directly with something analogous
to $ROSPatterns, it *is* (easily) possible to do this in v2.  

> I'm still not so comfortable with this idea... the author won't actually 
> be seeing the "real" code. But maybe that doesn't matter?

Oh, I'm not necessarily comfortable with it either--I much prefer the
markup remain the same and not get switched on the author.  But if
we remain with [:...:], this could at least provide *some* relief to the
non-keyboard gymnasts among us.  :)

Pm



More information about the pmwiki-users mailing list