From d726e40eb2b02f88051c1695596738a42c0eb561 Mon Sep 17 00:00:00 2001 From: Lucas Melo Date: Tue, 27 Aug 2013 17:27:11 -0300 Subject: [PATCH] application_helper: use Nokogiri in convert_macro() instead of Hpricot --- app/helpers/application_helper.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index d193b73..25f1b0a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1411,16 +1411,16 @@ module ApplicationHelper end def convert_macro(html, source) - doc = Hpricot(html) + doc = Nokogiri::HTML(html) #TODO This way is more efficient but do not support macro inside of # macro. You must parse them from the inside-out in order to enable # that. - doc.search('.macro').each do |macro| + doc.css('.macro').each do |macro| macro_name = macro['data-macro'] result = @plugins.parse_macro(macro_name, macro, source) - macro.inner_html = result.kind_of?(Proc) ? self.instance_eval(&result) : result + macro.content = result.kind_of?(Proc) ? self.instance_eval(&result) : result end - doc.html + doc.xpath('//body/*').to_s end def default_folder_for_image_upload(profile) -- libgit2 0.21.2