@@ -147,10 +147,10 module Redmine | |||
|
147 | 147 | unless block_given? |
|
148 | 148 | raise "Can not create a macro without a block!" |
|
149 | 149 | end |
|
150 |
name = name.to_sym |
|
|
150 | name = name.to_s.downcase.to_sym | |
|
151 | 151 | available_macros[name] = {:desc => @@desc || ''}.merge(options) |
|
152 | 152 | @@desc = nil |
|
153 |
Definitions.send :define_method, "macro_#{name}" |
|
|
153 | Definitions.send :define_method, "macro_#{name}", &block | |
|
154 | 154 | end |
|
155 | 155 | |
|
156 | 156 | # Sets description for the next macro to be defined |
@@ -78,6 +78,12 class Redmine::WikiFormatting::MacrosTest < ActionView::TestCase | |||
|
78 | 78 | assert_equal "<p>Baz: (arg1,arg2) (String) (line1\nline2)</p>", textilizable("{{baz(arg1, arg2)\nline1\nline2\n}}") |
|
79 | 79 | end |
|
80 | 80 | |
|
81 | def test_macro_name_with_upper_case | |
|
82 | Redmine::WikiFormatting::Macros.macro(:UpperCase) {|obj, args| "Upper"} | |
|
83 | ||
|
84 | assert_equal "<p>Upper</p>", textilizable("{{UpperCase}}") | |
|
85 | end | |
|
86 | ||
|
81 | 87 | def test_multiple_macros_on_the_same_line |
|
82 | 88 | Redmine::WikiFormatting::Macros.macro :foo do |obj, args| |
|
83 | 89 | args.any? ? "args: #{args.join(',')}" : "no args" |
General Comments 0
You need to be logged in to leave comments.
Login now