##// END OF EJS Templates
Fixed: New multi-line macros regexp is too eager (#11736)....
Jean-Philippe Lang -
r10093:8b72710d7ee3
parent child
Show More
@@ -867,7 +867,7 module ApplicationHelper
867 \{\{ # opening tag
867 \{\{ # opening tag
868 ([\w]+) # macro name
868 ([\w]+) # macro name
869 (\(([^\n\r]*?)\))? # optional arguments
869 (\(([^\n\r]*?)\))? # optional arguments
870 ([\n\r].*[\n\r])? # optional block of text
870 ([\n\r].*?[\n\r])? # optional block of text
871 \}\} # closing tag
871 \}\} # closing tag
872 )
872 )
873 )/mx unless const_defined?(:MACROS_RE)
873 )/mx unless const_defined?(:MACROS_RE)
@@ -273,4 +273,23 EXPECTED
273 text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}'
273 text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}'
274 assert_equal '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', textilizable(text)
274 assert_equal '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', textilizable(text)
275 end
275 end
276
277 def test_macros_with_text_should_not_mangle_following_macros
278 text = <<-RAW
279 {{hello_world
280 Line of text
281 }}
282
283 {{hello_world
284 Another line of text
285 }}
286 RAW
287
288 expected = <<-EXPECTED
289 <p>Hello world! Object: NilClass, Called with no argument and a 12 bytes long block of text.</p>
290 <p>Hello world! Object: NilClass, Called with no argument and a 20 bytes long block of text.</p>
291 EXPECTED
292
293 assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(text).gsub(%r{[\r\n\t]}, '')
294 end
276 end
295 end
General Comments 0
You need to be logged in to leave comments. Login now