summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm7
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm3
-rw-r--r--IkiWiki/Plugin/editpage.pm5
-rw-r--r--IkiWiki/Plugin/inline.pm9
-rw-r--r--IkiWiki/Plugin/opendiscussion.pm3
-rw-r--r--IkiWiki/Plugin/orphans.pm3
-rw-r--r--IkiWiki/Render.pm9
-rw-r--r--debian/changelog2
8 files changed, 22 insertions, 19 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index a11b330f2..b47da966e 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -220,6 +220,13 @@ sub getsetup () {
safe => 1,
rebuild => 1,
},
+ discussionpage => {
+ type => "string",
+ default => gettext("Discussion"),
+ description => "name of Discussion pages",
+ safe => 1,
+ rebuild => 1,
+ },
sslcookie => {
type => "boolean",
default => 0,
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index f8d44892b..5ad4c917c 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -28,14 +28,13 @@ sub preprocess (@) {
add_depends($params{page}, $params{pages});
my %broken;
- my $discussion=gettext("Discussion");
foreach my $page (pagespec_match_list([keys %links],
$params{pages}, location => $params{page})) {
my %seen;
foreach my $link (@{$links{$page}}) {
next if $seen{$link};
$seen{$link}=1;
- next if $link =~ /.*\/\Q$discussion\E/i && $config{discussion};
+ next if $link =~ /.*\/\Q$config{discussionpage}\E/i && $config{discussion};
my $bestlink=bestlink($page, $link);
next if length $bestlink;
push @{$broken{$link}}, $page;
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 467cd9ed5..fca970c60 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -229,8 +229,9 @@ sub cgi_editpage ($$) {
my $dir=$from."/";
$dir=~s![^/]+/+$!!;
- if ((defined $form->field('subpage') && length $form->field('subpage')) ||
- $page eq lc(gettext('Discussion'))) {
+ if ((defined $form->field('subpage') &&
+ length $form->field('subpage')) ||
+ $page eq lc($config{discussionpage})) {
$best_loc="$from/$page";
}
else {
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 2fbb45e02..704fa711d 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -348,9 +348,6 @@ sub preprocess_inline (@) {
}
my $template=HTML::Template->new(@params) unless $raw;
- my $discussionlink=lc(gettext("Discussion"))
- if $config{discussion};
-
foreach my $page (@list) {
my $file = $pagesources{$page};
my $type = pagetype($file);
@@ -374,14 +371,14 @@ sub preprocess_inline (@) {
my $file = $pagesources{$page};
my $type = pagetype($file);
if ($config{discussion}) {
- if ($page !~ /.*\/\Q$discussionlink\E$/ &&
+ if ($page !~ /.*\/\Q$config{discussionpage}\E$/ &&
(length $config{cgiurl} ||
- exists $links{$page."/".$discussionlink})) {
+ exists $links{$page."/".$config{discussionpage}})) {
$template->param(have_actions => 1);
$template->param(discussionlink =>
htmllink($page,
$params{destpage},
- gettext("Discussion"),
+ $config{discussionpage},
noimageinline => 1,
forcesubpage => 1));
}
diff --git a/IkiWiki/Plugin/opendiscussion.pm b/IkiWiki/Plugin/opendiscussion.pm
index 60b193eca..1bec4b013 100644
--- a/IkiWiki/Plugin/opendiscussion.pm
+++ b/IkiWiki/Plugin/opendiscussion.pm
@@ -23,8 +23,7 @@ sub canedit ($$) {
my $cgi=shift;
my $session=shift;
- my $discussion=lc(gettext("Discussion"));
- return "" if $page=~/(\/|^)\Q$discussion\E$/;
+ return "" if $page=~/(\/|^)\Q$config{discussionpage}\E$/;
return undef;
}
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 7c938ef74..02f5d2524 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -34,7 +34,6 @@ sub preprocess (@) {
}
my @orphans;
- my $discussion=lc(gettext("Discussion"));
foreach my $page (pagespec_match_list(
[ grep { ! $linkedto{$_} && $_ ne 'index' }
keys %pagesources ],
@@ -43,7 +42,7 @@ sub preprocess (@) {
# indirectly linked to a page via that page's backlinks.
next if grep {
length $_ &&
- ($_ !~ /\/\Q$discussion\E$/i || ! $config{discussion}) &&
+ ($_ !~ /\/\Q$config{discussionpage}\E$/i || ! $config{discussion}) &&
bestlink($page, $_) !~ /^(\Q$page\E|)$/
} @{$links{$page}};
push @orphans, $page;
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index fc8f287ce..d5e81f1b9 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -83,11 +83,10 @@ sub genpage ($$) {
$actions++;
}
if ($config{discussion}) {
- my $discussionlink=lc(gettext("Discussion"));
- if ($page !~ /.*\/\Q$discussionlink\E$/ &&
+ if ($page !~ /.*\/\Q$config{discussionpage}\E$/ &&
(length $config{cgiurl} ||
- exists $links{$page."/".$discussionlink})) {
- $template->param(discussionlink => htmllink($page, $page, gettext("Discussion"), noimageinline => 1, forcesubpage => 1));
+ exists $links{$page."/".$config{discussionpage}})) {
+ $template->param(discussionlink => htmllink($page, $page, $config{discussionpage}, noimageinline => 1, forcesubpage => 1));
$actions++;
}
}
@@ -153,7 +152,7 @@ sub scan ($) {
if ($config{discussion}) {
# Discussion links are a special case since they're
# not in the text of the page, but on its template.
- $links{$page}=[ $page."/".lc(gettext("Discussion")) ];
+ $links{$page}=[ $page."/".lc($config{discussionpage}) ];
}
else {
$links{$page}=[];
diff --git a/debian/changelog b/debian/changelog
index ed7854e8a..5e5149927 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ ikiwiki (3.141593) UNRELEASED; urgency=low
the old version, but continue. Closes: #541205
* inline: Avoid use of my $_ as it fails with older perls.
Closes: #541215
+ * Add discussionpage configuration setting.
+ * Small optimisations.
-- Joey Hess <joeyh@debian.org> Wed, 12 Aug 2009 12:25:30 -0400