summaryrefslogtreecommitdiff
path: root/IkiWiki/Setup/Standard.pm
blob: a13e7805a1c5b8632651ee1b5b8897dffd336944 (plain)
  1. #!/usr/bin/perl
  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.
  5. use warnings;
  6. use strict;
  7. use IkiWiki::Wrapper;
  8. use IkiWiki::Render;
  9. package IkiWiki::Setup::Standard;
  10. sub import {
  11. IkiWiki::setup_standard(@_);
  12. }
  13. package IkiWiki;
  14. sub setup_standard {
  15. my %setup=%{$_[1]};
  16. if (! $config{refresh}) {
  17. debug("generating wrappers..");
  18. my %startconfig=(%config);
  19. foreach my $wrapper (@{$setup{wrappers}}) {
  20. %config=(%startconfig, verbose => 0, %setup, %{$wrapper});
  21. checkconfig();
  22. gen_wrapper();
  23. }
  24. %config=(%startconfig);
  25. }
  26. foreach my $c (keys %setup) {
  27. $config{$c}=possibly_foolish_untaint($setup{$c})
  28. if defined $setup{$c} && ! ref $setup{$c};
  29. }
  30. if (! $config{refresh}) {
  31. $config{rebuild}=1;
  32. debug("rebuilding wiki..");
  33. }
  34. else {
  35. debug("refreshing wiki..");
  36. }
  37. checkconfig();
  38. lockwiki();
  39. loadindex();
  40. refresh();
  41. debug("done");
  42. saveindex();
  43. }
  44. 1