diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-07-26 15:34:38 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-07-26 15:34:38 -0400 |
commit | 1c00717cb2737bde3870b2fe504f40bb7d215477 (patch) | |
tree | cd92f4cf3abde7a5398b7cb8c5ac16119ba6e5b5 /IkiWiki/Setup | |
parent | cd029da49314981dad3ee89cc10946075825fb21 (diff) | |
download | ikiwiki-1c00717cb2737bde3870b2fe504f40bb7d215477.tar ikiwiki-1c00717cb2737bde3870b2fe504f40bb7d215477.tar.gz |
can now dump fully functional setup files
Diffstat (limited to 'IkiWiki/Setup')
-rw-r--r-- | IkiWiki/Setup/Standard.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index d88dc9e1c..ed4331d61 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -29,15 +29,21 @@ sub dumpline ($$$$) { #{{{ 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 ($@) { #{{{ |