* Allow discussion links on pages to be turned off with --no-discussion.

master
joey 2006-05-05 18:20:52 +00:00
parent fbb0762ccf
commit b2bd444f31
11 changed files with 29 additions and 13 deletions

View File

@ -26,6 +26,7 @@ sub defaultconfig () { #{{{
diffurl => '',
anonok => 0,
rss => 0,
discussion => 1,
rebuild => 0,
refresh => 0,
getctime => 0,

View File

@ -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,

View File

@ -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;
}

View File

@ -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 ($) { #{{{

View File

@ -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:

3
debian/changelog vendored
View File

@ -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

View File

@ -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}],

View File

@ -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.

View File

@ -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.

View File

@ -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},

View File

@ -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>