Skip to content

Commit

Permalink
Ignore whitespace-only lines in addition to purely blank lines.
Browse files Browse the repository at this point in the history
Fixes #38.
  • Loading branch information
nmlorg committed May 13, 2019
1 parent fa59b02 commit 6223d4c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion metabot/modules/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def moddispatch(ctx, msg, modconf): # pylint: disable=missing-docstring


def echo(ctx, msg, message): # pylint: disable=missing-docstring
lines = [line for line in message.splitlines() if line]
lines = [line for line in message.splitlines() if line.strip()]
page = ctx.text.isdigit() and int(ctx.text) or 1
for line in lines[:page]:
msg.add('%s', line)
Expand Down
1 change: 1 addition & 0 deletions metabot/modules/test_echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def test_echo(conversation): # pylint: disable=redefined-outer-name
conversation.multibot.conf['bots']['modulestestbot']['issue37']['echo']['about'] = (
'First line.\n'
'Second line.\n'
' \n'
'Last line.')

assert conversation.message('/about') == """\
Expand Down

0 comments on commit 6223d4c

Please sign in to comment.