Fixed shrink command.

This commit is contained in:
Jeremy Fincher 2004-10-24 03:04:29 +00:00
parent a19bf090e5
commit b8621f0c34
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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: