summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/recentchanges.pm54
-rw-r--r--IkiWiki/Render.pm4
-rw-r--r--doc/cgi.mdwn6
-rw-r--r--doc/ikiwiki.setup3
-rw-r--r--doc/plugins/recentchanges.mdwn8
-rw-r--r--doc/recentchanges.mdwn1
-rw-r--r--doc/usage.mdwn6
-rw-r--r--docwiki.setup8
-rw-r--r--po/ikiwiki.pot2
-rwxr-xr-xt/pagespec_match.t3
10 files changed, 38 insertions, 57 deletions
diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm
index 8f707afc4..f5982604b 100644
--- a/IkiWiki/Plugin/recentchanges.pm
+++ b/IkiWiki/Plugin/recentchanges.pm
@@ -6,25 +6,30 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
- hook(type => "refresh", id => "recentchanges",
- call => \&refresh);
- hook(type => "preprocess", id => "recentchanges",
- call => \&preprocess);
- hook(type => "htmlize", id => "_change",
- call => \&htmlize);
+ hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig);
+ hook(type => "refresh", id => "recentchanges", call => \&refresh);
+ hook(type => "htmlize", id => "_change", call => \&htmlize);
} #}}}
-sub refresh ($) { #{{{
- my @changes=IkiWiki::rcs_recentchanges(100);
- updatechanges("*", "recentchanges", \@changes);
+sub checkconfig () { #{{{
+ $config{recentchangespage}='recentchanges' unless defined $config{recentchangespage};
+ $config{recentchangesnum}=100 unless defined $config{recentchangesnum};
} #}}}
-sub preprocess (@) { #{{{
- my %params=@_;
-
- # TODO
+sub refresh ($) { #{{{
+ my %seen;
- return "";
+ # add new changes
+ foreach my $change (IkiWiki::rcs_recentchanges($config{recentchangesnum})) {
+ $seen{store($change, $config{recentchangespage})}=1;
+ }
+
+ # delete old and excess changes
+ foreach my $page (keys %pagesources) {
+ if ($page=~/^\Q$config{recentchangespage}\E\/change_/ && ! $seen{$page}) {
+ unlink($config{srcdir}.'/'.$pagesources{$page});
+ }
+ }
} #}}}
# Pages with extension _change have plain html markup, pass through.
@@ -33,11 +38,10 @@ sub htmlize (@) { #{{{
return $params{content};
} #}}}
-sub store ($$) { #{{{
+sub store ($$$) { #{{{
my $change=shift;
- my $subdir=shift;
-
- my $page="$subdir/change_".IkiWiki::titlepage($change->{rev});
+
+ my $page="$config{recentchangespage}/change_".IkiWiki::titlepage($change->{rev});
# Optimisation to avoid re-writing pages. Assumes commits never
# change (or that any changes are not important).
@@ -102,23 +106,9 @@ sub store ($$) { #{{{
} #}}}
sub updatechanges ($$) { #{{{
- my $pagespec=shift;
my $subdir=shift;
my @changes=@{shift()};
- my %seen;
-
- # add new changes
- foreach my $change (@changes) {
- $seen{store($change, $subdir)}=1;
- }
-
- # delete old and excess changes
- foreach my $page (keys %pagesources) {
- if ($page=~/^\Q$subdir\E\/change_/ && ! $seen{$page}) {
- unlink($config{srcdir}.'/'.$pagesources{$page});
- }
- }
} #}}}
1
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index b5b461499..ed359bdd7 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -85,8 +85,8 @@ sub genpage ($$) { #{{{
$actions++;
}
- if ($config{rcs}) {
- $template->param(recentchangesurl => urlto("recentchanges", $page));
+ if ($config{rcs} && exists $config{recentchangespage}) {
+ $template->param(recentchangesurl => urlto($config{recentchangespage}, $page));
$actions++;
}
diff --git a/doc/cgi.mdwn b/doc/cgi.mdwn
index 22d8c4332..1448fa4d5 100644
--- a/doc/cgi.mdwn
+++ b/doc/cgi.mdwn
@@ -1,3 +1,5 @@
-While ikiwiki is primarily a wiki compiler, which generates static html pages, it does use CGI for two important wiki features, online page editing and the [[RecentChanges]] display.
+While ikiwiki is primarily a wiki compiler, which generates static html
+pages, it does use CGI for online page editing.
-To enable CGI, you need to create and install an ikiwiki.cgi wrapper. [[Setup]] explains how to do this. \ No newline at end of file
+To enable CGI, you need to create and install an ikiwiki.cgi wrapper.
+[[Setup]] explains how to do this.
diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup
index af27f1d7e..9bf542981 100644
--- a/doc/ikiwiki.setup
+++ b/doc/ikiwiki.setup
@@ -115,6 +115,9 @@ use IkiWiki::Setup::Standard {
#account_creation_password => "example",
# Uncomment to force ikiwiki to run with a particular umask.
#umask => 022,
+ # Default settings for the recentchanges page.
+ #recentchangespage => "recentchanges",
+ #recentchangesnum => 100,
# To add plugins, list them here.
#add_plugins => [qw{goodstuff search wikitext camelcase
diff --git a/doc/plugins/recentchanges.mdwn b/doc/plugins/recentchanges.mdwn
index 69073adf0..8647985c9 100644
--- a/doc/plugins/recentchanges.mdwn
+++ b/doc/plugins/recentchanges.mdwn
@@ -5,12 +5,8 @@ generates a page describing each recent change made to the wiki. These
pages can be joined together with [[inline]] to generate the
[[RecentChanges]] page.
-Typically only the RecentChanges page will use the plugin, but you can
-use it elsewhere too if you like. It's used like this:
+Typically only the RecentChanges page will use the pages generated by this
+plugin, but you can use it elsewhere too if you like. It's used like this:
- \[[recentchanges pages="*" num=100 template=change]]
\[[inline pages="internal(recentchanges/change_*)"
template=recentchanges show=0]]
-
-The pages describing recent changes will be created as [[subpages|subpage]]
-of the page where the `recentchanges` directive is placed.
diff --git a/doc/recentchanges.mdwn b/doc/recentchanges.mdwn
index d702b0f34..2dd218520 100644
--- a/doc/recentchanges.mdwn
+++ b/doc/recentchanges.mdwn
@@ -1,5 +1,4 @@
Recent changes to this wiki:
-[[recentchanges pages="*" num=100 template=change]]
[[inline pages="internal(recentchanges/change_*) and !*/Discussion"
template=recentchanges show=0]]
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index 354e266f1..f34d5bad6 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -33,8 +33,7 @@ These options control the mode that ikiwiki operates in.
* --cgi
Enable [[CGI]] mode. In cgi mode ikiwiki runs as a cgi script, and
- supports editing pages, signing in, registration, and displaying
- [[RecentChanges]].
+ supports editing pages, signing in, and registration.
To use ikiwiki as a [[CGI]] program you need to use --wrapper or --setup
to generate a wrapper. The wrapper will generally need to run suid 6755 to
@@ -141,8 +140,7 @@ configuration options of their own.
whatever the revision control system you select uses.
In [[CGI]] mode, with a revision control system enabled, pages edited via
- the web will be committed. Also, the [[RecentChanges]] link will be placed
- on pages.
+ the web will be committed.
No revision control is enabled by default.
diff --git a/docwiki.setup b/docwiki.setup
index 5793d87bf..e8f680a20 100644
--- a/docwiki.setup
+++ b/docwiki.setup
@@ -15,10 +15,6 @@ use IkiWiki::Setup::Standard {
syslog => 0,
userdir => "users",
usedirs => 0,
- rcs => 'git',
- rss => 1,
- cgiurl => "http://ikiwiki.info/ikiwiki.cgi",
- url => "http://ikiwiki.info",
- add_plugins => [qw{goodstuff version haiku polygen fortune
- recentchanges }],
+ add_plugins => [qw{goodstuff version haiku polygen fortune}],
+ disable_plugins => [qw{recentchanges}],
}
diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot
index 98882d535..4e43f5da9 100644
--- a/po/ikiwiki.pot
+++ b/po/ikiwiki.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-01-29 15:21-0500\n"
+"POT-Creation-Date: 2008-01-29 15:46-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/t/pagespec_match.t b/t/pagespec_match.t
index 3a641c6a8..cb98ab149 100755
--- a/t/pagespec_match.t
+++ b/t/pagespec_match.t
@@ -67,9 +67,6 @@ ok(! pagespec_match("foo", "creation_day(3)"), "other day");
ok(! pagespec_match("foo", "no_such_function(foo)"), "foo");
-ok(pagespec_match("foo", "foo and user(bar)", user => "bar"), "user");
-ok(! pagespec_match("foo", "foo and user(bar)", user => "baz"), "user fail");
-
my $ret=pagespec_match("foo", "(invalid");
ok(! $ret, "syntax error");
ok($ret eq "syntax error", "error message");