On Mon, Oct 5, 2009 at 4:10 AM, Hans <[email protected]> wrote:
>
> 2009/10/5 The Editor <[email protected]>:
>
>> However, it does suggest a solution though... What if when injected a
>> snippet into a zone, we simply processed these prior rules only, then
>> injected it as raw markup from that point on--as you suggest. This way
>> we would not lose any functionality, solve all these sorts of
>> escape/unescape problems, and not require any special code in
>> functions/conditions. It also saves processing time--as we only do the
>> processing we need when we want to.
>>
>
> Yes, this makes total sense. Its like Pmwiki's PRR function: Redo Ruleset.
> I guess BOLTdomarkup($out, '', '', 'pre'); restarts at the 'pre' stage?
Yes, except it ONLY does the PRE rules, nothing beyond that.
> The new BOLTMsnippets() behaves fine so far.
>
> BTW:
> why do you need to strip enclosing <p> </p> tags? Where would they come from?
BoltWire tries to automatically wrap lines with p tags. Not always
perfectly. If it is a setting or a url or something like that (a
single line) we don't want those tags injected into the skin. Like a
css color or something.
> I would write:
>
> if ('<p>' . substr($out, 3, -4) . '</p>' == $out)
> $out = substr($out, 3, -4);
> as
> $out = preg_replace("/^<p>(.*?)<\\/p>$/s", '$1', $out);
>
> to strip out enclosing <p> </p> tags.
> It is not slower and easier to read for me.
I don't know how to realistically verify this, but I've been told
string handling is significantly faster than regex. That's why I try
to use these functions whenever possible.
> In fact, depending on the <p>..<p> replacement, you could write the
> whole BOLTMsnippets function like this:
>
> function BOLTMsnippets($var, $page='', $rules) {
> ## TAKES SNIPPETS AND PREPARES FOR DISPLAY IN PAGE OR SKIN
> $out = BOLTdomarkup(BOLTsnippets($var, $page), '', '', $rules);
> return preg_replace("/^<p>(.*?)<\\/p>$/s", '$1', $out);
> }
This is an excellent idea. Also gives some extra possibilities for
plugin developers. I'll do it later today.
> I replaced $skin with $rules to use the value directly in the BOLTdomarkup
> call.
> It needs further change to markups.php line 18 Markup('pre', 'snippets',
> add third argument to BOLTMsnippets call: "pre":
> Markup('pre', 'snippets', '/......./e', 'BOLTMsnippets("$2",
> "$3", "pre")');
> and change to engine.php function BOLTloadpage line 1495
> change third arg of BOLTMsnippets to '' or false
> $out = preg_replace('/....../e', "BOLTMsnippets('$2', '$3', false)",
> $out);
Right. Thanks for the good suggestion.
Cheers,
Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"BoltWire" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/boltwire?hl=en
-~----------~----~----~----~------~----~------~--~---