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::Indent=1;
22 local $Data::Dumper::Pad="\t";
23 local $Data::Dumper::Sortkeys=1;
24 local $Data::Dumper::Quotekeys=0;
26 my @ret="#!/usr/bin/perl
27 # Setup file for ikiwiki.
28 # Passing this to ikiwiki --setup will make ikiwiki generate wrappers and
31 # Remember to re-run ikiwiki --setup any time you edit this file.
33 use IkiWiki::Setup::Standard {";
35 foreach my $id (sort keys %{$IkiWiki::hooks{getsetup}}) {
36 my @setup=$IkiWiki::hooks{getsetup}{$id}{call}->();
38 push @ret, "\t# $id plugin";
41 my %info=%{shift @setup};
43 push @ret, "\t# ".$info{description} if exists $info{description};
47 if (exists $setup{$key} && defined $setup{$key}) {
51 elsif (exists $info{default}) {
52 $value=$info{default};
54 elsif (exists $info{example}) {
55 $value=$info{example};
58 my $dumpedvalue=Dumper($value);
61 push @ret, "\t$prefix$key=$dumpedvalue,";