response
[ikiwiki] / doc / todo / meta_rcsid.mdwn
1 The following patch adds an 'rcsid' parameter to the Meta plugin, to allow inclusion 
2 of CVS/SVN-style keywords (like '$Id$', etc.) from the source file in the page template.
3
4 > So the idea is you'd write something like:
5
6 >       \[[meta rcsid="$Id$"]]
7
8 > And this would be put at the bottom of the page or somewhere like that by
9 > the template?
10
11 > I wonder if it wouldn't be just as clear to say:
12
13 >       <span class="rcsid">$Id$</span>
14
15 > And then use a stylesheet to display it as desired.
16 > --[[Joey]]
17
18     --- meta.pm.orig    2007-10-10 19:57:04.000000000 +0100
19     +++ meta.pm 2007-10-10 20:07:37.000000000 +0100
20     @@ -13,6 +13,7 @@
21      my %authorurl;
22      my %license;
23      my %copyright;
24     +my %rcsid;
25  
26      sub import { #{{{
27         hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1);
28     @@ -110,6 +111,9 @@
29             $meta{$page}.="<link rel=\"copyright\" href=\"#page_copyright\" />\n";
30             $copyright{$page}=$value;
31         }
32     +    elsif ($key eq 'rcsid') {
33     +        $rcsid{$page}=$value;
34     +    }
35         else {
36             $meta{$page}.=scrub("<meta name=\"".encode_entities($key).
37                 "\" content=\"".encode_entities($value)."\" />\n");
38     @@ -142,6 +146,8 @@
39             if exists $author{$page} && $template->query(name => "author");
40         $template->param(authorurl => $authorurl{$page})
41             if exists $authorurl{$page} && $template->query(name => "authorurl");
42     +    $template->param(rcsid => $rcsid{$page})
43     +        if exists $rcsid{$page} && $template->query(name => "rcsid");
44         
45         if ($page ne $destpage &&
46             ((exists $license{$page}   && ! exists $license{$destpage}) ||
47
48 [[patch]]