From: Joey Hess Date: Fri, 19 Mar 2010 19:50:59 +0000 (-0400) Subject: Add support for setup files written in YAML. X-Git-Tag: 3.20100403~131 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bba513a3e52170dc06b545a44f2d859ae4b757b5;p=ikiwiki.git Add support for setup files written in YAML. Not the default. (Yet?) --- diff --git a/IkiWiki/Setup/Yaml.pm b/IkiWiki/Setup/Yaml.pm new file mode 100644 index 000000000..ba9192faf --- /dev/null +++ b/IkiWiki/Setup/Yaml.pm @@ -0,0 +1,43 @@ +#!/usr/bin/perl + +package IkiWiki::Setup::Yaml; + +use warnings; +use strict; +use IkiWiki; +use YAML; + +sub loaddump ($$) { + my $class=shift; + my $content=shift; + + IkiWiki::Setup::merge(Load($content)); +} + +sub gendump ($@) { + my $class=shift; + + "# IkiWiki::Setup::Yaml - YAML formatted setup file", + "#", + (map { "# $_" } @_), + "#", + IkiWiki::Setup::commented_dump(\&dumpline, "") +} + + +sub dumpline ($$$$) { + my $key=shift; + my $value=shift; + my $type=shift; + my $prefix=shift; + + $YAML::UseHeader=0; + my $dump=Dump({$key => $value}); + chomp $dump; + if (length $prefix) { + $dump=join("", map { $prefix.$_ } split(/\n/, $dump)); + } + return $dump; +} + +1 diff --git a/debian/changelog b/debian/changelog index 73f6fcff8..e020b380f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ ikiwiki (3.20100313) UNRELEASED; urgency=low for security or other reasons. Closes: #447267 (Thanks to Aaron Wilson for the original patch.) * Allow wrappers to be built using tcc. + * Add support for setup files written in YAML. -- Joey Hess Sat, 13 Mar 2010 14:48:10 -0500