summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/localstyle.pm35
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