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};
37 local $Data::Dumper::Terse=1;
38 local $Data::Dumper::Indent=1;
39 local $Data::Dumper::Pad="\t";
40 local $Data::Dumper::Sortkeys=1;
41 local $Data::Dumper::Quotekeys=0;
42 # only the perl version preserves utf-8 in output
43 local $Data::Dumper::Useperl=1;
47 if (($type eq 'boolean' || $type eq 'integer') && $value=~/^[0-9]+$/) {
51 elsif (ref $value eq 'ARRAY' && @$value && ! grep { /[^\S]/ } @$value) {
52 # dump simple array as qw{}
53 $dumpedvalue="[qw{".join(" ", @$value)."}]";
56 $dumpedvalue=Dumper($value);
59 # add to second and subsequent lines
60 my @lines=split(/\n/, $dumpedvalue);
62 for (my $x=0; $x <= $#lines; $x++) {
63 $lines[$x] =~ s/^\t//;
64 $dumpedvalue.="\t".($x ? $prefix : "").$lines[$x]."\n";
67 $dumpedvalue=~s/^\t//;
71 return "\t$prefix$key => $dumpedvalue,";