2 # Standard ikiwiki setup module.
3 # Parameters to import should be all the standard ikiwiki config stuff,
4 # plus an array of wrappers to set up.
6 package IkiWiki::Setup::Standard;
12 $IkiWiki::Setup::raw_setup=$_[1];
15 sub generate (@) { #{{{
18 eval q{use Data::Dumper};
20 local $Data::Dumper::Terse=1;
21 local $Data::Dumper::Sortkeys=1;
22 local $Data::Dumper::Pad="\t";
24 my @ret="#!/usr/bin/perl
25 # Setup file for ikiwiki.
26 # Passing this to ikiwiki --setup will make ikiwiki generate wrappers and
29 # Remember to re-run ikiwiki --setup any time you edit this file.
31 use IkiWiki::Setup::Standard {";
33 foreach my $id (sort keys %{$IkiWiki::hooks{getsetup}}) {
34 my @setup=$IkiWiki::hooks{getsetup}{$id}{call}->();
36 push @ret, "\t# $id plugin";
39 my %info=%{shift @setup};
41 push @ret, "\t# ".$info{description} if exists $info{description};
45 if (exists $setup{$key} && defined $setup{$key}) {
49 elsif (exists $info{default}) {
50 $value=$info{default};
52 elsif (exists $info{example}) {
53 $value=$info{example};
56 my $dumpedvalue=Dumper($value);
59 push @ret, "\t$prefix$key=$dumpedvalue,";