switch preprocess hooks to use error function
parent
edb59cd5b9
commit
ffc99f5904
|
@ -131,7 +131,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
foreach my $required (qw{name url}) {
|
foreach my $required (qw{name url}) {
|
||||||
if (! exists $params{$required}) {
|
if (! exists $params{$required}) {
|
||||||
return "[[aggregate ".sprintf(gettext("missing %s parameter"), $required)."]]";
|
error sprintf(gettext("missing %s parameter"), $required)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ sub preprocess_if (@) { #{{{
|
||||||
|
|
||||||
foreach my $param (qw{test then}) {
|
foreach my $param (qw{test then}) {
|
||||||
if (! exists $params{$param}) {
|
if (! exists $params{$param}) {
|
||||||
return "[[if ".sprintf(gettext('%s parameter is required'), $param)."]]";
|
error sprintf(gettext('%s parameter is required'), $param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,10 @@ sub preprocess (@) { #{{{
|
||||||
return "" if $params{page} ne $params{destpage};
|
return "" if $params{page} ne $params{destpage};
|
||||||
|
|
||||||
if (! exists $params{template} || ! length($params{template})) {
|
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})) {
|
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};
|
$pagestate{$params{page}}{edittemplate}{$params{match}}=$params{template};
|
||||||
|
@ -108,7 +108,9 @@ sub filltemplate ($$) { #{{{
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if ($@) {
|
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);
|
$template->param(name => $page);
|
||||||
|
|
|
@ -15,7 +15,7 @@ sub preprocess (@) { #{{{
|
||||||
my $f = `fortune 2>/dev/null`;
|
my $f = `fortune 2>/dev/null`;
|
||||||
|
|
||||||
if ($?) {
|
if ($?) {
|
||||||
return "[[".gettext("fortune failed")."]]";
|
error gettext("fortune failed");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "<pre>$f</pre>\n";
|
return "<pre>$f</pre>\n";
|
||||||
|
|
|
@ -19,7 +19,7 @@ sub preprocess (@) { #{{{
|
||||||
# Avoid XSS attacks..
|
# Avoid XSS attacks..
|
||||||
my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
|
my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
|
||||||
if (! defined $url || ! length $url) {
|
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 ($height)=$params{html}=~m#height="(\d+)"#;
|
||||||
my ($width)=$params{html}=~m#width="(\d+)"#;
|
my ($width)=$params{html}=~m#width="(\d+)"#;
|
||||||
|
|
|
@ -55,7 +55,7 @@ sub render_graph (\%) { #{{{
|
||||||
|
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
$SIG{PIPE}="DEFAULT";
|
$SIG{PIPE}="DEFAULT";
|
||||||
return "[[graph ".gettext("failed to run graphviz")."]]" if ($sigpipe);
|
error gettext("failed to run graphviz") if $sigpipe;
|
||||||
|
|
||||||
if (! $params{preview}) {
|
if (! $params{preview}) {
|
||||||
writefile($dest, $config{destdir}, $png, 1);
|
writefile($dest, $config{destdir}, $png, 1);
|
||||||
|
@ -82,7 +82,7 @@ sub graph (@) { #{{{
|
||||||
$params{src} = "" unless defined $params{src};
|
$params{src} = "" unless defined $params{src};
|
||||||
$params{type} = "digraph" unless defined $params{type};
|
$params{type} = "digraph" unless defined $params{type};
|
||||||
$params{prog} = "dot" unless defined $params{prog};
|
$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);
|
return render_graph(%params);
|
||||||
} # }}}
|
} # }}}
|
||||||
|
|
|
@ -46,14 +46,14 @@ sub preprocess (@) { #{{{
|
||||||
my $base = IkiWiki::basename($file);
|
my $base = IkiWiki::basename($file);
|
||||||
|
|
||||||
eval q{use Image::Magick};
|
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 $im = Image::Magick->new;
|
||||||
my $imglink;
|
my $imglink;
|
||||||
my $r;
|
my $r;
|
||||||
|
|
||||||
if ($params{size} ne 'full') {
|
if ($params{size} ne 'full') {
|
||||||
my ($w, $h) = ($params{size} =~ /^(\d+)x(\d+)$/);
|
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);
|
unless (defined $w && defined $h);
|
||||||
|
|
||||||
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
|
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
|
||||||
|
@ -63,14 +63,14 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
|
if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
|
||||||
$r = $im->Read($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 {
|
else {
|
||||||
$r = $im->Read(srcfile($file));
|
$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}");
|
$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
|
# don't actually write file in preview mode
|
||||||
if (! $params{preview}) {
|
if (! $params{preview}) {
|
||||||
|
@ -84,7 +84,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$r = $im->Read(srcfile($file));
|
$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;
|
$imglink = $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! defined($im->Get("width")) || ! defined($im->Get("height"))) {
|
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='<img src="'.$imgurl.
|
my $imgtag='<img src="'.$imgurl.
|
||||||
|
|
|
@ -98,7 +98,7 @@ sub preprocess_inline (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (! exists $params{pages}) {
|
if (! exists $params{pages}) {
|
||||||
return "[[inline ".gettext("missing pages parameter")."]]";
|
error gettext("missing pages parameter");
|
||||||
}
|
}
|
||||||
my $raw=yesno($params{raw});
|
my $raw=yesno($params{raw});
|
||||||
my $archive=yesno($params{archive});
|
my $archive=yesno($params{archive});
|
||||||
|
|
|
@ -94,9 +94,7 @@ sub genmap ($) { #{{{
|
||||||
|
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
$SIG{PIPE}="DEFAULT";
|
$SIG{PIPE}="DEFAULT";
|
||||||
if ($sigpipe) {
|
error gettext("failed to run dot") if $sigpipe;
|
||||||
return "[[linkmap ".gettext("failed to run dot")."]]";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
|
@ -138,7 +138,7 @@ sub preprocess (@) { #{{{
|
||||||
# editable page as a stylesheet
|
# editable page as a stylesheet
|
||||||
my $stylesheet=bestlink($page, $value.".css");
|
my $stylesheet=bestlink($page, $value.".css");
|
||||||
if (! length $stylesheet) {
|
if (! length $stylesheet) {
|
||||||
return "[[meta ".gettext("stylesheet not found")."]]";
|
error gettext("stylesheet not found")
|
||||||
}
|
}
|
||||||
push @{$metaheaders{$page}}, '<link href="'.urlto($stylesheet, $page).
|
push @{$metaheaders{$page}}, '<link href="'.urlto($stylesheet, $page).
|
||||||
'" rel="'.encode_entities($rel).
|
'" rel="'.encode_entities($rel).
|
||||||
|
@ -172,7 +172,7 @@ sub preprocess (@) { #{{{
|
||||||
add_depends($page, $redir_page);
|
add_depends($page, $redir_page);
|
||||||
my $link=bestlink($page, $redir_page);
|
my $link=bestlink($page, $redir_page);
|
||||||
if (! length $link) {
|
if (! length $link) {
|
||||||
return "[[meta ".gettext("redir page not found")."]]";
|
error gettext("redir page not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
$value=urlto($link, $page);
|
$value=urlto($link, $page);
|
||||||
|
@ -185,7 +185,7 @@ sub preprocess (@) { #{{{
|
||||||
my %seen;
|
my %seen;
|
||||||
while (exists $pagestate{$at}{meta}{redir}) {
|
while (exists $pagestate{$at}{meta}{redir}) {
|
||||||
if ($seen{$at}) {
|
if ($seen{$at}) {
|
||||||
return "[[meta ".gettext("redir cycle is not allowed")."]]";
|
error gettext("redir cycle is not allowed")
|
||||||
}
|
}
|
||||||
$seen{$at}=1;
|
$seen{$at}=1;
|
||||||
$at=$pagestate{$at}{meta}{redir};
|
$at=$pagestate{$at}{meta}{redir};
|
||||||
|
|
|
@ -18,7 +18,7 @@ sub preprocess (@) { #{{{
|
||||||
if (! exists $params{template} ||
|
if (! exists $params{template} ||
|
||||||
$params{template} !~ /^[-A-Za-z0-9._+]+$/ ||
|
$params{template} !~ /^[-A-Za-z0-9._+]+$/ ||
|
||||||
! defined IkiWiki::template_file($params{template})) {
|
! defined IkiWiki::template_file($params{template})) {
|
||||||
return "[[pagetemplate ".gettext("bad or missing template")."]]";
|
error gettext("bad or missing template")
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($params{page} eq $params{destpage}) {
|
if ($params{page} eq $params{destpage}) {
|
||||||
|
|
|
@ -34,7 +34,7 @@ sub needsbuild (@) { #{{{
|
||||||
sub preprocess (@) { #{{{
|
sub preprocess (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
if (! exists $params{from} || ! exists $params{to}) {
|
if (! exists $params{from} || ! exists $params{to}) {
|
||||||
return "[[ping ".gettext("requires 'from' and 'to' parameters")."]]";
|
error gettext("requires 'from' and 'to' parameters");
|
||||||
}
|
}
|
||||||
if ($params{from} eq $config{url}) {
|
if ($params{from} eq $config{url}) {
|
||||||
$pagestate{$params{destpage}}{pinger}{$params{to}}=1;
|
$pagestate{$params{destpage}}{pinger}{$params{to}}=1;
|
||||||
|
|
|
@ -29,7 +29,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
my $grmfile = '/usr/share/polygen/ita/polygen.grm';
|
my $grmfile = '/usr/share/polygen/ita/polygen.grm';
|
||||||
if (! -d '/usr/share/polygen') {
|
if (! -d '/usr/share/polygen') {
|
||||||
return "[[".gettext("polygen not installed")."]]";
|
error gettext("polygen not installed");
|
||||||
}
|
}
|
||||||
find({wanted => sub {
|
find({wanted => sub {
|
||||||
if (substr($File::Find::name, -length($grammar)) eq $grammar) {
|
if (substr($File::Find::name, -length($grammar)) eq $grammar) {
|
||||||
|
@ -48,7 +48,7 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($?) {
|
if ($?) {
|
||||||
$res="[[".gettext("polygen failed")."]]";
|
error gettext("command failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Strip trailing spaces and newlines so that we flow well with the
|
# Strip trailing spaces and newlines so that we flow well with the
|
||||||
|
|
|
@ -29,14 +29,14 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! exists $params{formula}) {
|
if (! exists $params{formula}) {
|
||||||
return "[[postsparkline ".gettext("missing formula")."]]";
|
error gettext("missing formula")
|
||||||
}
|
}
|
||||||
my $formula=$params{formula};
|
my $formula=$params{formula};
|
||||||
$formula=~s/[^a-zA-Z0-9]*//g;
|
$formula=~s/[^a-zA-Z0-9]*//g;
|
||||||
$formula=IkiWiki::possibly_foolish_untaint($formula);
|
$formula=IkiWiki::possibly_foolish_untaint($formula);
|
||||||
if (! length $formula ||
|
if (! length $formula ||
|
||||||
! IkiWiki::Plugin::postsparkline::formula->can($formula)) {
|
! IkiWiki::Plugin::postsparkline::formula->can($formula)) {
|
||||||
return "[[postsparkline ".gettext("unknown formula")."]]";
|
error gettext("unknown formula");
|
||||||
}
|
}
|
||||||
|
|
||||||
add_depends($params{page}, $params{pages});
|
add_depends($params{page}, $params{pages});
|
||||||
|
@ -53,7 +53,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
my @data=eval qq{IkiWiki::Plugin::postsparkline::formula::$formula(\\\%params, \@list)};
|
my @data=eval qq{IkiWiki::Plugin::postsparkline::formula::$formula(\\\%params, \@list)};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
return "[[postsparkline error $@]]";
|
error $@;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! @data) {
|
if (! @data) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ sub preprocess_shortcut (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (! defined $params{name} || ! defined $params{url}) {
|
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},
|
hook(type => "preprocess", no_override => 1, id => $params{name},
|
||||||
|
|
|
@ -60,13 +60,13 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif (! length $value) {
|
elsif (! length $value) {
|
||||||
return "[[sparkline ".gettext("parse error")." \"$key\"]]";
|
error gettext("parse error")." \"$key\"";
|
||||||
}
|
}
|
||||||
elsif ($key eq 'featurepoint') {
|
elsif ($key eq 'featurepoint') {
|
||||||
my ($x, $y, $color, $diameter, $text, $location)=
|
my ($x, $y, $color, $diameter, $text, $location)=
|
||||||
split(/\s*,\s*/, $value);
|
split(/\s*,\s*/, $value);
|
||||||
if (! defined $diameter || $diameter < 0) {
|
if (! defined $diameter || $diameter < 0) {
|
||||||
return "[[sparkline ".gettext("bad featurepoint diameter")."]]";
|
error gettext("bad featurepoint diameter");
|
||||||
}
|
}
|
||||||
$x=int($x);
|
$x=int($x);
|
||||||
$y=int($y);
|
$y=int($y);
|
||||||
|
@ -76,7 +76,7 @@ sub preprocess (@) { #{{{
|
||||||
if (defined $location) {
|
if (defined $location) {
|
||||||
$location=$locmap{$location};
|
$location=$locmap{$location};
|
||||||
if (! defined $location) {
|
if (! defined $location) {
|
||||||
return "[[sparkline ".gettext("bad featurepoint location")."]]";
|
error gettext("bad featurepoint location");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$php.=qq{\$sparkline->SetFeaturePoint($x, $y, '$color', $diameter};
|
$php.=qq{\$sparkline->SetFeaturePoint($x, $y, '$color', $diameter};
|
||||||
|
@ -87,23 +87,23 @@ sub preprocess (@) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($c eq 0) {
|
if ($c eq 0) {
|
||||||
return "[[sparkline ".gettext("missing values")."]]";
|
error gettext("missing values");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $height=int($params{height} || 20);
|
my $height=int($params{height} || 20);
|
||||||
if ($height < 2 || $height > 100) {
|
if ($height < 2 || $height > 100) {
|
||||||
return "[[sparkline ".gettext("bad height value")."]]";
|
error gettext("bad height value");
|
||||||
}
|
}
|
||||||
if ($style eq "Bar") {
|
if ($style eq "Bar") {
|
||||||
$php.=qq{\$sparkline->Render($height);\n};
|
$php.=qq{\$sparkline->Render($height);\n};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (! exists $params{width}) {
|
if (! exists $params{width}) {
|
||||||
return "[[sparkline ".gettext("missing width parameter")."]]";
|
error gettext("missing width parameter");
|
||||||
}
|
}
|
||||||
my $width=int($params{width});
|
my $width=int($params{width});
|
||||||
if ($width < 2 || $width > 1024) {
|
if ($width < 2 || $width > 1024) {
|
||||||
return "[[sparkline ".gettext("bad width value")."]]";
|
error gettext("bad width value");
|
||||||
}
|
}
|
||||||
$php.=qq{\$sparkline->RenderResampled($width, $height);\n};
|
$php.=qq{\$sparkline->RenderResampled($width, $height);\n};
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ sub preprocess (@) { #{{{
|
||||||
waitpid $pid, 0;
|
waitpid $pid, 0;
|
||||||
$SIG{PIPE}="DEFAULT";
|
$SIG{PIPE}="DEFAULT";
|
||||||
if ($sigpipe) {
|
if ($sigpipe) {
|
||||||
return "[[sparkline ".gettext("failed to run php")."]]";
|
error gettext("failed to run php");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $params{preview}) {
|
if (! $params{preview}) {
|
||||||
|
|
|
@ -19,7 +19,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
if (exists $params{file}) {
|
if (exists $params{file}) {
|
||||||
if (! $pagesources{$params{file}}) {
|
if (! $pagesources{$params{file}}) {
|
||||||
return "[[table ".gettext("cannot find file")."]]";
|
error gettext("cannot find file");
|
||||||
}
|
}
|
||||||
$params{data} = readfile(srcfile($params{file}));
|
$params{data} = readfile(srcfile($params{file}));
|
||||||
add_depends($params{page}, $params{file});
|
add_depends($params{page}, $params{file});
|
||||||
|
@ -61,7 +61,7 @@ sub preprocess (@) { #{{{
|
||||||
defined $params{delimiter} ? $params{delimiter} : "|",);
|
defined $params{delimiter} ? $params{delimiter} : "|",);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "[[table ".gettext("unknown data format")."]]";
|
error gettext("unknown data format");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $header;
|
my $header;
|
||||||
|
@ -69,7 +69,7 @@ sub preprocess (@) { #{{{
|
||||||
$header=shift @data;
|
$header=shift @data;
|
||||||
}
|
}
|
||||||
if (! @data) {
|
if (! @data) {
|
||||||
return "[[table ".gettext("empty data")."]]";
|
error gettext("empty data");
|
||||||
}
|
}
|
||||||
|
|
||||||
my @lines;
|
my @lines;
|
||||||
|
|
|
@ -16,7 +16,7 @@ sub preprocess (@) { #{{{
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
if (! exists $params{id}) {
|
if (! exists $params{id}) {
|
||||||
return "[[template ".gettext("missing id parameter")."]]";
|
error gettext("missing id parameter")
|
||||||
}
|
}
|
||||||
|
|
||||||
my $template_page="templates/$params{id}";
|
my $template_page="templates/$params{id}";
|
||||||
|
@ -42,7 +42,7 @@ sub preprocess (@) { #{{{
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
if ($@) {
|
if ($@) {
|
||||||
return "[[template ".gettext("failed to process:")." $@]]";
|
error gettext("failed to process:")." $@"
|
||||||
}
|
}
|
||||||
|
|
||||||
$params{basename}=IkiWiki::basename($params{page});
|
$params{basename}=IkiWiki::basename($params{page});
|
||||||
|
|
|
@ -14,7 +14,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
foreach my $param (qw{match pagespec}) {
|
foreach my $param (qw{match pagespec}) {
|
||||||
if (! exists $params{$param}) {
|
if (! exists $params{$param}) {
|
||||||
return "[[testpagespec $param parameter is required]]";
|
error sprintf(gettext("%s parameter is required"), $param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,14 +27,14 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
my $code = $params{code};
|
my $code = $params{code};
|
||||||
if (! defined $code && ! length $code) {
|
if (! defined $code && ! length $code) {
|
||||||
return "[[teximg ".gettext("missing tex code"). "]]";
|
error gettext("missing tex code");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check($code)) {
|
if (check($code)) {
|
||||||
return create($code, check_height($height), \%params);
|
return create($code, check_height($height), \%params);
|
||||||
}
|
}
|
||||||
else {
|
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" />};
|
.qq{" class="teximg" />};
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return qq{[[teximg <a href="$logurl">}.gettext("failed to generate image from code")."</a>]]";
|
error qq{<a href="$logurl">}.gettext("failed to generate image from code")."</a>";
|
||||||
}
|
}
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
|
|
@ -169,7 +169,7 @@ be a guard on how high it will go.
|
||||||
}
|
}
|
||||||
my $num=$last{$page}++;
|
my $num=$last{$page}++;
|
||||||
if ($num > 25) {
|
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);
|
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:
|
either case, it will run forever. Here's one way to fix that:
|
||||||
|
|
||||||
if (int($num) != $num || $num < 1) {
|
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
|
As these security problems have demonstrated, even a simple input from the
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -71,7 +71,7 @@ msgstr ""
|
||||||
msgid "You are banned."
|
msgid "You are banned."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759
|
#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 ../IkiWiki.pm:782
|
||||||
msgid "Error"
|
msgid "Error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ msgstr ""
|
||||||
msgid "There are no broken links!"
|
msgid "There are no broken links!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/conditional.pm:18
|
#: ../IkiWiki/Plugin/conditional.pm:18 ../IkiWiki/Plugin/testpagespec.pm:17
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "%s parameter is required"
|
msgid "%s parameter is required"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -212,7 +212,7 @@ msgstr ""
|
||||||
msgid "edittemplate %s registered for %s"
|
msgid "edittemplate %s registered for %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/edittemplate.pm:111
|
#: ../IkiWiki/Plugin/edittemplate.pm:113
|
||||||
msgid "failed to process"
|
msgid "failed to process"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ msgid "prog not a valid graphviz program"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/img.pm:49
|
#: ../IkiWiki/Plugin/img.pm:49
|
||||||
msgid "Image::Magick not installed"
|
msgid "Image::Magick is not installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/img.pm:56
|
#: ../IkiWiki/Plugin/img.pm:56
|
||||||
|
@ -287,7 +287,7 @@ msgstr ""
|
||||||
msgid "RPC::XML::Client not found, not pinging"
|
msgid "RPC::XML::Client not found, not pinging"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/linkmap.pm:98
|
#: ../IkiWiki/Plugin/linkmap.pm:97
|
||||||
msgid "failed to run dot"
|
msgid "failed to run dot"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -408,7 +408,7 @@ msgid "polygen not installed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/polygen.pm:51
|
#: ../IkiWiki/Plugin/polygen.pm:51
|
||||||
msgid "polygen failed"
|
msgid "command failed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/postsparkline.pm:32
|
#: ../IkiWiki/Plugin/postsparkline.pm:32
|
||||||
|
@ -612,47 +612,47 @@ msgstr ""
|
||||||
msgid "getctime not implemented"
|
msgid "getctime not implemented"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:286 ../IkiWiki/Render.pm:307
|
#: ../IkiWiki/Render.pm:290 ../IkiWiki/Render.pm:311
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "skipping bad filename %s"
|
msgid "skipping bad filename %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:361
|
#: ../IkiWiki/Render.pm:365
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "removing old page %s"
|
msgid "removing old page %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:401
|
#: ../IkiWiki/Render.pm:405
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "scanning %s"
|
msgid "scanning %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:406
|
#: ../IkiWiki/Render.pm:410
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "rendering %s"
|
msgid "rendering %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:427
|
#: ../IkiWiki/Render.pm:431
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "rendering %s, which links to %s"
|
msgid "rendering %s, which links to %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:448
|
#: ../IkiWiki/Render.pm:452
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "rendering %s, which depends on %s"
|
msgid "rendering %s, which depends on %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:487
|
#: ../IkiWiki/Render.pm:491
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "rendering %s, to update its backlinks"
|
msgid "rendering %s, to update its backlinks"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:499
|
#: ../IkiWiki/Render.pm:503
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "removing %s, no longer rendered by %s"
|
msgid "removing %s, no longer rendered by %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Render.pm:523
|
#: ../IkiWiki/Render.pm:527
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "ikiwiki: cannot render %s"
|
msgid "ikiwiki: cannot render %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -729,6 +729,6 @@ msgstr ""
|
||||||
msgid "%s preprocessing loop detected on %s at depth %i"
|
msgid "%s preprocessing loop detected on %s at depth %i"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki.pm:1203
|
#: ../IkiWiki.pm:1212
|
||||||
msgid "yes"
|
msgid "yes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
Loading…
Reference in New Issue