Commits

Anonymous committed e79a73d

Removed spaces on "{{ = something }}"

  • Participants
  • Parent commits 9b66ada

Comments (0)

Files changed (2)

File new_template.py

 indentation = '    '
 unindentation_words_before = ('else', 'elif', 'except')
 unindentation_words_after = ('pass', 'break', 'continue', 'return')
+open_something = '([{'
+close_something = ')]}'
 
     
 def parse_string(text):
     if not line:
         return ''
     if line[0] == '=':
-        return 'response.write(%s)' % line[1:]
+        return 'response.write(%s)' % line[1:].strip()
     else:
         return line
 
     last_quote = ''
     last_character = ''
     line = []
-    open_something = '([{'
-    close_something = ')]}'
     opened = 0
 
     for character in python_code:

File test_new_template.py

         self.do_it()
 
 
+    def test_spaces_that_are_used_after_equal_alias_should_not_be_returned(self):
+        self.input_ = """{{ =  'hi'   }}"""
+        self.expected_output = """response.write('hi')"""
+        self.do_it()
+
+
     def test_using_some_python_expression_after_equal_alias_should_response_write_this_python_expression_without_quotes(self):
         self.input_ = '''some plain text {{='hi'}}{{=python expression}}'''
         self.expected_output = '''response.write("some plain text ", escape=False)
         self.input_ = """some plain text {{='hi' # some comment
 ='hello'}}"""
         self.expected_output = """response.write("some plain text ", escape=False)
-response.write('hi' )
+response.write('hi')
 response.write('hello')"""
         self.do_it()
 
         self.input_ = """some plain text {{='hi' # some comment }}
 hello"""
         self.expected_output = """response.write("some plain text ", escape=False)
-response.write('hi' )
+response.write('hi')
 response.write("\\nhello", escape=False)"""
         self.do_it()