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

Jonathan Scott Duff duff
Wed Nov 3 16:22:12 CST 2004


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>');


And markup like so:

(:actors fred other:)
!!! Conversations with Profile:Other
2004-11-03
                                                                                
=fred

Hi, how are you doing?
     
=other
I'm fine, what's up

=
''Long break, got some tea''
                                                                                
=fred
Nothing much, pretty good man.
                                                                                
Today I rode my MC to work, the weather was nice:-)


__END__

I just dreamt this up so there are some warts.  Most notably if you
use a =name without a corresponding name in the (:actors:) directive,
you get errors from pmwiki. It's very fragile.  But you get the idea
hopefully.

-Scott
-- 
Jonathan Scott Duff
duff at pobox.com



More information about the pmwiki-users mailing list