From 3fbff199972c9958f226bf59145b0e661c912e68 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Mon, 22 Feb 2010 08:52:52 -0600 Subject: [PATCH] itex Endpoint Should Handle Blank TeX Reported by Andrew Stacey --- app/metal/itex.rb | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/metal/itex.rb b/app/metal/itex.rb index 7e27ca3a..3d9e4121 100644 --- a/app/metal/itex.rb +++ b/app/metal/itex.rb @@ -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 "" if tex.strip == '' estart = "" eend = "" begin