[Pmwiki-users] Re: null characters or pattern breaking characters

John Rankin john.rankin
Mon Jan 12 17:32:38 CST 2004



On Tuesday, 13 January 2004 12:15 PM, Patrick R. Michaud <pmichaud at pobox.com> wrote:
On Tue, Jan 13, 2004 at 10:47:44AM +1300, John Rankin wrote:
> 
> On Tuesday, 13 January 2004 7:50 AM, Christian Ridderstr?m <chr at home.se> wrote:
> > But inspired from John's suggestion, how about using '`.` as markup for 
> > the token though? The idea would be that it 'reminds' us of the 'STOP' in 
> > telegrams...
> 
> ===
> Christian, this also perhaps offers a better way to solve the : problem
> in [[toc:]] markup.
>
> [...discussion deleted for brevity...]
>
> Alternative: A possibly better approach would be to act only on 
> instruction from the author. 

An implementation suggestion:  If you're going to define a multi-character
sequence to indicate "non-rendering markup stop", then perhaps it'd make
implementations easier if early in PmWiki's processing the multi-character 
sequence is converted into a single non-printing character before
any other processing takes place.  This would make it easier for regexps
to match everything up to the stop (as we've already noted, it's much
easier to exclude single characters than sequences of characters in regexps).  
The non-printing characters could then be removed from the text just
prior to output.

Just a thought.

Pm
===
Good point (as always).

While I hadn't really thought through implementing this, I had expected in 
my examples to do something like:

    $text = preg_replace("/`\\.(.*?)$/","",$text);

or the longer

   if (strstr($text,'`.')) $text = substr($text,0,strpos($text,'`.'));

In the cases where one wants to stop a pattern match, like Christian's
URI inside a || ... || or a @@ ... @@, the ` alone should be enough to
stop the pattern, given the change you proposed earlier.

A lot of the intra- and inter-page text extractions work off the raw
$page['text'], so I *think* I'm stuck with looking for the original
stop markup.

I'll give it a try, using `. as a test stop markup, and report back.

JR
--
Pmwiki-users mailing list
Pmwiki-users at pmichaud.com
http://pmichaud.com/mailman/listinfo/pmwiki-users_pmichaud.com






More information about the pmwiki-users mailing list