From 1c00717cb2737bde3870b2fe504f40bb7d215477 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 26 Jul 2008 15:34:38 -0400 Subject: can now dump fully functional setup files --- IkiWiki/Setup/Standard.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'IkiWiki/Setup') 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 ($@) { #{{{ -- cgit v1.2.3