summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki/Plugin/htmltidy.pm6
-rw-r--r--IkiWiki/Render.pm8
-rw-r--r--debian/changelog11
-rw-r--r--doc/plugins/aggregate.mdwn4
-rw-r--r--doc/plugins/write.mdwn12
5 files changed, 33 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/htmltidy.pm b/IkiWiki/Plugin/htmltidy.pm
index fa08e4ef5..6c1fba98e 100644
--- a/IkiWiki/Plugin/htmltidy.pm
+++ b/IkiWiki/Plugin/htmltidy.pm
@@ -13,11 +13,11 @@ use IkiWiki;
use IPC::Open2;
sub import { #{{{
- IkiWiki::hook(type => "sanitize", id => "tidy", call => \&sanitize);
+ IkiWiki::hook(type => "format", id => "tidy", call => \&format);
} # }}}
-sub sanitize ($) { #{{{
- open2(*IN, *OUT, 'tidy -quiet -xml -indent -utf8') or return shift;
+sub format ($) { #{{{
+ open2(*IN, *OUT, 'tidy -quiet -asxhtml -indent -utf8 --show-warnings no') or return shift;
# open2 doesn't respect "use open ':utf8'"
binmode (IN, ':utf8');
binmode (OUT, ':utf8');
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index 09b871900..b855d2c8f 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -187,7 +187,13 @@ sub genpage ($$$) { #{{{
shift->(page => $page, destpage => $page, template => $template);
});
- return $template->output;
+ $content=$template->output;
+
+ run_hooks(format => sub {
+ $content=shift->($content);
+ });
+
+ return $content;
} #}}}
sub check_overwrite ($$) { #{{{
diff --git a/debian/changelog b/debian/changelog
index de7d64344..d68a37864 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,8 +13,15 @@ ikiwiki (1.16) UNRELEASED; urgency=low
* Also generate rel=bookmark links for permalinks.
* Fix the htmltidy plugin, which wasn't working due my breaking it when
I added it..
-
- -- Joey Hess <joeyh@debian.org> Fri, 4 Aug 2006 03:03:19 -0400
+ * Don't run tidy with -xml as that fails if the input is not well-formed.
+ Run it with -asxhtml instead, so it will output well-formed xhtml no
+ matter what the input.
+ * Disable tidy warnings too.
+ * Add a new format hook, and make tidy use it, since tidy can really only
+ operate on and output complete html documents, not the body chunks
+ that sanitise gets.
+
+ -- Joey Hess <joeyh@debian.org> Fri, 4 Aug 2006 03:33:09 -0400
ikiwiki (1.15) unstable; urgency=low
diff --git a/doc/plugins/aggregate.mdwn b/doc/plugins/aggregate.mdwn
index 4cd5b57ac..fe17199e3 100644
--- a/doc/plugins/aggregate.mdwn
+++ b/doc/plugins/aggregate.mdwn
@@ -13,7 +13,9 @@ aggregated feeds.
## setup
Make sure that you have the [[html]] plugin enabled, as the created pages are
-in html format. The [[meta]] and [[tag]] plugins are also recommended.
+in html format. The [[meta]] and [[tag]] plugins are also recommended. The
+[[htmltidy]] plugin is suggested, since feeds can easily contain invalid
+html which tidy can fix.
You will need to run ikiwiki periodically from a cron job, passing it the
--aggregate parameter, to make it check for new posts. Here's an example
diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn
index 79bd75e9b..6d9054389 100644
--- a/doc/plugins/write.mdwn
+++ b/doc/plugins/write.mdwn
@@ -129,10 +129,20 @@ to set it, as setting a variable that's not present is an error.
IkiWiki::hook(type => "sanitize", id => "foo", call => \&sanitize);
Use this to implement html sanitization or anything else that needs to
-modify the content of a page after it has been fully converted to html.
+modify the body of a page after it has been fully converted to html.
The function is passed the page content and should return the sanitized
content.
+## format
+
+ IkiWiki::hook(type => "format", id => "foo", call => \&format);
+
+The function is passed the complete page content and can reformat it
+and return the new content. The difference between format and sanitize is
+that sanitize only acts on the page body, while format can modify the
+entire html page including the header and footer inserted by ikiwiki, the
+html document type, etc.
+
## delete
IkiWiki::hook(type => "delete", id => "foo", call => \&delete);