diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d193b73..07e41ad 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1401,7 +1401,7 @@ module ApplicationHelper
end
def filter_html(html, source)
- if @plugins
+ if @plugins && source.has_macro?
html = convert_macro(html, source)
#TODO This parse should be done through the macro infra, but since there
# are old things that do not support it we are keeping this hot spot.
diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb
index 7bf7a74..6f08a83 100644
--- a/app/helpers/boxes_helper.rb
+++ b/app/helpers/boxes_helper.rb
@@ -100,9 +100,7 @@ module BoxesHelper
options[:title] = _("This block is invisible. Your visitors will not see it.")
end
- if @controller.send(:content_editor?)
- result = filter_html(result, block)
- end
+ result = filter_html(result, block)
box_decorator.block_target(block.box, block) +
content_tag('div',
diff --git a/app/models/article.rb b/app/models/article.rb
index 3bb49c6..4f564d8 100644
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -673,6 +673,10 @@ class Article < ActiveRecord::Base
delegate :region, :region_id, :environment, :environment_id, :to => :profile, :allow_nil => true
+ def has_macro?
+ true
+ end
+
private
def sanitize_tag_list
diff --git a/app/models/block.rb b/app/models/block.rb
index 9fab33b..5231153 100644
--- a/app/models/block.rb
+++ b/app/models/block.rb
@@ -138,4 +138,8 @@ class Block < ActiveRecord::Base
4.hours
end
+ def has_macro?
+ false
+ end
+
end
diff --git a/app/models/raw_html_block.rb b/app/models/raw_html_block.rb
index a403b51..f370077 100644
--- a/app/models/raw_html_block.rb
+++ b/app/models/raw_html_block.rb
@@ -10,4 +10,7 @@ class RawHTMLBlock < Block
(title.blank? ? '' : block_title(title)).html_safe + html.to_s.html_safe
end
+ def has_macro?
+ true
+ end
end
diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb
index e96507e..bc28cd3 100644
--- a/test/unit/application_helper_test.rb
+++ b/test/unit/application_helper_test.rb
@@ -791,6 +791,29 @@ class ApplicationHelperTest < ActiveSupport::TestCase
'
', result
end
+ should 'not filter html if source does not have macros' do
+ class Plugin1 < Noosfero::Plugin
+ end
+
+ class Plugin1::Macro1 < Noosfero::Plugin::Macro
+ def parse(params, inner_html, source)
+ 'Test1'
+ end
+ end
+
+ environment = Environment.default
+ environment.enable_plugin(Plugin1)
+ @plugins = Noosfero::Plugin::Manager.new(environment, self)
+ macro1_name = Plugin1::Macro1.identifier
+ source = mock
+ source.stubs(:has_macro?).returns(false)
+
+ html = "