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;
22 my @ret="#!/usr/bin/perl
23 # Setup file for ikiwiki.
24 # Passing this to ikiwiki --setup will make ikiwiki generate wrappers and
27 # Remember to re-run ikiwiki --setup any time you edit this file.
29 use IkiWiki::Setup::Standard {";
31 foreach my $id (sort keys %{$IkiWiki::hooks{getsetup}}) {
32 my @setup=$IkiWiki::hooks{getsetup}{$id}{call}->();
34 push @ret, "\t# $id plugin";
37 my %info=%{shift @setup};
39 push @ret, "\t# ".$info{description} if exists $info{description};
43 if (exists $setup{$key} && defined $setup{$key}) {
47 elsif (exists $info{default}) {
48 $value=$info{default};
50 elsif (exists $info{example}) {
51 $value=$info{example};
54 my $dumpedvalue=Dumper($value);
56 push @ret, "\t$prefix$key=$dumpedvalue,";