diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-29 20:50:20 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-29 20:50:20 +0000 |
commit | 48f9d393393709d8e998a9eb8d4095773ab185a1 (patch) | |
tree | 81a1ed88811689edf59f081efffa78d86e1bf1b9 | |
parent | aa8bf534d938a65d0fd3db813c52c05ed28099f8 (diff) | |
download | ikiwiki-48f9d393393709d8e998a9eb8d4095773ab185a1.tar ikiwiki-48f9d393393709d8e998a9eb8d4095773ab185a1.tar.gz |
* htmltidy plugin from Faidon.
-rw-r--r-- | IkiWiki/Plugin/htmltidy.pm | 32 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | debian/control | 2 | ||||
-rw-r--r-- | doc/ikiwiki.setup | 2 | ||||
-rw-r--r-- | doc/patchqueue/html_tidy_plugin.mdwn | 38 | ||||
-rw-r--r-- | doc/plugins/htmltidy.mdwn | 5 |
6 files changed, 41 insertions, 41 deletions
diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm new file mode 100644 index 000000000..ad405dce5 --- /dev/null +++ b/IkiWiki/Plugin/htmltidy.pm @@ -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 diff --git a/debian/changelog b/debian/changelog index f4f0cffab..6ee1e7b14 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 diff --git a/debian/control b/debian/control index 19cdddf8e..aa8b3fa24 100644 --- a/debian/control +++ b/debian/control @@ -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 diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index b52f1ad39..9310a4556 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -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}], } diff --git a/doc/patchqueue/html_tidy_plugin.mdwn b/doc/patchqueue/html_tidy_plugin.mdwn deleted file mode 100644 index a8b9f2728..000000000 --- a/doc/patchqueue/html_tidy_plugin.mdwn +++ /dev/null @@ -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
\ No newline at end of file diff --git a/doc/plugins/htmltidy.mdwn b/doc/plugins/htmltidy.mdwn new file mode 100644 index 000000000..2c6f7b7fe --- /dev/null +++ b/doc/plugins/htmltidy.mdwn @@ -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. |