2009/3/17 Linly <[email protected]>:
>
> For example, putting a markup like [(poor text)] in "blog.header",
> then all the post under "blog.*" can only accept a certain kinds of
> markups (customizable) to be rendered to html, others will treat as
> pure text.
>
> linly

This is a very good idea. I've thought about doing something like this
for a long while, but never had the exact approach.  Mostly, I wanted
to be able to limit the kinds of markups that could be processed in a
comment box. But how is the question.

Your suggestion could work in very specific situation:  1) you only
are worried about the main zone, and 2) you always put the markup in
some zone processed before the main zone. But I feel it is too
limited.

One option I had considered is to do something like:

<rules if,style,end>
markup
</rules>

The code for this would be very easy. And perhaps could stand along as
a separate plugin. The problem is you have to manually enter the tags
wherever it is needed. This could be really nice if you used syntax
like

<comment>
markup
</comment>

And then not only made it styled (like a box), but have it process a
custom, limited list of markup rules. Easy to do... Here is some php
that could do something like this. Briefly tested

MarkUp('pre', 'commentbox',
'/&lt;commentbox>(.*?)&lt;\/commentbox>/se', 'BOLTMcommentbox("$1",
"code")');  // <commentbox>
function BOLTMcommentbox($text) {
        $text = BOLTdomarkup($text, '', '', 'style,end');
        return BOLTescape("<div class='box'>$text</div>");
        }

I might add this to the commentbox plugin as it would make a nice
addition. And could serve as a model for other plugin developers. I
wonder if a good commentbox shouldn't be added to the core?

Of course, again, this is not exactly what you wanted.  For that, I
just added a small hook in the BOLTdomarkup function which allows you
to create custom config.php/plugin function like this:

function myBOLTmarkupRules($page, $zone, $content='', $rules='') {
        if (BOLTpageCheck('test*', $page) == false) return $rules;
        if ($zone == 'main' || $zone == 'footer') return "if,style,end";
        }

This allows you to define which pages and zones get which rules and
based on any other conditions you want. Using the content parameter
you could do a scan for [(rules if,style,end)] and dynamically reset
the rules to the value of that function. Or anything else you want to
do. So, while this solution does require some php, it gives us the
kind of full flexibility we would want. And we could get multiple,
very interesting plugins out of the deal.

If you want to get started experimenting with this, add the following
to the very beginning of the BOLTdomarkup function. engine.php ~708

        if (function_exists('myBOLTmarkupRules')) $rules =
myBOLTmarkupRules($page, $zone, $content, $rules);

Let me know what you think!

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to