Add support for setup files written in YAML.
authorJoey Hess <joey@gnu.kitenet.net>
Fri, 19 Mar 2010 19:50:59 +0000 (15:50 -0400)
committerJoey Hess <joey@gnu.kitenet.net>
Fri, 19 Mar 2010 19:52:53 +0000 (15:52 -0400)
Not the default. (Yet?)

IkiWiki/Setup/Yaml.pm [new file with mode: 0644]
debian/changelog

diff --git a/IkiWiki/Setup/Yaml.pm b/IkiWiki/Setup/Yaml.pm
new file mode 100644 (file)
index 0000000..ba9192f
--- /dev/null
@@ -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
index 73f6fcff8aa4945828feb39b9b1af601aa44733d..e020b380f8cb4f603c2ac14863151014cf5d4da6 100644 (file)
@@ -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 <joeyh@debian.org>  Sat, 13 Mar 2010 14:48:10 -0500