From bed1f1037a4dfe6368c81ea2e2a0ac32f56126ce Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Sat, 12 Jul 2008 22:52:46 +0100 Subject: Add missing requirement of IkiWiki::render before starting to render things --- IkiWiki/Setup.pm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'IkiWiki') diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 2b76efc16..3b7a11253 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -97,6 +97,8 @@ sub setup () { #{{{ loadplugins(); checkconfig(); + require IkiWiki::Render; + if ($config{render}) { commandline_render(); } -- cgit v1.2.3 From e4e3d7e2d4195bcd22c467522719c9c6dd39216b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 12 Jul 2008 20:21:42 -0400 Subject: convert fatal error to warning Since perlmagick is not a hard dep, and goodstuff is enabled by default, imgs should not crash builds --- IkiWiki/Plugin/img.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index cc0e84b01..49e1d57d6 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -46,7 +46,7 @@ sub preprocess (@) { #{{{ my $base = IkiWiki::basename($file); eval q{use Image::Magick}; - error($@) if $@; + return "[[img ".gettext("Image::Magick not installed")."]]" if $@; my $im = Image::Magick->new; my $imglink; my $r; -- cgit v1.2.3 From e3c0e4977449de2eec36e254a7e131693ba2f822 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 12 Jul 2008 23:23:25 -0400 Subject: only htmlize errors when cgi is actually running --- IkiWiki.pm | 5 ----- IkiWiki/CGI.pm | 10 ++++++++++ doc/bugs/html_errors.mdwn | 3 +++ ikiwiki.in | 7 +++++-- po/ikiwiki.pot | 50 +++++++++++++++++++++++++++-------------------- 5 files changed, 47 insertions(+), 28 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki.pm b/IkiWiki.pm index f1a5f8058..d4e19c388 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -189,11 +189,6 @@ sub loadplugin ($) { #{{{ sub error ($;$) { #{{{ my $message=shift; my $cleaner=shift; - if ($config{cgi}) { - print "Content-type: text/html\n\n"; - print misctemplate(gettext("Error"), - "

".gettext("Error").": $message

"); - } log_message('err' => $message) if $config{syslog}; if (defined $cleaner) { $cleaner->(); diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 6770f6feb..d805506aa 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -750,4 +750,14 @@ sub cgi (;$$) { #{{{ } } #}}} +# Does not need tobe called directly; all errors will go through here. +sub cgierror ($) { #{{{ + my $message=shift; + + print "Content-type: text/html\n\n"; + print misctemplate(gettext("Error"), + "

".gettext("Error").": $message

"); + die $@; +} #}}} + 1 diff --git a/doc/bugs/html_errors.mdwn b/doc/bugs/html_errors.mdwn index 5a60e0449..aef2f7f71 100644 --- a/doc/bugs/html_errors.mdwn +++ b/doc/bugs/html_errors.mdwn @@ -1,2 +1,5 @@ ikiwiki will generate html formatted error messages to the command line if --cgi is set, even if it's not yet running as a cgi + +> [[done]], at last. Oldest open bug.. just thought of an elegant fix! +> --[[Joey]] diff --git a/ikiwiki.in b/ikiwiki.in index e0a591824..cc3f210b5 100755 --- a/ikiwiki.in +++ b/ikiwiki.in @@ -100,7 +100,7 @@ sub getconfig () { #{{{ else { # wrapper passes a full config structure in the environment # variable - eval possibly_foolish_untaint($ENV{WRAPPED_OPTIONS}); + eval {possibly_foolish_untaint($ENV{WRAPPED_OPTIONS})}; if ($@) { error("WRAPPED_OPTIONS: $@"); } @@ -123,7 +123,10 @@ sub main () { #{{{ } elsif ($config{cgi}) { require IkiWiki::CGI; - cgi(); + eval {cgi()}; + if ($@) { + cgierror($@); + } } elsif ($config{render}) { require IkiWiki::Render; diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index 8aef6cc1a..f94f5bdd3 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-11 06:04-0400\n" +"POT-Creation-Date: 2008-07-12 23:07-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -50,7 +50,7 @@ msgid "%s is not an editable page" msgstr "" #: ../IkiWiki/CGI.pm:438 ../IkiWiki/Plugin/brokenlinks.pm:24 -#: ../IkiWiki/Plugin/inline.pm:266 ../IkiWiki/Plugin/opendiscussion.pm:17 +#: ../IkiWiki/Plugin/inline.pm:261 ../IkiWiki/Plugin/opendiscussion.pm:17 #: ../IkiWiki/Plugin/orphans.pm:28 ../IkiWiki/Render.pm:95 #: ../IkiWiki/Render.pm:162 msgid "discussion" @@ -71,6 +71,10 @@ msgstr "" msgid "You are banned." msgstr "" +#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 +msgid "Error" +msgstr "" + #: ../IkiWiki/Plugin/aggregate.pm:53 msgid "Aggregation triggered via web." msgstr "" @@ -148,7 +152,7 @@ msgstr "" msgid "deleting bucket.." msgstr "" -#: ../IkiWiki/Plugin/amazon_s3.pm:37 ../IkiWiki/Setup.pm:115 +#: ../IkiWiki/Plugin/amazon_s3.pm:37 ../IkiWiki/Setup.pm:117 msgid "done" msgstr "" @@ -228,6 +232,10 @@ msgstr "" msgid "prog not a valid graphviz program" msgstr "" +#: ../IkiWiki/Plugin/img.pm:49 +msgid "Image::Magick not installed" +msgstr "" + #: ../IkiWiki/Plugin/img.pm:56 #, perl-format msgid "bad size \"%s\"" @@ -253,29 +261,29 @@ msgstr "" msgid "Must specify url to wiki with --url when using --rss or --atom" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:106 +#: ../IkiWiki/Plugin/inline.pm:101 msgid "missing pages parameter" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:154 +#: ../IkiWiki/Plugin/inline.pm:149 #, perl-format msgid "unknown sort type %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:225 +#: ../IkiWiki/Plugin/inline.pm:220 msgid "Add a new post titled:" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:241 +#: ../IkiWiki/Plugin/inline.pm:236 #, perl-format msgid "nonexistant template %s" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:274 ../IkiWiki/Render.pm:99 +#: ../IkiWiki/Plugin/inline.pm:269 ../IkiWiki/Render.pm:99 msgid "Discussion" msgstr "" -#: ../IkiWiki/Plugin/inline.pm:504 +#: ../IkiWiki/Plugin/inline.pm:506 msgid "RPC::XML::Client not found, not pinging" msgstr "" @@ -297,15 +305,15 @@ msgstr "" msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:137 +#: ../IkiWiki/Plugin/meta.pm:141 msgid "stylesheet not found" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:171 +#: ../IkiWiki/Plugin/meta.pm:175 msgid "redir page not found" msgstr "" -#: ../IkiWiki/Plugin/meta.pm:184 +#: ../IkiWiki/Plugin/meta.pm:188 msgid "redir cycle is not allowed" msgstr "" @@ -387,11 +395,11 @@ msgstr "" msgid "LWP not found, not pinging" msgstr "" -#: ../IkiWiki/Plugin/poll.pm:65 +#: ../IkiWiki/Plugin/poll.pm:60 msgid "vote" msgstr "" -#: ../IkiWiki/Plugin/poll.pm:73 +#: ../IkiWiki/Plugin/poll.pm:68 msgid "Total votes:" msgstr "" @@ -660,11 +668,11 @@ msgstr "" msgid "generating wrappers.." msgstr "" -#: ../IkiWiki/Setup.pm:105 +#: ../IkiWiki/Setup.pm:107 msgid "rebuilding wiki.." msgstr "" -#: ../IkiWiki/Setup.pm:108 +#: ../IkiWiki/Setup.pm:110 msgid "refreshing wiki.." msgstr "" @@ -712,15 +720,15 @@ msgstr "" msgid "Must specify url to wiki with --url when using --cgi" msgstr "" -#: ../IkiWiki.pm:194 ../IkiWiki.pm:195 -msgid "Error" -msgstr "" - #. translators: The first parameter is a #. translators: preprocessor directive name, #. translators: the second a page name, the #. translators: third a number. -#: ../IkiWiki.pm:770 +#: ../IkiWiki.pm:765 #, perl-format msgid "%s preprocessing loop detected on %s at depth %i" msgstr "" + +#: ../IkiWiki.pm:1203 +msgid "yes" +msgstr "" -- cgit v1.2.3 From 0b140ed1c8428d6984e1e0294b5008670d4f87fe Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 12 Jul 2008 23:31:27 -0400 Subject: avoid hardlinking files owned by others If hardlinks are enabled, it would hardlink files from the underlay. That was sorta annoying if you tried to edit by hand for some reason, so let's not. Files that are hardlinked should be rare enough that a few extra stats won't hurt. --- IkiWiki/Render.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index c241fd40b..990fcaaa1 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -229,10 +229,14 @@ sub render ($) { #{{{ will_render($file, $file, 1); if ($config{hardlink}) { - prep_writefile($file, $config{destdir}); - unlink($config{destdir}."/".$file); - if (link($srcfile, $config{destdir}."/".$file)) { - return; + # only hardlink if owned by same user + my @stat=stat($srcfile); + if ($stat[4] == $>) { + prep_writefile($file, $config{destdir}); + unlink($config{destdir}."/".$file); + if (link($srcfile, $config{destdir}."/".$file)) { + return; + } } # if hardlink fails, fall back to copying } -- cgit v1.2.3 From ffc99f5904934e6e7532bb8cfdebb44ad9ecd913 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 13 Jul 2008 15:05:34 -0400 Subject: switch preprocess hooks to use error function --- IkiWiki/Plugin/aggregate.pm | 2 +- IkiWiki/Plugin/conditional.pm | 2 +- IkiWiki/Plugin/edittemplate.pm | 8 +++++--- IkiWiki/Plugin/fortune.pm | 2 +- IkiWiki/Plugin/googlecalendar.pm | 2 +- IkiWiki/Plugin/graphviz.pm | 4 ++-- IkiWiki/Plugin/img.pm | 14 +++++++------- IkiWiki/Plugin/inline.pm | 2 +- IkiWiki/Plugin/linkmap.pm | 4 +--- IkiWiki/Plugin/meta.pm | 6 +++--- IkiWiki/Plugin/pagetemplate.pm | 2 +- IkiWiki/Plugin/pinger.pm | 2 +- IkiWiki/Plugin/polygen.pm | 4 ++-- IkiWiki/Plugin/postsparkline.pm | 6 +++--- IkiWiki/Plugin/shortcut.pm | 2 +- IkiWiki/Plugin/sparkline.pm | 16 ++++++++-------- IkiWiki/Plugin/table.pm | 6 +++--- IkiWiki/Plugin/template.pm | 4 ++-- IkiWiki/Plugin/testpagespec.pm | 2 +- IkiWiki/Plugin/teximg.pm | 6 +++--- doc/plugins/write/tutorial.mdwn | 4 ++-- po/ikiwiki.pot | 34 +++++++++++++++++----------------- 22 files changed, 67 insertions(+), 67 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index b5354a823..f61804237 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -131,7 +131,7 @@ sub preprocess (@) { #{{{ foreach my $required (qw{name url}) { if (! exists $params{$required}) { - return "[[aggregate ".sprintf(gettext("missing %s parameter"), $required)."]]"; + error sprintf(gettext("missing %s parameter"), $required) } } diff --git a/IkiWiki/Plugin/conditional.pm b/IkiWiki/Plugin/conditional.pm index 57db01054..6be52eaa6 100644 --- a/IkiWiki/Plugin/conditional.pm +++ b/IkiWiki/Plugin/conditional.pm @@ -15,7 +15,7 @@ sub preprocess_if (@) { #{{{ foreach my $param (qw{test then}) { if (! exists $params{$param}) { - return "[[if ".sprintf(gettext('%s parameter is required'), $param)."]]"; + error sprintf(gettext('%s parameter is required'), $param); } } diff --git a/IkiWiki/Plugin/edittemplate.pm b/IkiWiki/Plugin/edittemplate.pm index 76c1cd42a..d1716a315 100644 --- a/IkiWiki/Plugin/edittemplate.pm +++ b/IkiWiki/Plugin/edittemplate.pm @@ -38,10 +38,10 @@ sub preprocess (@) { #{{{ return "" if $params{page} ne $params{destpage}; if (! exists $params{template} || ! length($params{template})) { - return "[[meta ".gettext("template not specified")."]]"; + error gettext("template not specified") } if (! exists $params{match} || ! length($params{match})) { - return "[[meta ".gettext("match not specified")."]]"; + error gettext("match not specified") } $pagestate{$params{page}}{edittemplate}{$params{match}}=$params{template}; @@ -108,7 +108,9 @@ sub filltemplate ($$) { #{{{ ); }; if ($@) { - return "[[pagetemplate ".gettext("failed to process")." $@]]"; + # Indicate that the earlier preprocessor directive set + # up a template that doesn't work. + return "[[!pagetemplate ".gettext("failed to process")." $@]]"; } $template->param(name => $page); diff --git a/IkiWiki/Plugin/fortune.pm b/IkiWiki/Plugin/fortune.pm index a3b13f687..a78a73d5f 100644 --- a/IkiWiki/Plugin/fortune.pm +++ b/IkiWiki/Plugin/fortune.pm @@ -15,7 +15,7 @@ sub preprocess (@) { #{{{ my $f = `fortune 2>/dev/null`; if ($?) { - return "[[".gettext("fortune failed")."]]"; + error gettext("fortune failed"); } else { return "
$f
\n"; diff --git a/IkiWiki/Plugin/googlecalendar.pm b/IkiWiki/Plugin/googlecalendar.pm index c6409e5e6..7efa1daa3 100644 --- a/IkiWiki/Plugin/googlecalendar.pm +++ b/IkiWiki/Plugin/googlecalendar.pm @@ -19,7 +19,7 @@ sub preprocess (@) { #{{{ # Avoid XSS attacks.. my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#; if (! defined $url || ! length $url) { - return "[[googlecalendar ".gettext("failed to find url in html")."]]"; + error gettext("failed to find url in html") } my ($height)=$params{html}=~m#height="(\d+)"#; my ($width)=$params{html}=~m#width="(\d+)"#; diff --git a/IkiWiki/Plugin/graphviz.pm b/IkiWiki/Plugin/graphviz.pm index fe3559857..b13d15fa6 100644 --- a/IkiWiki/Plugin/graphviz.pm +++ b/IkiWiki/Plugin/graphviz.pm @@ -55,7 +55,7 @@ sub render_graph (\%) { #{{{ waitpid $pid, 0; $SIG{PIPE}="DEFAULT"; - return "[[graph ".gettext("failed to run graphviz")."]]" if ($sigpipe); + error gettext("failed to run graphviz") if $sigpipe; if (! $params{preview}) { writefile($dest, $config{destdir}, $png, 1); @@ -82,7 +82,7 @@ sub graph (@) { #{{{ $params{src} = "" unless defined $params{src}; $params{type} = "digraph" unless defined $params{type}; $params{prog} = "dot" unless defined $params{prog}; - return "[[graph ".gettext("prog not a valid graphviz program")."]]" unless $graphviz_programs{$params{prog}}; + error gettext("prog not a valid graphviz program") unless $graphviz_programs{$params{prog}}; return render_graph(%params); } # }}} diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 49e1d57d6..17a9367d3 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -46,14 +46,14 @@ sub preprocess (@) { #{{{ my $base = IkiWiki::basename($file); eval q{use Image::Magick}; - return "[[img ".gettext("Image::Magick not installed")."]]" if $@; + error gettext("Image::Magick is not installed") if $@; my $im = Image::Magick->new; my $imglink; my $r; if ($params{size} ne 'full') { my ($w, $h) = ($params{size} =~ /^(\d+)x(\d+)$/); - return "[[img ".sprintf(gettext('bad size "%s"'), $params{size})."]]" + error sprintf(gettext('bad size "%s"'), $params{size}) unless (defined $w && defined $h); my $outfile = "$config{destdir}/$dir/${w}x${h}-$base"; @@ -63,14 +63,14 @@ sub preprocess (@) { #{{{ if (-e $outfile && (-M srcfile($file) >= -M $outfile)) { $r = $im->Read($outfile); - return "[[img ".sprintf(gettext("failed to read %s: %s"), $outfile, $r)."]]" if $r; + error sprintf(gettext("failed to read %s: %s"), $outfile, $r) if $r; } else { $r = $im->Read(srcfile($file)); - return "[[img ".sprintf(gettext("failed to read %s: %s"), $file, $r)."]]" if $r; + error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r; $r = $im->Resize(geometry => "${w}x${h}"); - return "[[img ".sprintf(gettext("failed to resize: %s"), $r)."]]" if $r; + error sprintf(gettext("failed to resize: %s"), $r) if $r; # don't actually write file in preview mode if (! $params{preview}) { @@ -84,7 +84,7 @@ sub preprocess (@) { #{{{ } else { $r = $im->Read(srcfile($file)); - return "[[img ".sprintf(gettext("failed to read %s: %s"), $file, $r)."]]" if $r; + error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r; $imglink = $file; } @@ -101,7 +101,7 @@ sub preprocess (@) { #{{{ } if (! defined($im->Get("width")) || ! defined($im->Get("height"))) { - return "[[img ".sprintf(gettext("failed to determine size of image %s"), $file)."]]"; + error sprintf(gettext("failed to determine size of image %s"), $file) } my $imgtag=' sub { if (substr($File::Find::name, -length($grammar)) eq $grammar) { @@ -48,7 +48,7 @@ sub preprocess (@) { #{{{ } if ($?) { - $res="[[".gettext("polygen failed")."]]"; + error gettext("command failed"); } # Strip trailing spaces and newlines so that we flow well with the diff --git a/IkiWiki/Plugin/postsparkline.pm b/IkiWiki/Plugin/postsparkline.pm index 9e885741e..6fc96f8b3 100644 --- a/IkiWiki/Plugin/postsparkline.pm +++ b/IkiWiki/Plugin/postsparkline.pm @@ -29,14 +29,14 @@ sub preprocess (@) { #{{{ } if (! exists $params{formula}) { - return "[[postsparkline ".gettext("missing formula")."]]"; + error gettext("missing formula") } my $formula=$params{formula}; $formula=~s/[^a-zA-Z0-9]*//g; $formula=IkiWiki::possibly_foolish_untaint($formula); if (! length $formula || ! IkiWiki::Plugin::postsparkline::formula->can($formula)) { - return "[[postsparkline ".gettext("unknown formula")."]]"; + error gettext("unknown formula"); } add_depends($params{page}, $params{pages}); @@ -53,7 +53,7 @@ sub preprocess (@) { #{{{ my @data=eval qq{IkiWiki::Plugin::postsparkline::formula::$formula(\\\%params, \@list)}; if ($@) { - return "[[postsparkline error $@]]"; + error $@; } if (! @data) { diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index f1a38ea48..8df60cfe2 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -24,7 +24,7 @@ sub preprocess_shortcut (@) { #{{{ my %params=@_; if (! defined $params{name} || ! defined $params{url}) { - return "[[shortcut ".gettext("missing name or url parameter")."]]"; + error gettext("missing name or url parameter"); } hook(type => "preprocess", no_override => 1, id => $params{name}, diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index 69b3512c2..bcff46aeb 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -60,13 +60,13 @@ sub preprocess (@) { #{{{ } } elsif (! length $value) { - return "[[sparkline ".gettext("parse error")." \"$key\"]]"; + error gettext("parse error")." \"$key\""; } elsif ($key eq 'featurepoint') { my ($x, $y, $color, $diameter, $text, $location)= split(/\s*,\s*/, $value); if (! defined $diameter || $diameter < 0) { - return "[[sparkline ".gettext("bad featurepoint diameter")."]]"; + error gettext("bad featurepoint diameter"); } $x=int($x); $y=int($y); @@ -76,7 +76,7 @@ sub preprocess (@) { #{{{ if (defined $location) { $location=$locmap{$location}; if (! defined $location) { - return "[[sparkline ".gettext("bad featurepoint location")."]]"; + error gettext("bad featurepoint location"); } } $php.=qq{\$sparkline->SetFeaturePoint($x, $y, '$color', $diameter}; @@ -87,23 +87,23 @@ sub preprocess (@) { #{{{ } if ($c eq 0) { - return "[[sparkline ".gettext("missing values")."]]"; + error gettext("missing values"); } my $height=int($params{height} || 20); if ($height < 2 || $height > 100) { - return "[[sparkline ".gettext("bad height value")."]]"; + error gettext("bad height value"); } if ($style eq "Bar") { $php.=qq{\$sparkline->Render($height);\n}; } else { if (! exists $params{width}) { - return "[[sparkline ".gettext("missing width parameter")."]]"; + error gettext("missing width parameter"); } my $width=int($params{width}); if ($width < 2 || $width > 1024) { - return "[[sparkline ".gettext("bad width value")."]]"; + error gettext("bad width value"); } $php.=qq{\$sparkline->RenderResampled($width, $height);\n}; } @@ -141,7 +141,7 @@ sub preprocess (@) { #{{{ waitpid $pid, 0; $SIG{PIPE}="DEFAULT"; if ($sigpipe) { - return "[[sparkline ".gettext("failed to run php")."]]"; + error gettext("failed to run php"); } if (! $params{preview}) { diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index 11474c8f0..892ea182e 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -19,7 +19,7 @@ sub preprocess (@) { #{{{ if (exists $params{file}) { if (! $pagesources{$params{file}}) { - return "[[table ".gettext("cannot find file")."]]"; + error gettext("cannot find file"); } $params{data} = readfile(srcfile($params{file})); add_depends($params{page}, $params{file}); @@ -61,7 +61,7 @@ sub preprocess (@) { #{{{ defined $params{delimiter} ? $params{delimiter} : "|",); } else { - return "[[table ".gettext("unknown data format")."]]"; + error gettext("unknown data format"); } my $header; @@ -69,7 +69,7 @@ sub preprocess (@) { #{{{ $header=shift @data; } if (! @data) { - return "[[table ".gettext("empty data")."]]"; + error gettext("empty data"); } my @lines; diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index aa1f57c07..c33dbbb83 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -16,7 +16,7 @@ sub preprocess (@) { #{{{ my %params=@_; if (! exists $params{id}) { - return "[[template ".gettext("missing id parameter")."]]"; + error gettext("missing id parameter") } my $template_page="templates/$params{id}"; @@ -42,7 +42,7 @@ sub preprocess (@) { #{{{ ); }; if ($@) { - return "[[template ".gettext("failed to process:")." $@]]"; + error gettext("failed to process:")." $@" } $params{basename}=IkiWiki::basename($params{page}); diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index f9ec90d87..4faef7be1 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -14,7 +14,7 @@ sub preprocess (@) { #{{{ foreach my $param (qw{match pagespec}) { if (! exists $params{$param}) { - return "[[testpagespec $param parameter is required]]"; + error sprintf(gettext("%s parameter is required"), $param); } } diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 8c3e88c69..6a6bdd4fa 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -27,14 +27,14 @@ sub preprocess (@) { #{{{ my $code = $params{code}; if (! defined $code && ! length $code) { - return "[[teximg ".gettext("missing tex code"). "]]"; + error gettext("missing tex code"); } if (check($code)) { return create($code, check_height($height), \%params); } else { - return "[[teximg ".gettext("code includes disallowed latex commands"). "]]"; + error gettext("code includes disallowed latex commands") } } #}}} @@ -85,7 +85,7 @@ sub create ($$$) { #{{{ .qq{" class="teximg" />}; } else { - return qq{[[teximg }.gettext("failed to generate image from code")."]]"; + error qq{}.gettext("failed to generate image from code").""; } } #}}} diff --git a/doc/plugins/write/tutorial.mdwn b/doc/plugins/write/tutorial.mdwn index 8b12fd183..94b72c763 100644 --- a/doc/plugins/write/tutorial.mdwn +++ b/doc/plugins/write/tutorial.mdwn @@ -169,7 +169,7 @@ be a guard on how high it will go. } my $num=$last{$page}++; if ($num > 25) { - return "[[fib will only calculate the first 25 numbers in the sequence]]"; + error "can only calculate the first 25 numbers in the sequence"; } return fib($num); } @@ -182,7 +182,7 @@ does for numbers less than 1. Or for any number that's not an integer. In either case, it will run forever. Here's one way to fix that: if (int($num) != $num || $num < 1) { - return "[[fib positive integers only, please]]"; + error "positive integers only, please"; } As these security problems have demonstrated, even a simple input from the diff --git a/po/ikiwiki.pot b/po/ikiwiki.pot index f94f5bdd3..71cddfdd0 100644 --- a/po/ikiwiki.pot +++ b/po/ikiwiki.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2008-07-12 23:07-0400\n" +"POT-Creation-Date: 2008-07-13 15:04-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -71,7 +71,7 @@ msgstr "" msgid "You are banned." msgstr "" -#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 +#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 ../IkiWiki.pm:782 msgid "Error" msgstr "" @@ -194,7 +194,7 @@ msgstr "" msgid "There are no broken links!" msgstr "" -#: ../IkiWiki/Plugin/conditional.pm:18 +#: ../IkiWiki/Plugin/conditional.pm:18 ../IkiWiki/Plugin/testpagespec.pm:17 #, perl-format msgid "%s parameter is required" msgstr "" @@ -212,7 +212,7 @@ msgstr "" msgid "edittemplate %s registered for %s" msgstr "" -#: ../IkiWiki/Plugin/edittemplate.pm:111 +#: ../IkiWiki/Plugin/edittemplate.pm:113 msgid "failed to process" msgstr "" @@ -233,7 +233,7 @@ msgid "prog not a valid graphviz program" msgstr "" #: ../IkiWiki/Plugin/img.pm:49 -msgid "Image::Magick not installed" +msgid "Image::Magick is not installed" msgstr "" #: ../IkiWiki/Plugin/img.pm:56 @@ -287,7 +287,7 @@ msgstr "" msgid "RPC::XML::Client not found, not pinging" msgstr "" -#: ../IkiWiki/Plugin/linkmap.pm:98 +#: ../IkiWiki/Plugin/linkmap.pm:97 msgid "failed to run dot" msgstr "" @@ -408,7 +408,7 @@ msgid "polygen not installed" msgstr "" #: ../IkiWiki/Plugin/polygen.pm:51 -msgid "polygen failed" +msgid "command failed" msgstr "" #: ../IkiWiki/Plugin/postsparkline.pm:32 @@ -612,47 +612,47 @@ msgstr "" msgid "getctime not implemented" msgstr "" -#: ../IkiWiki/Render.pm:286 ../IkiWiki/Render.pm:307 +#: ../IkiWiki/Render.pm:290 ../IkiWiki/Render.pm:311 #, perl-format msgid "skipping bad filename %s" msgstr "" -#: ../IkiWiki/Render.pm:361 +#: ../IkiWiki/Render.pm:365 #, perl-format msgid "removing old page %s" msgstr "" -#: ../IkiWiki/Render.pm:401 +#: ../IkiWiki/Render.pm:405 #, perl-format msgid "scanning %s" msgstr "" -#: ../IkiWiki/Render.pm:406 +#: ../IkiWiki/Render.pm:410 #, perl-format msgid "rendering %s" msgstr "" -#: ../IkiWiki/Render.pm:427 +#: ../IkiWiki/Render.pm:431 #, perl-format msgid "rendering %s, which links to %s" msgstr "" -#: ../IkiWiki/Render.pm:448 +#: ../IkiWiki/Render.pm:452 #, perl-format msgid "rendering %s, which depends on %s" msgstr "" -#: ../IkiWiki/Render.pm:487 +#: ../IkiWiki/Render.pm:491 #, perl-format msgid "rendering %s, to update its backlinks" msgstr "" -#: ../IkiWiki/Render.pm:499 +#: ../IkiWiki/Render.pm:503 #, perl-format msgid "removing %s, no longer rendered by %s" msgstr "" -#: ../IkiWiki/Render.pm:523 +#: ../IkiWiki/Render.pm:527 #, perl-format msgid "ikiwiki: cannot render %s" msgstr "" @@ -729,6 +729,6 @@ msgstr "" msgid "%s preprocessing loop detected on %s at depth %i" msgstr "" -#: ../IkiWiki.pm:1203 +#: ../IkiWiki.pm:1212 msgid "yes" msgstr "" -- cgit v1.2.3