template for recentchanges

master
joey 2006-03-12 03:29:09 +00:00
parent 94eab28a86
commit bbabbca9d1
5 changed files with 52 additions and 31 deletions

View File

@ -1,6 +1,6 @@
all: all:
./ikiwiki doc html --wikiname="ikiwiki" --verbose --nosvn ./ikiwiki doc templates html --wikiname="ikiwiki" --verbose --nosvn
clean: clean:
rm -rf html rm -rf html
rm -f doc/.index rm -rf doc/.ikiwiki

View File

@ -31,6 +31,11 @@ Currently implemented:
ikiwiki is fast and smart about updating a wiki, it only builds pages that have changed (and tracks things like creation of new pages and links that can indirectly cause a page to need a rebuild) ikiwiki is fast and smart about updating a wiki, it only builds pages that have changed (and tracks things like creation of new pages and links that can indirectly cause a page to need a rebuild)
* [[Templates]]
ikiwiki generates html using templates so you can change the look and
layout of all pages in any way you would like.
* [[BackLinks]] * [[BackLinks]]
Automatically included on pages. Rather faster than eg [[MoinMoin]] and always there to help with navigation. Automatically included on pages. Rather faster than eg [[MoinMoin]] and always there to help with navigation.

View File

@ -6,7 +6,8 @@ optional support for commits from the web.
apt-get install ikiwiki # soon apt-get install ikiwiki # soon
Ikiwiki requires [[MarkDown]] be installed, and also uses the following perl modules: `CGI::Session` `CGI::FormBuilder` Ikiwiki requires [[MarkDown]] be installed, and also uses the following
perl modules: `CGI::Session` `CGI::FormBuilder` `HTML::Template`
2. Create the subversion repository for your wiki. 2. Create the subversion repository for your wiki.

42
ikiwiki
View File

@ -242,7 +242,7 @@ sub backlinks ($) { #{{{
return @links; return @links;
} #}}} } #}}}
sub parentlinks ($) { sub parentlinks ($) { #{{{
my $page=shift; my $page=shift;
my @ret; my @ret;
@ -259,7 +259,7 @@ sub parentlinks ($) {
$path.="../"; $path.="../";
} }
return @ret; return @ret;
} } #}}}
sub indexlink () { #{{{ sub indexlink () { #{{{
return "<a href=\"$url\">$wikiname</a>/ "; return "<a href=\"$url\">$wikiname</a>/ ";
@ -418,7 +418,8 @@ sub rcs_recentchanges ($) { #{{{
$when=concise(ago(time - str2time($3))); $when=concise(ago(time - str2time($3)));
} }
elsif ($state eq 'header' && /^\s+[A-Z]\s+\Q$svn_base\E\/(.+)$/) { elsif ($state eq 'header' && /^\s+[A-Z]\s+\Q$svn_base\E\/(.+)$/) {
push @pages, pagename($1) if length $1; push @pages, htmllink("", pagename($1), 1)
if length $1;
} }
elsif ($state eq 'header' && /^$/) { elsif ($state eq 'header' && /^$/) {
$state='body'; $state='body';
@ -588,7 +589,7 @@ sub gen_wrapper ($$) { #{{{
error("$this doesn't seem to be executable"); error("$this doesn't seem to be executable");
} }
my @params=($srcdir, $destdir, "--wikiname=$wikiname"); my @params=($srcdir, $templatedir, $destdir, "--wikiname=$wikiname");
push @params, "--verbose" if $verbose; push @params, "--verbose" if $verbose;
push @params, "--rebuild" if $rebuild; push @params, "--rebuild" if $rebuild;
push @params, "--nosvn" if !$svn; push @params, "--nosvn" if !$svn;
@ -655,29 +656,18 @@ EOF
exit 0; exit 0;
} #}}} } #}}}
sub cgi_recentchanges ($) { #{{{ sub cgi_recentchanges () { #{{{
my $q=shift; my $q=shift;
my $template=HTML::Template->new(
filename => "$templatedir/recentchanges.tmpl");
my $list="<ul>\n"; $template->param(
foreach my $change (rcs_recentchanges(100)) { title => "RecentChanges",
$list.="<li>"; indexlink => $url,
$list.=join(", ", map { htmllink("", $_, 1) } @{$change->{pages}}); wikiname => $wikiname,
$list.="<br>\n"; changelog => [rcs_recentchanges(100)],
$list.="changed ".$change->{when}." by ". );
htmllink("", $change->{user}, 1). return $template->output;
": <i>".$change->{message}."</i>\n";
$list.="</li>\n";
}
$list.="</ul>\n";
print $q->header,
$q->start_html("RecentChanges"),
$q->h1(indexlink()." RecentChanges"),
$list,
$q->end_form,
$q->end_html;
} #}}} } #}}}
sub cgi_signin ($$) { #{{{ sub cgi_signin ($$) { #{{{
@ -798,7 +788,7 @@ sub cgi () { #{{{
} }
if ($do eq 'recentchanges') { if ($do eq 'recentchanges') {
cgi_recentchanges($q); cgi_recentchanges();
return; return;
} }

View File

@ -0,0 +1,25 @@
<html>
<head><title><TMPL_VAR TITLE></title></head>
<body>
<h1>
<a href="<TMPL_VAR INDEXLINK>"><TMPL_VAR WIKINAME></a>/ <TMPL_VAR TITLE>
</h1>
<hr>
<ul>
<TMPL_LOOP NAME="CHANGELOG">
<li>
<TMPL_LOOP NAME="PAGES">
<TMPL_VAR NAME="LINK"></a>
</TMPL_LOOP>
<br>
changed <TMPL_LOOP NAME="WHEN"> by <TMPL_LOOP NAME="USER">:
<i><TMPL_LOOP NAME="MESSAGE"></i>
</li>
</TMPL_LOOP>
</ul>
</body>
</html>