summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/creole.pm
blob: a1e4b31d326c7d5d9f2480be501a09c1f43e0bbb (plain)
  1. #!/usr/bin/perl
  2. # WikiCreole markup
  3. # based on the WikiText plugin.
  4. package IkiWiki::Plugin::creole;
  5. use warnings;
  6. use strict;
  7. use IkiWiki 3.00;
  8. sub import {
  9. hook(type => "getsetup", id => "creole", call => \&getsetup);
  10. hook(type => "htmlize", id => "creole", call => \&htmlize);
  11. }
  12. sub getsetup {
  13. return
  14. plugin => {
  15. safe => 1,
  16. rebuild => 1, # format plugin
  17. section => "format",
  18. },
  19. }
  20. sub htmlize (@) {
  21. my %params=@_;
  22. my $content = $params{content};
  23. eval q{use Text::WikiCreole};
  24. return $content if $@;
  25. # don't parse WikiLinks, ikiwiki already does
  26. creole_customlinks();
  27. creole_custombarelinks();
  28. return creole_parse($content);
  29. }
  30. 1