]> sipb.mit.edu Git - ikiwiki.git/blob - IkiWiki/Setup/Standard.pm
add blog post template
[ikiwiki.git] / IkiWiki / Setup / Standard.pm
1 #!/usr/bin/perl
2 # Standard ikiwiki setup module.
3 # Parameters to import should be all the standard ikiwiki config stuff,
4 # plus hashes for cgiwrapper and svnwrapper, which specify any differing
5 # config stuff for them and cause the wrappers to be made.
6
7 use warnings;
8 use strict;
9 use IkiWiki::Wrapper;
10 use IkiWiki::Render;
11
12 package IkiWiki::Setup::Standard;
13
14 sub import {
15         IkiWiki::setup_standard(@_);
16 }
17         
18 package IkiWiki;
19
20 sub setup_standard {
21         my %setup=%{$_[1]};
22
23         debug("generating wrappers..");
24         my %startconfig=(%config);
25         foreach my $wrapper (@{$setup{wrappers}}) {
26                 %config=(%startconfig, verbose => 0, %setup, %{$wrapper});
27                 checkconfig();
28                 gen_wrapper();
29         }
30         %config=(%startconfig);
31         
32         debug("rebuilding wiki..");
33         foreach my $c (keys %setup) {
34                 $config{$c}=possibly_foolish_untaint($setup{$c})
35                         if defined $setup{$c} && ! ref $setup{$c};
36         }
37         $config{rebuild}=1;
38
39         checkconfig();
40         lockwiki();
41         loadindex();
42         refresh();
43
44         debug("done");
45         saveindex();
46 }
47
48 1