]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/smcvpostcomment.pm
smcvpostcomment: import other plugins lazily and remove unnecessary use of CGI
[ikiwiki.git] / IkiWiki / Plugin / smcvpostcomment.pm
index 6bd3b297000c1ad9e1ab50ca939a6ffd43232af7..40ffe816425722d89852bf37ee59479dbfe398f5 100644 (file)
@@ -8,9 +8,6 @@ package IkiWiki::Plugin::smcvpostcomment;
 use warnings;
 use strict;
 use IkiWiki 2.00;
 use warnings;
 use strict;
 use IkiWiki 2.00;
-use IkiWiki::Plugin::inline;
-use IkiWiki::Plugin::mdwn;
-use CGI 'escapeHTML';
 
 use constant PLUGIN => "smcvpostcomment";
 use constant PREVIEW => "Preview";
 
 use constant PLUGIN => "smcvpostcomment";
 use constant PREVIEW => "Preview";
@@ -24,6 +21,13 @@ sub import { #{{{
        hook(type => "htmlize", id => "_".PLUGIN,
                call => \&IkiWiki::Plugin::mdwn::htmlize);
        IkiWiki::loadplugin("inline");
        hook(type => "htmlize", id => "_".PLUGIN,
                call => \&IkiWiki::Plugin::mdwn::htmlize);
        IkiWiki::loadplugin("inline");
+       IkiWiki::loadplugin("mdwn");
+} # }}}
+
+sub htmlize { # {{{
+       eval { use IkiWiki::Plugin::mdwn; };
+       error($@) if ($@);
+       return IkiWiki::Plugin::mdwn::htmlize(@_)
 } # }}}
 
 sub getsetup () { #{{{
 } # }}}
 
 sub getsetup () { #{{{
@@ -65,6 +69,8 @@ sub preprocess (@) { #{{{
 
        my $posts = '';
        unless (defined $params{inline} && !IkiWiki::yesno($params{inline})) {
 
        my $posts = '';
        unless (defined $params{inline} && !IkiWiki::yesno($params{inline})) {
+               eval { use IkiWiki::Plugin::inline; };
+               error($@) if ($@);
                my @args = (
                        pages => "internal($params{page}/_comment_*)",
                        template => PLUGIN . "_display",
                my @args = (
                        pages => "internal($params{page}/_comment_*)",
                        template => PLUGIN . "_display",