plugin URI finder: make the regex ignore case.
This commit is contained in:
parent
534dd0163c
commit
e161ff2d57
1 changed files with 4 additions and 3 deletions
|
|
@ -74,11 +74,12 @@ class URIFinder(object):
|
||||||
@return (dict[unicode, unicode]): map from key to found uri
|
@return (dict[unicode, unicode]): map from key to found uri
|
||||||
"""
|
"""
|
||||||
keys_re = "|".join(keys)
|
keys_re = "|".join(keys)
|
||||||
label_re = r'"(?P<label>[^"]+)"'
|
label_re = r'\"(?P<label>[^\"]+)\"'
|
||||||
uri_re = re.compile(
|
uri_re = re.compile(
|
||||||
r"(?P<key>{keys_re})[ :]? +(?P<uri>xmpp:\S+)(?:.*use {label_re} label)?".format(
|
r"(?P<key>{keys_re})[ :]? +(?P<uri>xmpp:\S+)(?:.*use {label_re} label)?".format(
|
||||||
keys_re=keys_re, label_re=label_re
|
keys_re=keys_re, label_re=label_re
|
||||||
)
|
),
|
||||||
|
re.IGNORECASE
|
||||||
)
|
)
|
||||||
path = os.path.normpath(path)
|
path = os.path.normpath(path)
|
||||||
if not os.path.isdir(path) or not os.path.isabs(path):
|
if not os.path.isdir(path) or not os.path.isabs(path):
|
||||||
|
|
@ -92,7 +93,7 @@ class URIFinder(object):
|
||||||
file_path = os.path.join(path, filename)
|
file_path = os.path.join(path, filename)
|
||||||
with open(file_path) as f:
|
with open(file_path) as f:
|
||||||
for m in uri_re.finditer(f.read()):
|
for m in uri_re.finditer(f.read()):
|
||||||
key = m.group("key")
|
key = m.group("key").lower()
|
||||||
uri = m.group("uri")
|
uri = m.group("uri")
|
||||||
label = m.group("label")
|
label = m.group("label")
|
||||||
if key in found_uris:
|
if key in found_uris:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue