post queries: track whether metatag values are quoted.
This is necessary for the `commentary:` metatag, which has different behavior depending on whether the metatag value is quoted. For example, `commentary:translated` finds translated commentaries, while `commentary:"translated"` finds commentaries containing the literal word "translated".
This commit is contained in:
@@ -164,8 +164,8 @@ class PostQuery
|
||||
if accept(METATAG_NAME_REGEX)
|
||||
name = @scanner.matched.delete_suffix(":").downcase
|
||||
name = name.singularize + "_count" if name.in?(PostQueryBuilder::COUNT_METATAG_SYNONYMS)
|
||||
value = quoted_string
|
||||
node(:metatag, name, value)
|
||||
quoted, value = quoted_string
|
||||
node(:metatag, name, value, quoted)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -173,13 +173,13 @@ class PostQuery
|
||||
if accept('"')
|
||||
a = accept(/([^"\\]|\\")*/).gsub(/\\"/, '"') # handle backslash escaped quotes
|
||||
expect('"')
|
||||
a
|
||||
[true, a]
|
||||
elsif accept("'")
|
||||
a = accept(/([^'\\]|\\')*/).gsub(/\\'/, "'") # handle backslash escaped quotes
|
||||
expect("'")
|
||||
a
|
||||
[true, a]
|
||||
else
|
||||
string(/[^ ]+/)
|
||||
[false, string(/[^ ]+/)]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user