aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm1
-rw-r--r--IkiWiki/Plugin/brokenlinks.pm2
-rw-r--r--IkiWiki/Plugin/orphans.pm2
-rw-r--r--IkiWiki/Render.pm15
-rwxr-xr-xMakefile.PL6
-rw-r--r--debian/changelog3
-rw-r--r--doc/ikiwiki.setup2
-rw-r--r--doc/todo/optimisations.mdwn3
-rw-r--r--doc/usage.mdwn5
-rwxr-xr-xikiwiki1
-rw-r--r--templates/page.tmpl2
11 files changed, 29 insertions, 13 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 443a88044..df38efb7d 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -26,6 +26,7 @@ sub defaultconfig () { #{{{
diffurl => '',
anonok => 0,
rss => 0,
+ discussion => 1,
rebuild => 0,
refresh => 0,
getctime => 0,
diff --git a/IkiWiki/Plugin/brokenlinks.pm b/IkiWiki/Plugin/brokenlinks.pm
index 8b91391fe..50bbe0d54 100644
--- a/IkiWiki/Plugin/brokenlinks.pm
+++ b/IkiWiki/Plugin/brokenlinks.pm
@@ -23,7 +23,7 @@ sub preprocess (@) { #{{{
foreach my $page (%IkiWiki::links) {
if (IkiWiki::globlist_match($page, $params{pages})) {
foreach my $link (@{$IkiWiki::links{$page}}) {
- next if $link =~ /.*\/discussion/i;
+ next if $link =~ /.*\/discussion/i && $IkiWiki::config{discussion};
my $bestlink=IkiWiki::bestlink($page, $link);
next if length $bestlink;
push @broken,
diff --git a/IkiWiki/Plugin/orphans.pm b/IkiWiki/Plugin/orphans.pm
index 945892d17..a7aa89f58 100644
--- a/IkiWiki/Plugin/orphans.pm
+++ b/IkiWiki/Plugin/orphans.pm
@@ -31,7 +31,7 @@ sub preprocess (@) { #{{{
next unless IkiWiki::globlist_match($page, $params{pages});
# If the page has a link to some other page, it's
# indirectly linked to a page via that page's backlinks.
- next if grep { length $_ && $_ !~/\/Discussion$/i && IkiWiki::bestlink($page, $_) ne $page } @{$IkiWiki::links{$page}};
+ next if grep { length $_ && ($_ !~/\/Discussion$/i || ! $IkiWiki::config{discussion}) && IkiWiki::bestlink($page, $_) ne $page } @{$IkiWiki::links{$page}};
push @orphans, $page;
}
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 9feaa6da7..854d5105e 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -174,6 +174,9 @@ sub genpage ($$$) { #{{{
$u=~s/\[\[file\]\]/$pagesources{$page}/g;
$template->param(historyurl => $u);
}
+ if ($config{discussion}) {
+ $template->param(discussionlink => htmllink($page, "Discussion", 1, 1));
+ }
$template->param(headercontent => $config{headercontent});
$template->param(
@@ -182,7 +185,6 @@ sub genpage ($$$) { #{{{
parentlinks => [parentlinks($page)],
content => $content,
backlinks => [backlinks($page)],
- discussionlink => htmllink($page, "Discussion", 1, 1),
mtime => scalar(gmtime($mtime)),
styleurl => styleurl($page),
);
@@ -218,9 +220,14 @@ sub findlinks ($$) { #{{{
while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
push @links, titlepage($2);
}
- # Discussion links are a special case since they're not in the text
- # of the page, but on its template.
- return @links, "$page/discussion";
+ if ($config{discussion}) {
+ # Discussion links are a special case since they're not in the
+ # text of the page, but on its template.
+ return @links, "$page/discussion";
+ }
+ else {
+ return @links;
+ }
} #}}}
sub render ($) { #{{{
diff --git a/Makefile.PL b/Makefile.PL
index 74ad20c17..43b6bef09 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,9 +14,9 @@ pure_install:: extra_install
extra_build:
./ikiwiki doc html --templatedir=templates --underlaydir=basewiki \
--wikiname="ikiwiki" --verbose --no-rcs \
- --exclude=/discussion --plugin=brokenlinks \
- --plugin=pagecount --plugin=orphans \
- --plugin=haiku
+ --exclude=/discussion --no-discussion \
+ --plugin=brokenlinks --plugin=pagecount \
+ --plugin=orphans --plugin=haiku
./mdwn2man doc/usage.mdwn > ikiwiki.man
extra_clean:
diff --git a/debian/changelog b/debian/changelog
index a7887e17f..0d86597fc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -45,8 +45,9 @@ ikiwiki (1.1) UNRELEASED; urgency=low
text.
* Removed --sanitize and --no-sanitize, replaced with --plugin htmlscrubber
and --disable-plugin htmlscrubber.
+ * Allow discussion links on pages to be turned off with --no-discussion.
- -- Joey Hess <joeyh@debian.org> Fri, 5 May 2006 01:28:19 -0400
+ -- Joey Hess <joeyh@debian.org> Fri, 5 May 2006 14:03:54 -0400
ikiwiki (1.0) unstable; urgency=low
diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup
index 17d3be7d7..57278976e 100644
--- a/doc/ikiwiki.setup
+++ b/doc/ikiwiki.setup
@@ -48,6 +48,8 @@ use IkiWiki::Setup::Standard {
#anonok => 1,
# Generate rss feeds for pages?
rss => 1,
+ # Include discussion links on all pages?
+ discussion => 1,
# To change the enabled plugins, edit this list
#plugin => [qw{pagecount inline brokenlinks hyperestraier smiley
# htmlscrubber}],
diff --git a/doc/todo/optimisations.mdwn b/doc/todo/optimisations.mdwn
index 4cf0907f5..924ff8ffa 100644
--- a/doc/todo/optimisations.mdwn
+++ b/doc/todo/optimisations.mdwn
@@ -9,8 +9,5 @@
* Don't render blog archive pages unless a page is added/removed. Just
changing a page doesn't affect the archives as they show only the title.
-* Look at breaking the relatively rarely used blogging stuff out of
- Render.pm, into its own module.
-
* Look at splitting up CGI.pm. But note that too much splitting can slow
perl down.
diff --git a/doc/usage.mdwn b/doc/usage.mdwn
index 3a46dade8..03f40a892 100644
--- a/doc/usage.mdwn
+++ b/doc/usage.mdwn
@@ -172,6 +172,11 @@ These options configure the wiki.
Disables use of a plugin. For example "--disable-plugin htmlscrubber"
to do away with html sanitization.
+* --discussion, --no-discussion
+
+ Enables or disables "Discussion" links from being added to the header of
+ every page. The links are enabled by default.
+
* --verbose
Be vebose about what is being done.
diff --git a/ikiwiki b/ikiwiki
index e911eaff4..be7f86a45 100755
--- a/ikiwiki
+++ b/ikiwiki
@@ -28,6 +28,7 @@ sub getconfig () { #{{{
"anonok!" => \$config{anonok},
"rss!" => \$config{rss},
"cgi!" => \$config{cgi},
+ "discussion!" => \$config{discussion},
"notify!" => \$config{notify},
"url=s" => \$config{url},
"cgiurl=s" => \$config{cgiurl},
diff --git a/templates/page.tmpl b/templates/page.tmpl
index 5ac162b2d..09e19c359 100644
--- a/templates/page.tmpl
+++ b/templates/page.tmpl
@@ -36,7 +36,9 @@
<li><a href="<TMPL_VAR PREFSURL>">Preferences</a></li>
</TMPL_IF>
+<TMPL_IF NAME="DISCUSSIONLINK">
<li><TMPL_VAR DISCUSSIONLINK><br /></li>
+</TMPL_IF>
</ul>
</div>