[Pmwiki-users] Documenting conversations/messages (was: wikistyles and blocks

chr@home.se chr
Wed Nov 3 16:40:52 CST 2004


On Wed, 3 Nov 2004, Jonathan Scott Duff wrote:

> On Wed, Nov 03, 2004 at 11:32:24PM +0100, chr at home.se wrote:
> > But I'm sure there are better solutions. Any ideas?
> 
> Here's an idea.  A customization in config.php like so:
> 
> function CreateActors($str) {
>    global $BlockMarkups,$HTMLStylesFmt;
>    $colors = array("red","blue","purple");
>    $actors = preg_split('/[\s,]+/', $str, -1, PREG_SPLIT_NO_EMPTY);
>    $BlockMarkups["actor_NULL"] = array('</div>','',"<div>");
>    $i = 0;
>    foreach ($actors as $a) {
>       $HTMLStylesFmt[] = ".actor_$a { color:$colors[$i]; }\n";
>       $BlockMarkups["actor_$a"] = array('</div>','',"<div class='actor_$a'>");
>       $i = ($i + 1) % count($colors);
>    }
>    return '';
> }
> 
> Markup('actors', '_begin', '/^\\(:actors\\s+(.*?):\\)/e', 'CreateActors("$1")');
> Markup('nullactor', 'block', '/^=$/', '<:actor_NULL,0>');
> Markup('actor', 'block', '/^=(\\w+)$/', '<:actor_$1,0>');

Very nice work Scott!

I think it does exactly what I wanted. Sure, you can add some bells and 
whistles like predfined colours for certain actors etc, but the basic 
functionality is there. I think this has potential for serious use.

Tomorrow I'll start a cookbook page on it. Any ideas for a name?

	Cookbook/DialogMarkup
	Cookbook/Manuscript

/Christian

-- 
Christian Ridderstr?m, +46-8-768 39 44               http://www.md.kth.se/~chr




More information about the pmwiki-users mailing list