# Blosxom Plugin: tidyhtml # Author(s): Rhesa Rozendaal # Version: 0.03 # URL: http://oss.rhesa.com/blog/text/blosxom/plugins/tidyhtml package tidyhtml; use strict; # --- Configurable variables ----- my $tidy_config = { tidy_mark => 'no', wrap => '120', indent => 'auto', output_xhtml => 'yes', char_encoding => 'utf8', doctype => 'strict', add_xml_decl => 'yes', alt_text => 'photo', }; # -------------------------------- use Encode; use HTML::Tidy; sub last { # only operate on html content types return unless $blosxom::header->{-type} =~ /html/; # try to convert to utf-8 eval { $blosxom::output = decode_utf8( $blosxom::output, Encode::FB_CROAK ); }; # clean up the html my $tidy = HTML::Tidy->new($tidy_config); $blosxom::output = $tidy->clean($blosxom::output); return; } sub start { 1 } 1; # vi:ft=perl