posts: factor out post edit logic.
Factor out most of the tag edit logic from the Post class to a new PostEdit class. The PostEdit class contains the logic for parsing tags and metatags from the tag edit string, and for determining which tags were added or removed by the edit. Fixes various bugs caused by not calculating the set of added or removed tags correctly, for example when tag category prefixes were used (e.g. `copy:touhou`) or when the same tag was added and removed in the same edit (e.g. `touhou -touhou`). Fixes #5123: Tag categorization prefixes bypass deprecation check Fixes #5126: Negating a deprecated tag will still cause the warning to show Fixes #3477: Remove tag validator triggering on tag category changes Fixes #4848: newpool: metatag doesn't parse correctly
This commit is contained in:
@@ -33,6 +33,14 @@ class StringParser
|
||||
scanner.scan(pattern)
|
||||
end
|
||||
|
||||
# Skip over `pattern`, returning true if it was skipped or false if it wasn't.
|
||||
#
|
||||
# @param pattern [Regexp, String] The pattern to match.
|
||||
# @return [Boolean] True if the pattern was skipped, false otherwise.
|
||||
def skip(pattern)
|
||||
scanner.scan(pattern) != nil
|
||||
end
|
||||
|
||||
# Try to match `pattern`, returning the string if it matched or raising an Error if it didn't.
|
||||
#
|
||||
# @param pattern [Regexp, String] The pattern to match.
|
||||
|
||||
Reference in New Issue
Block a user