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

@ -16,9 +16,17 @@ class Itex
def self.response(env) def self.response(env)
@params = Rack::Request.new(env).params @params = Rack::Request.new(env).params
tex = @params['tex'].purify tex = (@params['tex'] || '').purify
display = @params['display'] || 'inline' case @params['display']
filter = (display + '_filter').to_sym 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>" estart = "<math xmlns='http://www.w3.org/1998/Math/MathML' display='inline'><merror><mtext>"
eend = "</mtext></merror></math>" eend = "</mtext></merror></math>"
begin begin