Commit e95275da8738bebab04604ba48b992d0f8222019
1 parent
ca5e7eb8
Exists in
master
and in
29 other branches
Revert "application_helper: use Nokogiri in convert_macro() instead of Hpricot"
This reverts commit d726e40eb2b02f88051c1695596738a42c0eb561. Reverting substitution of hpricot for nokogiri on macros infra due to segfault problem with nokogiri 1.4.0. Conflicts: app/helpers/application_helper.rb
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1382,16 +1382,16 @@ module ApplicationHelper | @@ -1382,16 +1382,16 @@ module ApplicationHelper | ||
1382 | end | 1382 | end |
1383 | 1383 | ||
1384 | def convert_macro(html, source) | 1384 | def convert_macro(html, source) |
1385 | - doc = Nokogiri::HTML(html) | 1385 | + doc = Hpricot(html) |
1386 | #TODO This way is more efficient but do not support macro inside of | 1386 | #TODO This way is more efficient but do not support macro inside of |
1387 | # macro. You must parse them from the inside-out in order to enable | 1387 | # macro. You must parse them from the inside-out in order to enable |
1388 | # that. | 1388 | # that. |
1389 | - doc.css('.macro').each do |macro| | 1389 | + doc.search('.macro').each do |macro| |
1390 | macro_name = macro['data-macro'] | 1390 | macro_name = macro['data-macro'] |
1391 | result = @plugins.parse_macro(macro_name, macro, source) | 1391 | result = @plugins.parse_macro(macro_name, macro, source) |
1392 | - macro.content = result.kind_of?(Proc) ? self.instance_eval(&result) : result | 1392 | + macro.inner_html = result.kind_of?(Proc) ? self.instance_eval(&result) : result |
1393 | end | 1393 | end |
1394 | - CGI.unescapeHTML(doc.xpath('//body/*').to_s) | 1394 | + doc.html |
1395 | end | 1395 | end |
1396 | 1396 | ||
1397 | def default_folder_for_image_upload(profile) | 1397 | def default_folder_for_image_upload(profile) |