FEATURE: Nokogumbo (#9577)

* FEATURE: Nokogumbo

Use Nokogumbo HTML parser.
This commit is contained in:
Krzysztof Kotlarek
2020-05-05 13:46:57 +10:00
committed by GitHub
parent b8b1cbbfb9
commit 9bff0882c3
50 changed files with 165 additions and 179 deletions

View File

@ -376,7 +376,7 @@ class ImportScripts::IPBoard3 < ImportScripts::Base
raw.gsub!(/<(.+)>&nbsp;<\/\1>/, "\n\n")
doc = Nokogiri::HTML.fragment(raw)
doc = Nokogiri::HTML5.fragment(raw)
doc.css("blockquote.ipsBlockquote").each do |bq|
post_id = post_id_from_imported_post_id(bq["data-cid"])

View File

@ -218,7 +218,7 @@ class ImportScripts::Jive < ImportScripts::Base
raw = raw.dup
raw = raw[5..-6]
doc = Nokogiri::HTML.fragment(raw)
doc = Nokogiri::HTML5.fragment(raw)
doc.css('img').each do |img|
img.remove if img['class'] == "jive-image"
end

View File

@ -297,7 +297,7 @@ class ImportScripts::JiveApi < ImportScripts::Base
end
def process_raw(raw)
doc = Nokogiri::HTML.fragment(raw)
doc = Nokogiri::HTML5.fragment(raw)
# convert emoticon
doc.css("span.emoticon-inline").each do |span|

View File

@ -913,7 +913,7 @@ SQL
raw.sub!(match, content)
end
doc = Nokogiri::HTML.fragment(raw)
doc = Nokogiri::HTML5.fragment(raw)
doc.css("a,img,li-image").each do |l|
upload_name, image, linked_upload = [nil] * 3