diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-09-29 18:51:16 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-09-29 18:51:16 -0400 |
commit | 2d45a303e253c4a20ce456a82e8ac694b49c2c2d (patch) | |
tree | e5f9adb67b471d9d9712ea5225185f8bba738424 /IkiWiki.pm | |
parent | a7fd6debc50e95d189f08cd47d1fd1fe2a5aa2d6 (diff) | |
download | ikiwiki-2d45a303e253c4a20ce456a82e8ac694b49c2c2d.tar ikiwiki-2d45a303e253c4a20ce456a82e8ac694b49c2c2d.tar.gz |
add newpagefile function
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index c01c59ac6..34b315bbc 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -20,7 +20,7 @@ use Exporter q{import}; our @EXPORT = qw(hook debug error template htmlpage add_depends pagespec_match bestlink htmllink readfile writefile pagetype srcfile pagename displaytime will_render gettext urlto targetpage - add_underlay pagetitle titlepage linkpage + add_underlay pagetitle titlepage linkpage newpagefile %config %links %pagestate %wikistate %renderedfiles %pagesources %destsources); our $VERSION = 2.00; # plugin interface version, next is ikiwiki version @@ -632,13 +632,26 @@ sub pagename ($) { #{{{ return $page; } #}}} +sub newpagefile ($$) { #{{{ + my $page=shift; + my $type=shift; + + if (! $config{indexpages} || $page eq 'index') { + return $page.".".$type; + } + else { + return $page."/index.".$type; + } +} #}}} + sub targetpage ($$) { #{{{ my $page=shift; my $ext=shift; - if (! $config{usedirs} || $page =~ /^index$/ ) { + if (! $config{usedirs} || $page eq 'index') { return $page.".".$ext; - } else { + } + else { return $page."/index.".$ext; } } #}}} |