diff options
-rw-r--r-- | README | 3 | ||||
-rw-r--r-- | ikiwiki.setup | 7 | ||||
-rw-r--r-- | ikiwiki_admin.setup | 7 | ||||
-rw-r--r-- | perl/IkiWiki/Plugin/farbar.pm | 53 | ||||
-rw-r--r-- | perl/IkiWiki/Plugin/topbar.pm | 53 |
5 files changed, 123 insertions, 0 deletions
@@ -8,6 +8,9 @@ the following locales: * danish (da) by Jonas Smedegaard <dr@jones.dk> +Additionally, the configuration has been simplified to not mention non-Git VCS +systems, and deprecated placeholder files has been removed from basewiki. + Getting the source ------------------ diff --git a/ikiwiki.setup b/ikiwiki.setup index 0f78b08..460f109 100644 --- a/ikiwiki.setup +++ b/ikiwiki.setup @@ -259,4 +259,11 @@ use IkiWiki::Setup::Standard { #websetup_force_plugins => [], # show unsafe settings, read-only, in web interface? #websetup_show_unsafe => 1, + + # varioki plugin (strings are eval'ed: double-quote actual strings!) + #varioki => { + # 'branding_logo_text' => '"Example Website"', + # 'branding_logo' => '"logo.png"', + # 'branding_logo_tagline' => '"Yet another ikiwiki site!"', + #}, } diff --git a/ikiwiki_admin.setup b/ikiwiki_admin.setup index 353f2f0..73e648c 100644 --- a/ikiwiki_admin.setup +++ b/ikiwiki_admin.setup @@ -256,4 +256,11 @@ use IkiWiki::Setup::Standard { #websetup_force_plugins => [], # show unsafe settings, read-only, in web interface? #websetup_show_unsafe => 1, + + # varioki plugin (strings are eval'ed: double-quote actual strings!) + #varioki => { + # 'branding_logo_text' => '"Example Website"', + # 'branding_logo' => '"logo.png"', + # 'branding_logo_tagline' => '"Yet another ikiwiki site!"', + #}, } diff --git a/perl/IkiWiki/Plugin/farbar.pm b/perl/IkiWiki/Plugin/farbar.pm new file mode 100644 index 0000000..ab4390a --- /dev/null +++ b/perl/IkiWiki/Plugin/farbar.pm @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# Farbar plugin. +# by Jonas Smedegaard <dr@jones.dk> +# Heavily based on Sidebar by Tuomo Valkonen <tuomov at iki dot fi> + +package IkiWiki::Plugin::farbar; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "pagetemplate", id => "farbar", call => \&pagetemplate); +} # }}} + +sub farbar_content ($) { #{{{ + my $page=shift; + + my $farbar_page=bestlink($page, "farbar") || return; + my $farbar_file=$pagesources{$farbar_page} || return; + my $farbar_type=pagetype($farbar_file); + + if (defined $farbar_type) { + # FIXME: This isn't quite right; it won't take into account + # adding a new farbar page. So adding such a page + # currently requires a wiki rebuild. + add_depends($page, $farbar_page); + + my $content=readfile(srcfile($farbar_file)); + return unless length $content; + return IkiWiki::htmlize($farbar_page, $page, $farbar_type, + IkiWiki::linkify($farbar_page, $page, + IkiWiki::preprocess($farbar_page, $page, + IkiWiki::filter($farbar_page, $page, $content)))); + } + +} # }}} + +sub pagetemplate (@) { #{{{ + my %params=@_; + + my $page=$params{page}; + my $template=$params{template}; + + if ($template->query(name => "farbar")) { + my $content=farbar_content($page); + if (defined $content && length $content) { + $template->param(farbar => $content); + } + } +} # }}} + +1 diff --git a/perl/IkiWiki/Plugin/topbar.pm b/perl/IkiWiki/Plugin/topbar.pm new file mode 100644 index 0000000..aa62a11 --- /dev/null +++ b/perl/IkiWiki/Plugin/topbar.pm @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# Topbar plugin. +# by Jonas Smedegaard <dr@jones.dk> +# Heavily based on Sidebar by Tuomo Valkonen <tuomov at iki dot fi> + +package IkiWiki::Plugin::topbar; + +use warnings; +use strict; +use IkiWiki 2.00; + +sub import { #{{{ + hook(type => "pagetemplate", id => "topbar", call => \&pagetemplate); +} # }}} + +sub topbar_content ($) { #{{{ + my $page=shift; + + my $topbar_page=bestlink($page, "topbar") || return; + my $topbar_file=$pagesources{$topbar_page} || return; + my $topbar_type=pagetype($topbar_file); + + if (defined $topbar_type) { + # FIXME: This isn't quite right; it won't take into account + # adding a new topbar page. So adding such a page + # currently requires a wiki rebuild. + add_depends($page, $topbar_page); + + my $content=readfile(srcfile($topbar_file)); + return unless length $content; + return IkiWiki::htmlize($topbar_page, $page, $topbar_type, + IkiWiki::linkify($topbar_page, $page, + IkiWiki::preprocess($topbar_page, $page, + IkiWiki::filter($topbar_page, $page, $content)))); + } + +} # }}} + +sub pagetemplate (@) { #{{{ + my %params=@_; + + my $page=$params{page}; + my $template=$params{template}; + + if ($template->query(name => "topbar")) { + my $content=topbar_content($page); + if (defined $content && length $content) { + $template->param(topbar => $content); + } + } +} # }}} + +1 |