template: Make edit link for new templates ensure the page is located under toplevel...
[ikiwiki] / IkiWiki / Plugin / wikitext.pm
1 #!/usr/bin/perl
2 # WikiText markup
3 package IkiWiki::Plugin::wikitext;
4
5 use warnings;
6 use strict;
7 use IkiWiki 2.00;
8
9 sub import { #{{{
10         hook(type => "getsetup", id => "wiki", call => \&getsetup);
11         hook(type => "htmlize", id => "wiki", call => \&htmlize);
12 } # }}}
13
14 sub getsetup () { #{{{
15         return
16                 plugin => {
17                         safe => 0, # format plugin
18                         rebuild => undef,
19                 },
20 } #}}}
21
22
23 sub htmlize (@) { #{{{
24         my %params=@_;
25         my $content = $params{content};
26
27         eval q{use Text::WikiFormat};
28         return $content if $@;
29         return Text::WikiFormat::format($content, undef, { implicit_links => 0 });
30 } # }}}
31
32 1