Add indexpages option
authorJoey Hess <joey@kodama.kitenet.net>
Mon, 29 Sep 2008 21:30:30 +0000 (17:30 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Mon, 29 Sep 2008 21:30:30 +0000 (17:30 -0400)
This is the easy part of supporting foo/index.mdwn sources for page foo.

Note that if foo.mdwn exists too, there will be a warning about multiple
sources for the same page, and which is used is indeterminate.

indexpages should also cause web based editing to create index source pages
by default; this and other fallout of the option not yet implemented.

IkiWiki.pm
debian/changelog
docwiki.setup

index 9b7baa0eeabfd367f6706f6b2b2c3d3006670b7a..c01c59ac61a73fc32a88cb305064b7e75609e0a9 100644 (file)
@@ -198,6 +198,13 @@ sub getsetup () { #{{{
                safe => 0, # changing requires manual transition
                rebuild => 1,
        },
+       indexpages => {
+               type => "boolean",
+               defualt => 0,
+               description => "use page/index.mdwn source files",
+               safe => 1,
+               rebuild => 1,
+       },
        discussion => {
                type => "boolean",
                default => 1,
@@ -619,6 +626,9 @@ sub pagename ($) { #{{{
        my $type=pagetype($file);
        my $page=$file;
        $page=~s/\Q.$type\E*$// if defined $type && !$hooks{htmlize}{$type}{keepextension};
+       if ($config{indexpages} && $page=~/(.*)\/index$/) {
+               $page=$1;
+       }
        return $page;
 } #}}}
 
index 394eba26a88840dd2fc376e815d875d52261f10d..d68f57e4d39fdd47145e21b19092405e7b1edeb6 100644 (file)
@@ -25,6 +25,8 @@ ikiwiki (2.66) UNRELEASED; urgency=low
     page, and is preserved across rebuilds.
   * editpage: Be more aggressive (and less buggy) about cleaning up
     temporary files rendered during page preview.
+  * Add an indexpages option, which causes foo/index.mdwn to be the source
+    for page foo when foo.mdwn doesn't exist. Closes: #474611
 
  -- Joey Hess <joeyh@debian.org>  Thu, 25 Sep 2008 13:45:55 -0400
 
index 6d732fd6b1d59818687a930342b9b02a123e99f5..cd8ba5760b0755dda314ea8d569249a3050cc853 100644 (file)
@@ -14,6 +14,7 @@ use IkiWiki::Setup::Standard {
        syslog => 0,
        userdir => "users",
        usedirs => 0,
+       indexpages => 1,
        prefix_directives => 1,
        add_plugins => [qw{goodstuff version haiku polygen fortune}],
 }