From 2bd4dea7f029f30b4b07ba2e91358f5c3bf04a10 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Jul 2008 13:59:36 -0400 Subject: changelog --- debian/changelog | 1 + 1 file changed, 1 insertion(+) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index f10200a52..375ae6078 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,7 @@ ikiwiki (2.54) UNRELEASED; urgency=low uuid in feeds. (smcv) * Move yesno function out of inline and into IkiWiki core, not exported. * meta: fix title() PageSpec (smcv) + * Some footer style changes. (smcv) -- Josh Triplett Wed, 09 Jul 2008 21:30:33 -0700 -- cgit v1.2.3 From edb59cd5b949de7a68f3b74e7949bf3893b23c6a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Jul 2008 14:41:40 -0400 Subject: Error handling improvement for preprocess hooks. It's now safe to call error() from such hooks; it will cause a nicely formatted error message to be inserted into the page. --- IkiWiki.pm | 33 +++++++++++++++++++++------------ debian/changelog | 3 +++ doc/plugins/write.mdwn | 13 +++++++------ 3 files changed, 31 insertions(+), 18 deletions(-) (limited to 'debian') diff --git a/IkiWiki.pm b/IkiWiki.pm index d4e19c388..80e317110 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -768,21 +768,30 @@ sub preprocess ($$$;$$) { #{{{ } my $ret; if (! $scan) { - $ret=$hooks{preprocess}{$command}{call}->( - @params, - page => $page, - destpage => $destpage, - preview => $preprocess_preview, - ); + $ret=eval { + $hooks{preprocess}{$command}{call}->( + @params, + page => $page, + destpage => $destpage, + preview => $preprocess_preview, + ); + }; + if ($@) { + chomp $@; + $ret="[[!$command ". + gettext("Error").": $@"."]]"; + } } else { # use void context during scan pass - $hooks{preprocess}{$command}{call}->( - @params, - page => $page, - destpage => $destpage, - preview => $preprocess_preview, - ); + eval { + $hooks{preprocess}{$command}{call}->( + @params, + page => $page, + destpage => $destpage, + preview => $preprocess_preview, + ); + }; $ret=""; } $preprocessing{$page}--; diff --git a/debian/changelog b/debian/changelog index 375ae6078..d5b64df34 100644 --- a/debian/changelog +++ b/debian/changelog @@ -20,6 +20,9 @@ ikiwiki (2.54) UNRELEASED; urgency=low * Move yesno function out of inline and into IkiWiki core, not exported. * meta: fix title() PageSpec (smcv) * Some footer style changes. (smcv) + * Error handling improvement for preprocess hooks. It's now safe to call + error() from such hooks; it will cause a nicely formatted error message + to be inserted into the page. -- Josh Triplett Wed, 09 Jul 2008 21:30:33 -0700 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 6b49ec58d..4dc55e302 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -412,12 +412,13 @@ Aborts with an error message. If the second parameter is passed, it is a function that is called after the error message is printed, to do any final cleanup. -Note that while any plugin can use this for a fatal error, plugins should -try to avoid dying on bad input when building a page, as that will halt -the entire wiki build and make the wiki unusable. So for example, if a -[[ikiwiki/PreProcessorDirective]] is passed bad parameters, it's better to -return an error message, which can appear on the wiki page, rather than -calling error(). +If called inside a preprocess hook, error() does not abort the entire +wiki build, but instead replaces the [[ikiwiki/PreProcessorDirective]] with +a version containing the error message. + +In other hooks, error() is a fatal error, so use with care. Try to avoid +dying on bad input when building a page, as that will halt +the entire wiki build and make the wiki unusable. #### `template($;@)` -- cgit v1.2.3 From 9957c7fd5d17afdc2e7e4248ca8a961731048d51 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Jul 2008 15:46:20 -0400 Subject: Cut the size of the binary package in half by excluding pages for bugs and todo items from the html shipped in it. --- debian/changelog | 2 ++ docwiki.setup | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index d5b64df34..3c535fd5f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,6 +23,8 @@ ikiwiki (2.54) UNRELEASED; urgency=low * Error handling improvement for preprocess hooks. It's now safe to call error() from such hooks; it will cause a nicely formatted error message to be inserted into the page. + * Cut the size of the binary package in half by excluding pages for bugs + and todo items from the html shipped in it. -- Josh Triplett Wed, 09 Jul 2008 21:30:33 -0700 diff --git a/docwiki.setup b/docwiki.setup index 0a6a86678..ba3dd680d 100644 --- a/docwiki.setup +++ b/docwiki.setup @@ -9,7 +9,7 @@ use IkiWiki::Setup::Standard { underlaydir => "underlays/basewiki", wrappers => [], discussion => 0, - exclude => qr/\/discussion/, + exclude => qr/\/discussion|bugs\/*|todo\/*/, locale => '', verbose => 1, syslog => 0, -- cgit v1.2.3