* Allow discussion links on pages to be turned off with --no-discussion.
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 5 May 2006 18:20:52 +0000 (18:20 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Fri, 5 May 2006 18:20:52 +0000 (18:20 +0000)
IkiWiki.pm
IkiWiki/Plugin/brokenlinks.pm
IkiWiki/Plugin/orphans.pm
IkiWiki/Render.pm
Makefile.PL
debian/changelog
doc/ikiwiki.setup
doc/todo/optimisations.mdwn
doc/usage.mdwn
ikiwiki
templates/page.tmpl

index 443a88044f315ca762676dc544947e9d01d3340c..df38efb7d472c156a2eed8dac8e9d426353f26d2 100644 (file)
@@ -26,6 +26,7 @@ sub defaultconfig () { #{{{
        diffurl => '',
        anonok => 0,
        rss => 0,
+       discussion => 1,
        rebuild => 0,
        refresh => 0,
        getctime => 0,
index 8b91391fe784d3cda973cb6a465cd199683ce4be..50bbe0d54499ac165263e08f0f2fda36b6dc9fff 100644 (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,
index 945892d177d7723bbd0ac579bcd0da36a40fd147..a7aa89f58f719327586132a0131030dd1afa826e 100644 (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;
        }
        
index 9feaa6da7636b46940a101f9bbfbaf87aebde496..854d5105ebecc793e97d2c3f3a32c8ad3b3e0131 100644 (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 ($) { #{{{
index 74ad20c177da1d24788b296b364f830db38d7821..43b6bef095e36759386dfe5cb0b398a5642f9fc7 100755 (executable)
@@ -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:
index a7887e17f97d0ab6a4ee83df112efeec2a8ed0e0..0d86597fcadb273d553d48ffd09eff9a40787acb 100644 (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
 
index 17d3be7d75077777505c039168b4ac9b73fd908f..57278976e18f4041e3884f07b7dacd18c1d3c913 100644 (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}],
index 4cf0907f5cd32103a5996840acd172b423016534..924ff8ffac44026365d2956f27b5000727ba5843 100644 (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.
index 3a46dade8bcd478ad1b4644f1b46b78360d7e7a6..03f40a8924edb902483d80bf16ba20e4fb6c9fd5 100644 (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.
diff --git a/ikiwiki b/ikiwiki
index e911eaff4de483cb9e1ffe680828b13ab91f6d2d..be7f86a458e4c3bb820fcef1c74cef8ac6621b28 100755 (executable)
--- 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},
index 5ac162b2d726a8dd4dc5a28718e50b64b8550cf2..09e19c359d12a76288ea3b67375bccc6a300d933 100644 (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>