#!/usr/bin/perl # Topbar plugin. # by Jonas Smedegaard # Heavily based on Sidebar by Tuomo Valkonen 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 h/log/tags/57/c1/1290100563.2452.14.camel@palatschinken/debian?h=master'>logtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tags/57/c1/1290100563.2452.14.camel@palatschinken/debian')
-rw-r--r--tags/57/c1/1290100563.2452.14.camel@palatschinken/debian0
1 files changed, 0 insertions, 0 deletions