def sanitize(template)
      begin
        if template =~ /\A".+"\Z/m
          # Case 1
          sanitize_with_json(template)
        else
          # Case 2
          sanitize_with_regexp(template)
        end
      rescue JSON::ParserError
        # Case 3
        template
      end
    end
def sanitize(template)
      begin
        if template =~ /\A".+"\Z/m
          # Case 1
          sanitize_with_json(template)
        else
          # Case 2
          sanitize_with_regexp(template)
        end
      rescue JSON::ParserError
        # Case 3
        template
      end
    end
This method handles different types of user input. The precompiler
 can be called from many different places which create interesting
 conditions.
 Case 1: Rake-Pipeline-Web-Filters: calls with a JSON encoded string.
 Case 2: Sanitize using a RegExp
 Case 3: "Normal" input. Reading from a file or something like that.

 Each one of these cases is covered by a test case. If you find another breaking
 use case please address it here with a regression test.