##// END OF EJS Templates
Slight change to the macro regexp....
Jean-Philippe Lang -
r9995:b90739878805
parent child
Show More
@@ -852,7 +852,7 module ApplicationHelper
852 (
852 (
853 \{\{ # opening tag
853 \{\{ # opening tag
854 ([\w]+) # macro name
854 ([\w]+) # macro name
855 (\(([^\}]*)\))? # optional arguments
855 (\((.*?)\))? # optional arguments
856 \}\} # closing tag
856 \}\} # closing tag
857 )
857 )
858 /x unless const_defined?(:MACROS_RE)
858 /x unless const_defined?(:MACROS_RE)
@@ -65,6 +65,17 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase
65 assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar()}}")
65 assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar()}}")
66 end
66 end
67
67
68 def test_multiple_macros_on_the_same_line
69 Redmine::WikiFormatting::Macros.macro :foo do |obj, args|
70 args.any? ? "args: #{args.join(',')}" : "no args"
71 end
72
73 assert_equal '<p>no args no args</p>', textilizable("{{foo}} {{foo}}")
74 assert_equal '<p>args: a,b no args</p>', textilizable("{{foo(a,b)}} {{foo}}")
75 assert_equal '<p>args: a,b args: c,d</p>', textilizable("{{foo(a,b)}} {{foo(c,d)}}")
76 assert_equal '<p>no args args: c,d</p>', textilizable("{{foo}} {{foo(c,d)}}")
77 end
78
68 def test_macro_hello_world
79 def test_macro_hello_world
69 text = "{{hello_world}}"
80 text = "{{hello_world}}"
70 assert textilizable(text).match(/Hello world!/)
81 assert textilizable(text).match(/Hello world!/)
General Comments 0
You need to be logged in to leave comments. Login now