itex Endpoint Should Handle Blank TeX

Reported by Andrew Stacey
This commit is contained in:
Jacques Distler 2010-02-22 08:52:52 -06:00
parent 702b450fd9
commit 3fbff19997

View file

@ -1,4 +1,4 @@
# Allow the metal piece to run in isolation
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
require 'stringsupport'
@ -16,9 +16,17 @@ class Itex
def self.response(env)
@params = Rack::Request.new(env).params
tex = @params['tex'].purify
display = @params['display'] || 'inline'
filter = (display + '_filter').to_sym
tex = (@params['tex'] || '').purify
case @params['display']
when 'block'
filter = :block_filter
when 'inline'
filter = :inline_filter
else
filter = :inline_filter
end
return "<math xmlns='http://www.w3.org/1998/Math/MathML' display='" +
filter.to_s[/(.*?)_filter/] + "'/>" if tex.strip == ''
estart = "<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><merror><mtext>"
eend = "</mtext></merror></math>"
begin