shorten setuptype

master
Joey Hess 2010-03-19 15:55:10 -04:00
parent bba513a3e5
commit 07bb08d094
2 changed files with 6 additions and 6 deletions

View File

@ -469,7 +469,7 @@ sub getsetup () {
}, },
setuptype => { setuptype => {
type => "internal", type => "internal",
default => "IkiWiki::Setup::Standard", default => "Standard",
description => "perl class to use to dump setup file", description => "perl class to use to dump setup file",
safe => 0, safe => 0,
rebuild => 0, rebuild => 0,

View File

@ -28,7 +28,7 @@ sub load ($;$) {
} }
close IN; close IN;
if ($content=~/(use\s+)?(IkiWiki::Setup::\w+)/) { if ($content=~/(use\s+)?IkiWiki::Setup::(\w+)/) {
$config{setuptype}=$2; $config{setuptype}=$2;
if ($1) { if ($1) {
error sprintf(gettext("cannot load %s in safe mode"), $file) error sprintf(gettext("cannot load %s in safe mode"), $file)
@ -37,9 +37,9 @@ sub load ($;$) {
error("$file: ".$@) if $@; error("$file: ".$@) if $@;
} }
else { else {
eval qq{require $config{setuptype}}; eval qq{require IkiWiki::Setup::$config{setuptype}};
error $@ if $@; error $@ if $@;
$config{setuptype}->loaddump(IkiWiki::possibly_foolish_untaint($content)); "IkiWiki::Setup::$config{setuptype}"->loaddump(IkiWiki::possibly_foolish_untaint($content));
} }
} }
else { else {
@ -50,9 +50,9 @@ sub load ($;$) {
sub dump ($) { sub dump ($) {
my $file=IkiWiki::possibly_foolish_untaint(shift); my $file=IkiWiki::possibly_foolish_untaint(shift);
eval qq{require $config{setuptype}}; eval qq{require IkiWiki::Setup::$config{setuptype}};
error $@ if $@; error $@ if $@;
my @dump=$config{setuptype}->gendump( my @dump="IkiWiki::Setup::$config{setuptype}"->gendump(
"Setup file for ikiwiki.", "Setup file for ikiwiki.",
"", "",
"Passing this to ikiwiki --setup will make ikiwiki generate", "Passing this to ikiwiki --setup will make ikiwiki generate",