tag.rb: don't strip '%' or ',' from tags; split on unicode spaces.
Allows '%' and ',' in tag names. There's no technical need to forbid these characters. Fixes an issue with these characters being stripped away inside metatags (e.g. tagging a post with `pool:ichigo_100%` strips away the '%').
This commit is contained in:
@@ -229,13 +229,13 @@ class Tag < ActiveRecord::Base
|
|||||||
def scan_query(query)
|
def scan_query(query)
|
||||||
tagstr = normalize(query)
|
tagstr = normalize(query)
|
||||||
list = tagstr.scan(/-?source:".*?"/) || []
|
list = tagstr.scan(/-?source:".*?"/) || []
|
||||||
list + tagstr.gsub(/-?source:".*?"/, "").scan(/\S+/).uniq
|
list + tagstr.gsub(/-?source:".*?"/, "").scan(/[^[:space:]]+/).uniq
|
||||||
end
|
end
|
||||||
|
|
||||||
def scan_tags(tags, options = {})
|
def scan_tags(tags, options = {})
|
||||||
tagstr = normalize(tags)
|
tagstr = normalize(tags)
|
||||||
list = tagstr.scan(/source:".*?"/) || []
|
list = tagstr.scan(/source:".*?"/) || []
|
||||||
list += tagstr.gsub(/source:".*?"/, "").gsub(/[%,]/, "").scan(/\S+/).uniq
|
list += tagstr.gsub(/source:".*?"/, "").scan(/[^[:space:]]+/).uniq
|
||||||
if options[:strip_metatags]
|
if options[:strip_metatags]
|
||||||
list = list.map {|x| x.sub(/^[-~]/, "")}
|
list = list.map {|x| x.sub(/^[-~]/, "")}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user