@@ -852,7 +852,7 module ApplicationHelper | |||
|
852 | 852 | ( |
|
853 | 853 | \{\{ # opening tag |
|
854 | 854 | ([\w]+) # macro name |
|
855 |
(\(( |
|
|
855 | (\((.*?)\))? # optional arguments | |
|
856 | 856 | \}\} # closing tag |
|
857 | 857 | ) |
|
858 | 858 | /x unless const_defined?(:MACROS_RE) |
@@ -65,6 +65,17 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase | |||
|
65 | 65 | assert_equal '<p>Bar: () (String)</p>', textilizable("{{bar()}}") |
|
66 | 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 | 79 | def test_macro_hello_world |
|
69 | 80 | text = "{{hello_world}}" |
|
70 | 81 | assert textilizable(text).match(/Hello world!/) |
General Comments 0
You need to be logged in to leave comments.
Login now