3 package IkiWiki::Setup::Standard;
9 # Parameters to import should be all the standard ikiwiki config, in a hash.
11 IkiWiki::Setup::merge($_[1]);
17 my $thisperl = eval q{use Config; $Config{perlpath}};
23 "use IkiWiki::Setup::Standard {",
24 IkiWiki::Setup::commented_dump(\&dumpline, "\t"),
34 eval q{use Data::Dumper};
36 local $Data::Dumper::Terse=1;
37 local $Data::Dumper::Indent=1;
38 local $Data::Dumper::Pad="\t";
39 local $Data::Dumper::Sortkeys=1;
40 local $Data::Dumper::Quotekeys=0;
41 # only the perl version preserves utf-8 in output
42 local $Data::Dumper::Useperl=1;
45 if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) {
49 elsif (ref $value eq 'ARRAY' && @$value && ! grep { /[^\S]/ } @$value) {
50 # dump simple array as qw{}
51 $dumpedvalue="[qw{".join(" ", @$value)."}]";
54 $dumpedvalue=Dumper($value);
57 # add to second and subsequent lines
58 my @lines=split(/\n/, $dumpedvalue);
60 for (my $x=0; $x <= $#lines; $x++) {
61 $lines[$x] =~ s/^\t//;
62 $dumpedvalue.="\t".($x ? $prefix : "").$lines[$x]."\n";
65 $dumpedvalue=~s/^\t//;
69 return "\t$prefix$key => $dumpedvalue,";