Commit d726e40eb2b02f88051c1695596738a42c0eb561

Authored by Lucas Melo
1 parent a3fb85d9

application_helper: use Nokogiri in convert_macro() instead of Hpricot

AI2762
Showing 1 changed file with 4 additions and 4 deletions   Show diff stats
app/helpers/application_helper.rb
@@ -1411,16 +1411,16 @@ module ApplicationHelper @@ -1411,16 +1411,16 @@ module ApplicationHelper
1411 end 1411 end
1412 1412
1413 def convert_macro(html, source) 1413 def convert_macro(html, source)
1414 - doc = Hpricot(html) 1414 + doc = Nokogiri::HTML(html)
1415 #TODO This way is more efficient but do not support macro inside of 1415 #TODO This way is more efficient but do not support macro inside of
1416 # macro. You must parse them from the inside-out in order to enable 1416 # macro. You must parse them from the inside-out in order to enable
1417 # that. 1417 # that.
1418 - doc.search('.macro').each do |macro| 1418 + doc.css('.macro').each do |macro|
1419 macro_name = macro['data-macro'] 1419 macro_name = macro['data-macro']
1420 result = @plugins.parse_macro(macro_name, macro, source) 1420 result = @plugins.parse_macro(macro_name, macro, source)
1421 - macro.inner_html = result.kind_of?(Proc) ? self.instance_eval(&result) : result 1421 + macro.content = result.kind_of?(Proc) ? self.instance_eval(&result) : result
1422 end 1422 end
1423 - doc.html 1423 + doc.xpath('//body/*').to_s
1424 end 1424 end
1425 1425
1426 def default_folder_for_image_upload(profile) 1426 def default_folder_for_image_upload(profile)