Fix #4016: Translated tags failing to find some tags.
* Normalize spaces to underscores when saving other names. Preserve case since case can be significant. * Fix WikiPage#other_names_include to search case-insensitively (note: this prevents using the index). * Fix sources to return the raw tags in `#tags` and the normalized tags in `#normalized_tags`. The normalized tags are the tags that will be matched against other names.
This commit is contained in:
@@ -56,7 +56,8 @@ module Sources
|
||||
end
|
||||
|
||||
should "get the tags" do
|
||||
assert_equal(%w[gantz reika], @site.tags.map(&:first))
|
||||
assert_equal(%w[gantz Reika], @site.tags.map(&:first))
|
||||
assert_equal(%w[gantz reika], @site.normalized_tags)
|
||||
end
|
||||
|
||||
should "get the artist commentary" do
|
||||
@@ -74,6 +75,11 @@ module Sources
|
||||
url = "https://cdna.artstation.com/p/assets/images/images/000/144/922/large/cassio-yoshiyaki-cody2backup2-yoshiyaki.jpg?1406314198"
|
||||
assert_equal(url, @site.image_url)
|
||||
end
|
||||
|
||||
should "get the tags" do
|
||||
assert_equal(["Street Fighter", "Cody", "SF"].sort, @site.tags.map(&:first).sort)
|
||||
assert_equal(["street_fighter", "cody", "sf"].sort, @site.normalized_tags.sort)
|
||||
end
|
||||
end
|
||||
|
||||
context "The source site for a http://cdna.artstation.com/p/assets/... url" do
|
||||
|
||||
@@ -34,7 +34,7 @@ module Sources
|
||||
@samp = "https://files.yande.re/sample/7ecfdead705d7b956b26b1d37b98d089/yande.re%20482880%20sample%20bayashiko%20journey_to_the_west%20sun_wukong.jpg"
|
||||
@full = "https://files.yande.re/image/7ecfdead705d7b956b26b1d37b98d089/yande.re%20482880.jpg"
|
||||
@page = "https://yande.re/post/show/482880"
|
||||
@tags = ["bayashiko", "journey to the west", "sun wukong"]
|
||||
@tags = ["bayashiko", "journey_to_the_west", "sun_wukong"]
|
||||
@size = 362_554
|
||||
@profile_url = "https://twitter.com/apononori"
|
||||
@data = { site_name: "yande.re", preview_url: @prev, image_url: @full, page_url: @page, size: @size, tags: @tags, profile_url: @profile_url }
|
||||
@@ -52,7 +52,7 @@ module Sources
|
||||
@jpeg = "https://files.yande.re/sample/fb27a7ea6c48b2ef76fe915e378b9098/yande.re%20398018%20detexted%20misaki_kurehito%20saenai_heroine_no_sodatekata%20sawamura_spencer_eriri%20thighhighs.jpg"
|
||||
@full = "https://files.yande.re/image/fb27a7ea6c48b2ef76fe915e378b9098/yande.re%20398018.png"
|
||||
@page = "https://yande.re/post/show/398018"
|
||||
@tags = ["misaki kurehito", "saenai heroine no sodatekata", "sawamura spencer eriri", "detexted", "thighhighs"]
|
||||
@tags = ["misaki_kurehito", "saenai_heroine_no_sodatekata", "sawamura_spencer_eriri", "detexted", "thighhighs"]
|
||||
@size = 9_118_998
|
||||
@data = { site_name: "yande.re", preview_url: @prev, image_url: @full, page_url: @page, size: @size, tags: @tags, profile_url: nil }
|
||||
|
||||
@@ -93,7 +93,7 @@ module Sources
|
||||
anthropomorphism bed blonde_hair bow brown_eyes doll
|
||||
girls_frontline hara_shoutarou hoodie long_hair pantyhose scar skirt
|
||||
twintails ump-45_(girls_frontline) ump-9_(girls_frontline)
|
||||
].map { |tag| tag.tr("_", " ") }
|
||||
]
|
||||
@profile_url = "https://www.pixiv.net/member.php?id=22528152"
|
||||
|
||||
@data = { site_name: "konachan.com", preview_url: @prev, image_url: @full, page_url: @page, size: @size, tags: @tags, profile_url: @profile_url }
|
||||
|
||||
@@ -20,8 +20,9 @@ module Sources
|
||||
end
|
||||
|
||||
should "get the tags" do
|
||||
tags = [["tag", "https://tumblr.com/tagged/tag"], ["red_hair", "https://tumblr.com/tagged/red_hair"]]
|
||||
assert_equal(tags, @site.tags)
|
||||
tags = ["tag", "red hair", "red-hair", "red_hair"]
|
||||
assert_equal(tags, @site.tags.map(&:first))
|
||||
assert_equal(["red_hair", "tag"], @site.normalized_tags)
|
||||
end
|
||||
|
||||
should "get the commentary" do
|
||||
@@ -100,8 +101,9 @@ module Sources
|
||||
end
|
||||
|
||||
should "get the tags" do
|
||||
tags = [["tag", "https://tumblr.com/tagged/tag"], ["red_hair", "https://tumblr.com/tagged/red_hair"]]
|
||||
assert_equal(tags, @site.tags)
|
||||
tags = ["tag", "red hair", "red-hair", "red_hair"]
|
||||
assert_equal(tags, @site.tags.map(&:first))
|
||||
assert_equal(["red_hair", "tag"], @site.normalized_tags)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user