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