From bbabbca9d1943421117a6625fc81c02d5b66def4 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 12 Mar 2006 03:29:09 +0000 Subject: [PATCH] template for recentchanges --- Makefile | 4 ++-- doc/features.mdwn | 7 +++++- doc/setup.mdwn | 5 +++-- ikiwiki | 42 ++++++++++++++---------------------- templates/recentchanges.tmpl | 25 +++++++++++++++++++++ 5 files changed, 52 insertions(+), 31 deletions(-) create mode 100644 templates/recentchanges.tmpl diff --git a/Makefile b/Makefile index a9e177a27..32c4feae1 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: - ./ikiwiki doc html --wikiname="ikiwiki" --verbose --nosvn + ./ikiwiki doc templates html --wikiname="ikiwiki" --verbose --nosvn clean: rm -rf html - rm -f doc/.index + rm -rf doc/.ikiwiki diff --git a/doc/features.mdwn b/doc/features.mdwn index 283dec8ec..8c08b70b9 100644 --- a/doc/features.mdwn +++ b/doc/features.mdwn @@ -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) +* [[Templates]] + + ikiwiki generates html using templates so you can change the look and + layout of all pages in any way you would like. + * [[BackLinks]] Automatically included on pages. Rather faster than eg [[MoinMoin]] and always there to help with navigation. @@ -45,4 +50,4 @@ Currently implemented: ---- -It also has lots of [[TODO]] items and [[Bugs]]. This wiki is not ready for production! \ No newline at end of file +It also has lots of [[TODO]] items and [[Bugs]]. This wiki is not ready for production! diff --git a/doc/setup.mdwn b/doc/setup.mdwn index 373bc90ed..e69364e36 100644 --- a/doc/setup.mdwn +++ b/doc/setup.mdwn @@ -6,7 +6,8 @@ optional support for commits from the web. 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. @@ -70,4 +71,4 @@ optional support for commits from the web. --historyurl='http://svn.host/trunk/doc/[[]]?root=wiki' -11. Enjoy your new wiki! \ No newline at end of file +11. Enjoy your new wiki! diff --git a/ikiwiki b/ikiwiki index 2815a8e1d..5228c45d6 100755 --- a/ikiwiki +++ b/ikiwiki @@ -242,7 +242,7 @@ sub backlinks ($) { #{{{ return @links; } #}}} -sub parentlinks ($) { +sub parentlinks ($) { #{{{ my $page=shift; my @ret; @@ -259,7 +259,7 @@ sub parentlinks ($) { $path.="../"; } return @ret; -} +} #}}} sub indexlink () { #{{{ return "$wikiname/ "; @@ -418,7 +418,8 @@ sub rcs_recentchanges ($) { #{{{ $when=concise(ago(time - str2time($3))); } 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' && /^$/) { $state='body'; @@ -588,7 +589,7 @@ sub gen_wrapper ($$) { #{{{ 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, "--rebuild" if $rebuild; push @params, "--nosvn" if !$svn; @@ -655,29 +656,18 @@ EOF exit 0; } #}}} -sub cgi_recentchanges ($) { #{{{ +sub cgi_recentchanges () { #{{{ my $q=shift; - - - my $list="\n"; - - print $q->header, - $q->start_html("RecentChanges"), - $q->h1(indexlink()." RecentChanges"), - $list, - $q->end_form, - $q->end_html; + my $template=HTML::Template->new( + filename => "$templatedir/recentchanges.tmpl"); + $template->param( + title => "RecentChanges", + indexlink => $url, + wikiname => $wikiname, + changelog => [rcs_recentchanges(100)], + ); + return $template->output; } #}}} sub cgi_signin ($$) { #{{{ @@ -798,7 +788,7 @@ sub cgi () { #{{{ } if ($do eq 'recentchanges') { - cgi_recentchanges($q); + cgi_recentchanges(); return; } diff --git a/templates/recentchanges.tmpl b/templates/recentchanges.tmpl new file mode 100644 index 000000000..72e243c60 --- /dev/null +++ b/templates/recentchanges.tmpl @@ -0,0 +1,25 @@ + +<TMPL_VAR TITLE> + + +

+/ +

+ +
+ + + + + -- 2.26.2