Fix #3321: HTML tags not converted in artist commentaries.

This commit is contained in:
evazion
2017-11-21 01:59:09 -06:00
parent b3a9cd6c06
commit f8581c8113
2 changed files with 10 additions and 2 deletions

View File

@@ -132,7 +132,8 @@ module Sources
%("user/#{member_id}":[#{profile_url}] "»":[/artists?#{search_params}])
end
text
text = text.gsub(/\r\n|\r|\n/, "<br>")
DText.from_html(text)
end
def illust_id_from_url

View File

@@ -135,10 +135,17 @@ module Sources
assert_equal("desc", @site.dtext_artist_commentary_desc)
end
should "convert html to dtext" do
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=65985331")
dtext_desc = "[b]bold[/b]\n[i]italic[/i]\nred"
assert_equal(dtext_desc, @site.dtext_artist_commentary_desc)
end
should "convert illust links and member links to dtext" do
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=63421642")
dtext_desc = %(foo 【pixiv #46337015 "»":[/posts?tags=pixiv:46337015]】bar 【pixiv #14901720 "»":[/posts?tags=pixiv:14901720]】\r\n\r\nbaz【"user/83739":[https://www.pixiv.net/member.php?id=83739] "»":[/artists?search%5Burl_matches%5D=https%3A%2F%2Fwww.pixiv.net%2Fmember.php%3Fid%3D83739]】)
dtext_desc = %(foo 【pixiv #46337015 "»":[/posts?tags=pixiv:46337015]】bar 【pixiv #14901720 "»":[/posts?tags=pixiv:14901720]】\n\nbaz【"user/83739":[https://www.pixiv.net/member.php?id=83739] "»":[/artists?search%5Burl_matches%5D=https%3A%2F%2Fwww.pixiv.net%2Fmember.php%3Fid%3D83739]】)
assert_equal(dtext_desc, @site.dtext_artist_commentary_desc)
end
end