mirror of
https://github.com/meineerde/redmine.git
synced 2025-12-19 15:01:14 +00:00
Fixed: New multi-line macros regexp is too eager (#11736).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10276 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
265baa1b2c
commit
8b72710d7e
@ -867,7 +867,7 @@ module ApplicationHelper
|
|||||||
\{\{ # opening tag
|
\{\{ # opening tag
|
||||||
([\w]+) # macro name
|
([\w]+) # macro name
|
||||||
(\(([^\n\r]*?)\))? # optional arguments
|
(\(([^\n\r]*?)\))? # optional arguments
|
||||||
([\n\r].*[\n\r])? # optional block of text
|
([\n\r].*?[\n\r])? # optional block of text
|
||||||
\}\} # closing tag
|
\}\} # closing tag
|
||||||
)
|
)
|
||||||
)/mx unless const_defined?(:MACROS_RE)
|
)/mx unless const_defined?(:MACROS_RE)
|
||||||
|
|||||||
@ -273,4 +273,23 @@ EXPECTED
|
|||||||
text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}'
|
text = '{{macro(2)}} !{{macro(2)}} {{hello_world(foo)}}'
|
||||||
assert_equal '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', textilizable(text)
|
assert_equal '<p>{{macro(2)}} {{macro(2)}} Hello world! Object: NilClass, Arguments: foo and no block of text.</p>', textilizable(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_macros_with_text_should_not_mangle_following_macros
|
||||||
|
text = <<-RAW
|
||||||
|
{{hello_world
|
||||||
|
Line of text
|
||||||
|
}}
|
||||||
|
|
||||||
|
{{hello_world
|
||||||
|
Another line of text
|
||||||
|
}}
|
||||||
|
RAW
|
||||||
|
|
||||||
|
expected = <<-EXPECTED
|
||||||
|
<p>Hello world! Object: NilClass, Called with no argument and a 12 bytes long block of text.</p>
|
||||||
|
<p>Hello world! Object: NilClass, Called with no argument and a 20 bytes long block of text.</p>
|
||||||
|
EXPECTED
|
||||||
|
|
||||||
|
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(text).gsub(%r{[\r\n\t]}, '')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user