@@ -867,7 +867,7 module ApplicationHelper | |||
|
867 | 867 | \{\{ # opening tag |
|
868 | 868 | ([\w]+) # macro name |
|
869 | 869 | (\(([^\n\r]*?)\))? # optional arguments |
|
870 |
([\n\r].*[\n\r])? |
|
|
870 | ([\n\r].*?[\n\r])? # optional block of text | |
|
871 | 871 | \}\} # closing tag |
|
872 | 872 | ) |
|
873 | 873 | )/mx unless const_defined?(:MACROS_RE) |
@@ -273,4 +273,23 EXPECTED | |||
|
273 | 273 | text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}' |
|
274 | 274 | assert_equal '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', textilizable(text) |
|
275 | 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 | 295 | end |
General Comments 0
You need to be logged in to leave comments.
Login now