summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/wikitext.pm
blob: accb03bbef8317cad028d95fe36a68b466d9bd0f (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. },
  17. }
  18. sub htmlize (@) {
  19. my %params=@_;
  20. my $content = $params{content};
  21. eval q{use Text::WikiFormat};
  22. return $content if $@;
  23. return Text::WikiFormat::format($content, undef, { implicit_links => 0 });
  24. }
  25. 1