mirror of
https://github.com/discourse/discourse.git
synced 2025-03-20 23:35:53 +08:00
DEV: remove deprecation warnings related to Nokogiri
This commit is contained in:
parent
43ef44127c
commit
ca97850726
@ -59,13 +59,13 @@ class HtmlToMarkdown
|
|||||||
before, after = parent.children.slice_when { |n| n == br }.to_a
|
before, after = parent.children.slice_when { |n| n == br }.to_a
|
||||||
|
|
||||||
if before.size > 1
|
if before.size > 1
|
||||||
b = Nokogiri::XML::Node.new(parent.name, doc.document)
|
b = doc.document.create_element(parent.name)
|
||||||
before[0...-1].each { |c| b.add_child(c) }
|
before[0...-1].each { |c| b.add_child(c) }
|
||||||
parent.previous = b if b.inner_html.present?
|
parent.previous = b if b.inner_html.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
if after.present?
|
if after.present?
|
||||||
a = Nokogiri::XML::Node.new(parent.name, doc.document)
|
a = doc.document.create_element(parent.name)
|
||||||
after.each { |c| a.add_child(c) }
|
after.each { |c| a.add_child(c) }
|
||||||
parent.next = a if a.inner_html.present?
|
parent.next = a if a.inner_html.present?
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user