Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

#iferror function

  • Loading branch information...
commit 7647a49ec0da3db3a190f2591a6418d9bc12c7c4 1 parent 0cf4ad7
David Ricciardi authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/wikicloth/wiki_buffer/var.rb
View
4 lib/wikicloth/wiki_buffer/var.rb
@@ -60,7 +60,7 @@ def default_functions(name,params)
begin
MathParser::Parser.new.parse(params.first)
rescue RuntimeError
- 'Error occured: ' + $!
+ 'Expression error: ' + $!
end
when "#ifeq"
if params[0] =~ /^[0-9A-Fa-f]+$/ && params[1] =~ /^[0-9A-Fa-f]+$/
@@ -81,6 +81,8 @@ def default_functions(name,params)
else
params[0].rjust(params[1].to_i,params[2])
end
+ when "#iferror"
+ params.first =~ /error/ ? params[1] : params[2]
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.