mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Fixed shrink command.
This commit is contained in:
parent
a19bf090e5
commit
b8621f0c34
@ -619,7 +619,7 @@ class Filter(callbacks.Privmsg):
|
||||
irc.reply(' '.join(['GNU/' + s for s in text.split()]))
|
||||
gnu = wrap(gnu, ['text'])
|
||||
|
||||
def shrink(self, irc, msg, args):
|
||||
def shrink(self, irc, msg, args, text):
|
||||
"""<text>
|
||||
|
||||
Returns <text> with each word longer than
|
||||
@ -628,11 +628,12 @@ class Filter(callbacks.Privmsg):
|
||||
"""
|
||||
L = []
|
||||
minimum = self.registryValue('shrink.minimum', msg.args[0])
|
||||
for word in args:
|
||||
for word in text.split():
|
||||
if len(word) >= minimum:
|
||||
word = '%s%s%s' % (word[0], len(word)-2, word[-1])
|
||||
L.append(word)
|
||||
irc.reply(' '.join(L))
|
||||
shrink = wrap(shrink, ['text'])
|
||||
|
||||
|
||||
Class = Filter
|
||||
|
@ -160,5 +160,6 @@ class FilterTest(ChannelPluginTestCase, PluginDocumentation):
|
||||
def testShrink(self):
|
||||
self.assertResponse('shrink I love you', 'I l2e you')
|
||||
self.assertResponse('shrink internationalization', 'i18n')
|
||||
self.assertResponse('shrink "I love you"', 'I l2e you')
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
Loading…
Reference in New Issue
Block a user