summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-08-13 21:41:33 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-08-13 21:41:33 -0400
commit830c9e59b2c4d5c90e4316d8e81558e1aeb132f2 (patch)
tree8eb2789a6039095f7704656ab43addce4b0bb7d4 /IkiWiki/Plugin
parentfed73d8d922ec4d52457a99f652c1d0d26ba67c3 (diff)
Add discussionpage configuration setting
By adding this setting, we get both more configurability, and a minor optimisation too, since gettext does not need to be called continually to get the Discussion value.
Diffstat (limited to 'IkiWiki/Plugin')
-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
5 files changed, 9 insertions, 14 deletions
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;