Optionally add indentation to maps
[ikiwiki] / IkiWiki / Plugin / localstyle.pm
1 #!/usr/bin/perl
2
3 package IkiWiki::Plugin::localstyle;
4
5 use warnings;
6 use strict;
7 use IkiWiki 3.00;
8
9 sub import {
10         hook(type => "getsetup", id => "localstyle", call => \&getsetup);
11         hook(type => "pagetemplate", id => "localstyle", call => \&pagetemplate);
12 }
13
14 sub getsetup () {
15         return
16                 plugin => {
17                         safe => 1,
18                         rebuild => 1,
19                 },
20 }
21
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 }
34
35 1