safe => 0, # paranoia
rebuild => 0,
},
+ wrappers => {
+ type => "string",
+ default => undef,
+ description => "definitions of wrappers to generate",
+ safe => 0,
+ rebuild => 0,
+ },
+ wrapper => {
+ type => "internal",
+ default => undef,
+ description => "wrapper filename",
+ safe => 0,
+ rebuild => 0,
+ },
+ wrappermode => {
+ type => "internal",
+ default => undef,
+ description => "mode of wrapper file",
+ safe => 0,
+ rebuild => 0,
+ },
templatedir => {
type => "string",
default => "$installdir/share/ikiwiki/templates",
rebuild => 0,
},
+ exclude => {
+ type => "string",
+ default => undef,
+ example => '\.wav$',
+ description => "regexp of source files to ignore",
+ safe => 0, # regexp
+ rebuild => 1,
+ },
wiki_file_prune_regexps => {
type => "internal",
default => [qr/(^|\/)\.\.(\/|$)/, qr/^\./, qr/\/\./,
safe => 0,
rebuild => 0,
},
- wrapper => {
- type => "internal",
- default => undef,
- description => "wrapper file to generate",
- safe => 0,
- rebuild => 0,
- },
- wrappermode => {
- type => "internal",
- default => undef,
- description => "mode of wrapper file",
- safe => 0,
- rebuild => 0,
- },
setup => {
type => "internal",
default => undef,
safe => 0,
rebuild => 0,
},
- plugin => {
+ default_plugins => {
type => "internal",
default => [qw{mdwn link inline htmlscrubber passwordauth
openid signinedit lockedit conditional
recentchanges parentlinks}],
- description => "enabled plugins",
- safe => 0,
+ description => "plugins to enable by default",
+ safe => 1,
+ rebuild => 1,
+ },
+ add_plugins => {
+ type => "string",
+ default => [],
+ description => "plugins to add to the default configuration",
+ safe => 1,
+ rebuild => 1,
+ },
+ disable_plugins => {
+ type => "string",
+ default => [],
+ description => "plugins to disable",
+ safe => 1,
rebuild => 1,
},
libdir => {
unshift @INC, possibly_foolish_untaint($config{libdir});
}
- loadplugin($_) foreach @{$config{plugin}};
+ loadplugin($_) foreach @{$config{default_plugins}}, @{$config{add_plugins}};
run_hooks(getopt => sub { shift->() });
if (grep /^-/, @ARGV) {
$raw_setup=undef;
# Merge setup into existing config and untaint.
- $setup{plugin}=$config{plugin};
if (exists $setup{add_plugins}) {
- push @{$setup{plugin}}, @{$setup{add_plugins}};
- delete $setup{add_plugins};
+ push @{$setup{add_plugins}}, @{$config{add_plugins}};
}
if (exists $setup{exclude}) {
push @{$config{wiki_file_prune_regexps}}, $setup{exclude};
}
foreach my $c (keys %setup) {
if (defined $setup{$c}) {
- if (! ref $setup{$c}) {
+ if (! ref $setup{$c} || ref $setup{$c} eq 'Regexp') {
$config{$c}=IkiWiki::possibly_foolish_untaint($setup{$c});
}
elsif (ref $setup{$c} eq 'ARRAY') {
my $dumpedvalue;
if ($type eq 'boolean' || $type eq 'integer') {
+ # avoid quotes
$dumpedvalue=$value;
}
+ elsif ($type eq 'string' && ref $value eq 'ARRAY' && @$value &&
+ ! grep { /[^-A-Za-z0-9_]/ } @$value) {
+ # dump simple array as qw{}
+ $dumpedvalue="[qw{ ".join(" ", @$value)." }]";
+ }
else {
$dumpedvalue=Dumper($value);
chomp $dumpedvalue;
$dumpedvalue=~s/^\t//;
}
- return "\t$prefix$key=$dumpedvalue,";
+ return "\t$prefix$key => $dumpedvalue,";
} #}}}
sub dumpvalues ($@) { #{{{
"refresh!" => \$config{refresh},
"post-commit" => \$config{post_commit},
"render=s" => \$config{render},
- "wrappers!" => \$config{wrappers},
+ "wrappers!" => \$config{genwrappers},
"usedirs!" => \$config{usedirs},
"prefix-directives!" => \$config{prefix_directives},
"getctime" => \$config{getctime},
$config{wrappermode}=possibly_foolish_untaint($_[1])
},
"plugin=s@" => sub {
- push @{$config{plugin}}, $_[1];
+ push @{$config{add_plugins}}, $_[1];
},
"disable-plugin=s@" => sub {
push @{$config{disable_plugins}}, $_[1];
if ($config{setup}) {
require IkiWiki::Setup;
IkiWiki::Setup::load($config{setup});
- if (! $config{render} && ! $config{dumpsetup} &&
- (! $config{refresh} || $config{wrappers})) {
+ if (@{$config{wrappers}} &&
+ ! $config{render} && ! $config{dumpsetup} &&
+ (! $config{refresh} || $config{genwrappers})) {
debug(gettext("generating wrappers.."));
require IkiWiki::Wrapper;
my %origconfig=(%config);
my @wrappers=@{$config{wrappers}};
delete $config{wrappers};
+ delete $config{genwrappers};
foreach my $wrapper (@wrappers) {
%config=(%origconfig,
rebuild => 0,