2 # Plaintext as a wiki page type - links WikiLinks and URIs.
4 # Copyright (C) 2008 Gabriel McManus <gmcmanus@gmail.com>
5 # Licensed under the GNU General Public License, version 2 or later
7 package IkiWiki::Plugin::plaintext;
16 hook(type => "filter", id => "txt", call => \&filter);
17 hook(type => "htmlize", id => "txt", call => \&htmlize);
20 # We use filter to convert raw text to HTML
21 # (htmlize is called after other plugins insert HTML)
24 my $content = $params{content};
26 if ($pagesources{$params{page}} =~ /.txt$/) {
27 encode_entities($content);
28 my $finder = URI::Find->new(
30 my($uri, $orig_uri) = @_;
31 return qq|<a href="$uri">$orig_uri</a>|;
33 $finder->find(\$content);
34 $content = "<pre>" . $content . "</pre>";
39 # We need this to register the .txt file extension
42 return $params{content};