summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/creole.pm
blob: 425e71043f0133f5b855c32932bc114542c83d7d (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. },
  18. }
  19. sub htmlize (@) {
  20. my %params=@_;
  21. my $content = $params{content};
  22. eval q{use Text::WikiCreole};
  23. return $content if $@;
  24. # don't parse WikiLinks, ikiwiki already does
  25. creole_customlinks();
  26. creole_custombarelinks();
  27. return creole_parse($content);
  28. }
  29. 1