nijie: fetch commentary as html instead of plaintext.

Fix regression in #4475. Fetch the commentary as html instead of
plaintext so that we don't lose links or other formatting.

Also fix it so that /jump.php redirect links are replaced with the
actual url.
This commit is contained in:
evazion
2020-05-29 15:19:59 -05:00
parent 206ac7dd9a
commit 855e31ac90
2 changed files with 23 additions and 8 deletions

View File

@@ -114,7 +114,7 @@ module Sources
end
def artist_commentary_desc
page&.search('#illust_text > p')&.text
page&.search('#illust_text > p')&.to_html
end
def tags
@@ -135,7 +135,14 @@ module Sources
def self.to_dtext(text)
text = text.to_s.gsub(/\r\n|\r/, "<br>")
DText.from_html(text).strip
dtext = DText.from_html(text) do |element|
if element.name == "a" && element["href"]&.start_with?("/jump.php")
element["href"] = element.text
end
end
dtext.strip
end
def to_full_image_url(x)