]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blob - IkiWiki/Plugin/localstyle.pm
a branch to change pagenames semantics exists
[git.ikiwiki.info.git] / IkiWiki / Plugin / localstyle.pm
1 #!/usr/bin/perl
3 package IkiWiki::Plugin::localstyle;
5 use warnings;
6 use strict;
7 use IkiWiki 3.00;
9 sub import {
10         hook(type => "getsetup", id => "localstyle", call => \&getsetup);
11         hook(type => "pagetemplate", id => "localstyle", call => \&pagetemplate);
12 }
14 sub getsetup () {
15         return
16                 plugin => {
17                         safe => 1,
18                         rebuild => 1,
19                 },
20 }
22 sub pagetemplate (@) {
23         my %params=@_;
24         
25         my $template=$params{template};
26         
27         if ($template->query(name => "local_css")) {
28                 my $best=bestlink($params{page}, 'local.css');
29                 if ($best) {
30                         $template->param(local_css => $best);
31                 }
32         }
33 }
35 1