DDG style Bangs now support Bangs at the End (Implements #404)
This commit is contained in:
parent
190b684469
commit
1de7846aed
|
@ -55,9 +55,10 @@ def resolve_bang(query: str, bangs_dict: dict) -> str:
|
||||||
query = query.lower()
|
query = query.lower()
|
||||||
split_query = query.split(' ')
|
split_query = query.split(' ')
|
||||||
for operator in bangs_dict.keys():
|
for operator in bangs_dict.keys():
|
||||||
if operator not in split_query:
|
if operator not in split_query \
|
||||||
|
and operator[1:] + operator[0] not in split_query:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
return bangs_dict[operator]['url'].format(
|
return bangs_dict[operator]['url'].format(
|
||||||
query.replace(operator, '').strip())
|
query.replace(operator if operator in split_query
|
||||||
|
else operator[1:] + operator[0], '').strip())
|
||||||
return ''
|
return ''
|
||||||
|
|
Loading…
Reference in New Issue
Block a user