[cgi-wiki-dev] CGI::Wiki::Kwiki enhancements

Tom Insam cgi-wiki-dev@earth.li
Tue, 21 Oct 2003 09:33:22 +0100


At 21:44 +0100 2003/10/20, Kate L Pugh wrote:
>I'd particularly like Jerakeen's input on this.

awww, I'm touched.

>The flagging is easy - I just use CGI::Wiki directly and create a node
>with Category metadata of "Yarn".  The link is easy too - I pass a
>Template Toolkit variable containing a suitable query URL to the
>template processor.
>
>Ah.  How do I pass a Template Toolkit variable in to CGI::Wiki::Kwiki
>and be sure it gets passed on to the template?

Is the meta-data not exposed to the template? I'd personally put the 
logic in the template, because I'm like that.

[% IF metadata.is_yarn %]
<a href="[% root_of_site %]?node=Yarn%Database;yarn_colour=[% 
metadata.colour %]">look! yarn!</a>
[% END %]

I forget how the code actually works, I'm making those variables up, 
believe it or not. Hmm, I'll go dig.
..
gah
...
Kake, CGI::Wiki is missing a dep on DBI. And I have an amazingly 
bare-bones perl install...
...
Hmm, we don't pass metadata to the template. Urgh. I'll put a fix 
into CVS, diff from release (I think it's the release version) is

   --- lib/CGI/Wiki/Kwiki.pm       10 Oct 2003 22:24:36 -0000      1.7
   +++ lib/CGI/Wiki/Kwiki.pm       20 Oct 2003 22:45:01 -0000
   @@ -341,6 +341,7 @@
            node_name  => CGI::escapeHTML($node),
            node_param => CGI::escape($node),
            version    => $version,
   +        metadata   => $node_data{metadata},
        );
   
        if ( $node eq "RecentChanges" ) {

Not exactly rocket science. Works, too.

Now, if we _don't_ want the logic in the template... Hmm. Not sure. 
Don't know about that, I would like to pass through (a) all the 
config vars (after pulling the config out into a YAML file 
somewhere), (b) all the CGI params, so you can modify the rendering 
based on the CGI params and the wiki code doesn't need to know, and 
(c) arbirtrary data from the script.

But I think the way above is the Right Way.

-- 
.tom