Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/4.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvitaliys <vitaliys@debian>2014-09-15 18:36:35 +0400
committervitaliys <vitaliys@debian>2014-09-15 18:36:35 +0400
commit30c79d221c64a4763c99b09b20d5f83ebccd0758 (patch)
treee1dc58a13cbb9f7aae9843871eef712f00d5669b
parent0adc0e257307e90305ed0529443e47322c1838ba (diff)
upd: sokr.py
-rw-r--r--plugins/sokr.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/sokr.py b/plugins/sokr.py
index c90dba7..6bc45e7 100644
--- a/plugins/sokr.py
+++ b/plugins/sokr.py
@@ -26,7 +26,11 @@ def sokr(type, jid, nick, text):
text = text.strip()
if not text: msg = L('What?','%s/%s'%(jid,nick))
else:
- if re.search('\A\d+?(-\d+?)? ', text): target, text = text.split(' ', 1)
+ tmp_target = re.search('(\A| )\d+?(-\d+?)?(\Z| )', text)
+ if tmp_target:
+ target = tmp_target.group().strip()
+ text = text.replace(target, ' ')
+ text = reduce_spaces_all(text)
if re.match('[a-zA-Z]+\Z', text):
data = load_page('http://www.abbreviations.com/%s' % text)
results = re.findall('<p class="desc">(.+?)</p>', data)