* htmltidy plugin from Faidon.

master
joey 2006-07-29 20:50:20 +00:00
parent aa8bf534d9
commit 48f9d39339
6 changed files with 41 additions and 41 deletions

View File

@ -0,0 +1,32 @@
#!/usr/bin/perl
# HTML Tidy plugin
# requires 'tidy' binary, found in Debian or http://tidy.sf.net/
# mostly a proof-of-concept on how to use external filters.
# It is particularly useful when the html plugin is used.
#
# by Faidon Liambotis
package IkiWiki::Plugin::tidy;
use warnings;
use strict;
use IkiWiki;
use IPC::Open2;
sub import { #{{{
IkiWiki::hook(type => "sanitize", id => "tidy", call => \&sanitize);
} # }}}
sub sanitize ($) { #{{{
open2(*IN, *OUT, 'tidy -quiet -xml -indent -utf8') or return shift;
# open2 doesn't respect "use open ':utf8'"
binmode (IN, ':utf8');
binmode (OUT, ':utf8');
print OUT shift;
close OUT;
local $/ = undef;
return <IN>;
} # }}}
1

3
debian/changelog vendored
View File

@ -10,8 +10,9 @@ ikiwiki (1.13) UNRELEASED; urgency=low
other gunk from the display, much nicer. You may want to rebuild your wiki
when upgrading to get the cleanup globally.
* Polygen plugin from Enrico.
* htmltidy plugin from Faidon.
-- Joey Hess <joeyh@debian.org> Sat, 29 Jul 2006 14:22:18 -0400
-- Joey Hess <joeyh@debian.org> Sat, 29 Jul 2006 16:43:50 -0400
ikiwiki (1.12) unstable; urgency=low

2
debian/control vendored
View File

@ -10,7 +10,7 @@ Package: ikiwiki
Architecture: all
Depends: ${perl:Depends}, libxml-simple-perl, markdown, libtimedate-perl, libhtml-template-perl, libhtml-scrubber-perl, libcgi-formbuilder-perl (>= 3.02.02), libtime-duration-perl, libcgi-session-perl, libmail-sendmail-perl, gcc | c-compiler, libc6-dev | libc-dev
Recommends: subversion | git-core, hyperestraier
Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl
Suggests: viewcvs, librpc-xml-perl, libtext-wikiformat-perl, polygen, tidy
Description: a wiki compiler
ikiwiki converts a directory full of wiki pages into html pages suitable
for publishing on a website. Unlike many wikis, ikiwiki does not have its

View File

@ -75,7 +75,7 @@ use IkiWiki::Setup::Standard {
# To add plugins, list them here.
#add_plugins => [qw{meta tag pagecount brokenlinks search smiley
# wikitext camelcase pagestats}],
# wikitext camelcase pagestats htmltidy}],
# If you want to disable any of the default plugins, list them here.
#disable_plugins => [qw{inline htmlscrubber}],
}

View File

@ -1,38 +0,0 @@
Obvious and straightforward ;-)
tidy should be probably added to Suggests -- doc/ikiwiki.setup should also be updated.
(yes, I'm too lazy today...)
-- [[Faidon]]
---
#!/usr/bin/perl
# HTML Tidy plugin
# requires 'tidy' binary, found in Debian or http://tidy.sf.net/
# mostly a proof-of-concept on how to use external filters.
# It is particularly useful when the html plugin is used.
package IkiWiki::Plugin::tidy;
use warnings;
use strict;
use IkiWiki;
use IPC::Open2;
sub import { #{{{
IkiWiki::hook(type => "sanitize", id => "tidy", call => \&sanitize);
} # }}}
sub sanitize ($) { #{{{
open2(*IN, *OUT, 'tidy -quiet -xml -indent -utf8') or return shift;
# open2 doesn't respect "use open ':utf8'"
binmode (IN, ':utf8');
binmode (OUT, ':utf8');
print OUT shift;
close OUT;
local $/ = undef;
return <IN>;
} # }}}
1

View File

@ -0,0 +1,5 @@
This plugin uses [tidy](http://tidy.sourceforge.net/) to tidy up the html
emitted by ikiwiki. Besides being nicely formatted, this helps ensure that
even if users enter suboptimal html, your wiki generates 100% valid html.
This plugin is included in ikiwiki, but is not enabled by default.