diff options
author | Jonas Smedegaard <dr@jones.dk> | 2010-08-27 10:01:58 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2010-08-27 10:01:58 +0200 |
commit | f398ad035b973608d380c9939ea845d8e2a0cdc2 (patch) | |
tree | 1ba1a0c94e375ab8ed609eaa57a542c6b87de5a8 /IkiWiki/Plugin/localstyle.pm | |
parent | 958e5735c946263a111420fe47abe58782581e8c (diff) | |
parent | 6d213a0c739d5b34357b01a616f99197eeba6ad9 (diff) |
Merge branch 'master' of git://git.ikiwiki.info
Diffstat (limited to 'IkiWiki/Plugin/localstyle.pm')
-rw-r--r-- | IkiWiki/Plugin/localstyle.pm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/localstyle.pm b/IkiWiki/Plugin/localstyle.pm new file mode 100644 index 000000000..111f4dc30 --- /dev/null +++ b/IkiWiki/Plugin/localstyle.pm @@ -0,0 +1,35 @@ +#!/usr/bin/perl + +package IkiWiki::Plugin::localstyle; + +use warnings; +use strict; +use IkiWiki 3.00; + +sub import { + hook(type => "getsetup", id => "localstyle", call => \&getsetup); + hook(type => "pagetemplate", id => "localstyle", call => \&pagetemplate); +} + +sub getsetup () { + return + plugin => { + safe => 1, + rebuild => 1, + }, +} + +sub pagetemplate (@) { + my %params=@_; + + my $template=$params{template}; + + if ($template->query(name => "local_css")) { + my $best=bestlink($params{page}, 'local.css'); + if ($best) { + $template->param(local_css => $best); + } + } +} + +1 |