From 981143f78fa66e4c4357ec7cbb35675710abeb40 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Tue, 26 Apr 2011 12:41:57 -0700 Subject: [PATCH] [#604] Disable classic ChiliProject wiki macros --- lib/redmine/wiki_formatting.rb | 33 +-------------------------------- 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/lib/redmine/wiki_formatting.rb b/lib/redmine/wiki_formatting.rb index cf5f4516..ac9ae734 100644 --- a/lib/redmine/wiki_formatting.rb +++ b/lib/redmine/wiki_formatting.rb @@ -41,7 +41,7 @@ module Redmine end def to_html(format, text, options = {}, &block) - text = if Setting.cache_formatted_text? && text.size > 2.kilobyte && cache_store && cache_key = cache_key_for(format, options[:object], options[:attribute]) + if Setting.cache_formatted_text? && text.size > 2.kilobyte && cache_store && cache_key = cache_key_for(format, options[:object], options[:attribute]) # Text retrieved from the cache store may be frozen # We need to dup it so we can do in-place substitutions with gsub! cache_store.fetch cache_key do @@ -50,10 +50,6 @@ module Redmine else formatter_for(format).new(text).to_html end - if block_given? - execute_macros(text, block) - end - text end # Returns a cache key for the given text +format+, +object+ and +attribute+ or nil if no caching should be done @@ -67,33 +63,6 @@ module Redmine def cache_store ActionController::Base.cache_store end - - MACROS_RE = / - (!)? # escaping - ( - \{\{ # opening tag - ([\w]+) # macro name - (\(([^\}]*)\))? # optional arguments - \}\} # closing tag - ) - /x unless const_defined?(:MACROS_RE) - - # Macros substitution - def execute_macros(text, macros_runner) - text.gsub!(MACROS_RE) do - esc, all, macro = $1, $2, $3.downcase - args = ($5 || '').split(',').each(&:strip) - if esc.nil? - begin - macros_runner.call(macro, args) - rescue => e - "
Error executing the #{macro} macro (#{e})
" - end || all - else - all - end - end - end end end end