summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/wikitext.pm
blob: b24630b15bf9c380e2b68af44f59bcffaaf5bb70 (plain)
  1. #!/usr/bin/perl
  2. # WikiText markup
  3. package IkiWiki::Plugin::wikitext;
  4. use warnings;
  5. use strict;
  6. use IkiWiki 3.00;
  7. sub import {
  8. hook(type => "getsetup", id => "wiki", call => \&getsetup);
  9. hook(type => "htmlize", id => "wiki", call => \&htmlize);
  10. }
  11. sub getsetup () {
  12. return
  13. plugin => {
  14. safe => 0, # format plugin
  15. rebuild => undef,
  16. section => "format",
  17. },
  18. }
  19. sub htmlize (@) {
  20. my %params=@_;
  21. my $content = $params{content};
  22. eval q{use Text::WikiFormat};
  23. return $content if $@;
  24. return Text::WikiFormat::format($content, undef, { implicit_links => 0 });
  25. }
  26. 1