diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-16 15:34:17 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-16 15:34:17 +0000 |
commit | 05823373724e472b6b7f9f172733aa16d132ced7 (patch) | |
tree | 041df1af3919b5ecfd9f84a9f86af5ce207c7370 /lib/redmine/wiki_formatting.rb | |
parent | 1c8cf4ef8338736ebcaa905f8932545a24e817c6 (diff) | |
download | redmine-05823373724e472b6b7f9f172733aa16d132ced7.tar.gz redmine-05823373724e472b6b7f9f172733aa16d132ced7.zip |
Added:
* the 'include' macro to include a wiki page
* macro escaping support (with exclamation mark)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1153 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/wiki_formatting.rb')
-rw-r--r-- | lib/redmine/wiki_formatting.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index f7fa803a6..79da2a38a 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -93,21 +93,28 @@ module Redmine end MACROS_RE = / + (!)? # escaping + ( \{\{ # opening tag ([\w]+) # macro name (\(([^\}]*)\))? # optional arguments \}\} # closing tag + ) /x unless const_defined?(:MACROS_RE) def inline_macros(text) text.gsub!(MACROS_RE) do - all, macro = $&, $1.downcase - args = ($3 || '').split(',').each(&:strip) - begin - @macros_runner.call(macro, args) - rescue => e - "<div class=\"flash error\">Error executing the <strong>#{macro}</strong> macro (#{e})</div>" - end || all + esc, all, macro = $1, $2, $3.downcase + args = ($5 || '').split(',').each(&:strip) + if esc.nil? + begin + @macros_runner.call(macro, args) + rescue => e + "<div class=\"flash error\">Error executing the <strong>#{macro}</strong> macro (#{e})</div>" + end || all + else + all + end end end |