* Add a tail fin^W^Wsidebar plugin by Tuomo Valkonen.
* If a page links to itself, mark up the link text in a span with class="selflink" so that it can be styled. I don't have a useful style defined for that though.master
parent
5d37a3837c
commit
cedb48765b
|
@ -345,7 +345,8 @@ sub htmllink ($$$;$$$) { #{{{
|
|||
|
||||
$linktext=pagetitle(basename($link)) unless defined $linktext;
|
||||
|
||||
return $linktext if length $bestlink && $page eq $bestlink;
|
||||
return "<span class=\"selflink\">$linktext</span>"
|
||||
if length $bestlink && $page eq $bestlink;
|
||||
|
||||
# TODO BUG: %renderedfiles may not have it, if the linked to page
|
||||
# was also added and isn't yet rendered! Note that this bug is
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/perl
|
||||
# Sidebar plugin.
|
||||
# by Tuomo Valkonen <tuomov at iki dot fi>
|
||||
|
||||
package IkiWiki::Plugin::sidebar;
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
use IkiWiki;
|
||||
|
||||
sub import { #{{{
|
||||
IkiWiki::hook(type => "pagetemplate", id => "sidebar",
|
||||
call => \&pagetemplate);
|
||||
} # }}}
|
||||
|
||||
sub sidebar_content ($) { #{{{
|
||||
my $page=shift;
|
||||
|
||||
my $sidebar_page=IkiWiki::bestlink($page, "sidebar") || return;
|
||||
my $sidebar_file=$IkiWiki::pagesources{$sidebar_page} || return;
|
||||
my $sidebar_type=IkiWiki::pagetype($sidebar_file);
|
||||
|
||||
if (defined $sidebar_type) {
|
||||
IkiWiki::add_depends($page, $sidebar_page);
|
||||
my $content=IkiWiki::readfile(IkiWiki::srcfile($sidebar_file));
|
||||
return unless length $content;
|
||||
return IkiWiki::htmlize($sidebar_type,
|
||||
IkiWiki::preprocess($sidebar_page, $page,
|
||||
IkiWiki::linkify($sidebar_page, $page, $content)));
|
||||
}
|
||||
|
||||
} # }}}
|
||||
|
||||
sub pagetemplate (@) { #{{{
|
||||
my %params=@_;
|
||||
|
||||
my $page=$params{page};
|
||||
my $template=$params{template};
|
||||
|
||||
if ($template->query(name => "sidebar")) {
|
||||
my $content=sidebar_content($page);
|
||||
if (defined $content && length $content) {
|
||||
$template->param(sidebar => $content);
|
||||
}
|
||||
}
|
||||
} # }}}
|
||||
|
||||
1
|
|
@ -129,3 +129,12 @@ td.changelog {
|
|||
.normalPC { font-size: 100%; }
|
||||
.bigPC { font-size: 115%; }
|
||||
.biggestPC { font-size: 130%; }
|
||||
|
||||
#sidebar {
|
||||
line-height: 3ex;
|
||||
width: 20ex;
|
||||
float: right;
|
||||
margin-left: 40px;
|
||||
margin-bottom: 40px;
|
||||
padding: 2ex 2ex;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
ikiwiki (1.21) UNRELEASED; urgency=low
|
||||
|
||||
* Add a tail fin^W^Wsidebar plugin by Tuomo Valkonen.
|
||||
* If a page links to itself, mark up the link text in a span with
|
||||
class="selflink" so that it can be styled. I don't have a useful style
|
||||
defined for that though.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Thu, 17 Aug 2006 20:18:23 -0400
|
||||
|
||||
ikiwiki (1.20) unstable; urgency=low
|
||||
|
||||
* Relicense the templates and basewiki under the 2-clause BSD license.
|
||||
|
|
|
@ -80,7 +80,8 @@ use IkiWiki::Setup::Standard {
|
|||
|
||||
# To add plugins, list them here.
|
||||
#add_plugins => [qw{meta tag pagecount brokenlinks search smiley
|
||||
# wikitext camelcase pagestats htmltidy fortune}],
|
||||
# wikitext camelcase pagestats htmltidy fortune
|
||||
# sidebar}],
|
||||
# If you want to disable any of the default plugins, list them here.
|
||||
#disable_plugins => [qw{inline htmlscrubber}],
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Most of ikiwiki's [[features]] are implemented as plugins. Beyond the
|
||||
[[type/core]] features, there are plugins to [[type/format]] text,
|
||||
use [[type/tags]], show [[type/meta]] information, do other [[type/useful]]
|
||||
stuff, or just have [[type/fun]].
|
||||
stuff, add [[type/chrome]] to the wiki, or just have [[type/fun]].
|
||||
|
||||
There's documentation if you want to [[write]] your own plugins, or you can
|
||||
install and use plugins contributed by others.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
If this plugin is enabled, then a sidebar is added to pages in the wiki.
|
||||
The content of the sidebar is simply the content of a page named
|
||||
"sidebar".
|
||||
|
||||
Typically this will be a page in the root of the wiki, but it can also be a
|
||||
[[SubPage]]. In fact, this page, [[plugins/sidebar|plugins/sidebar]], will
|
||||
be treated as a sidebar for the [[plugins]] page, and of all of its
|
||||
SubPages, if the plugin is enabled.
|
||||
|
||||
This plugin is included in ikiwiki, but is not enabled by default.
|
||||
|
||||
[[tag type/chrome]]
|
|
@ -0,0 +1 @@
|
|||
These plugins affect the look and feel of the wiki.
|
|
@ -45,6 +45,12 @@
|
|||
</div>
|
||||
</TMPL_IF>
|
||||
|
||||
<TMPL_IF SIDEBAR>
|
||||
<div id="sidebar">
|
||||
<TMPL_VAR SIDEBAR>
|
||||
</div>
|
||||
</TMPL_IF>
|
||||
|
||||
<div id="content">
|
||||
<TMPL_VAR CONTENT>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue