aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <s@jaseg.de>2013-08-10 21:18:21 +0200
committerjaseg <s@jaseg.de>2013-08-10 21:22:17 +0200
commitbcf2ffdb8faa08b7486a29157241bf40b77de2a6 (patch)
tree50325852cf06e435131dfddf071322fe454935ff
parent14c8d3fe923e9c74cb92b4c1d0a467238d84c84e (diff)
downloadponysay-bcf2ffdb8faa08b7486a29157241bf40b77de2a6.tar.gz
ponysay-bcf2ffdb8faa08b7486a29157241bf40b77de2a6.tar.bz2
ponysay-bcf2ffdb8faa08b7486a29157241bf40b77de2a6.zip
Line wrapping fix
-rwxr-xr-xponysay-qotd3
-rw-r--r--ponysay.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/ponysay-qotd b/ponysay-qotd
index 2530d8f..134a895 100755
--- a/ponysay-qotd
+++ b/ponysay-qotd
@@ -17,7 +17,8 @@ class QOTDHandler(BaseRequestHandler):
s = ponysay.render_pony(pony, ponysay.random_quote(pony),
balloonstyle=ponysay.balloonstyles['cowsay'],
center=True,
- centertext=False)
+ centertext=False,
+ width=120)
self.request.sendall(bytes(s, "UTF-8"))
if __name__ == "__main__":
diff --git a/ponysay.py b/ponysay.py
index c70382e..f5f0f66 100644
--- a/ponysay.py
+++ b/ponysay.py
@@ -73,5 +73,5 @@ def render_pony(name, text, balloonstyle, width=80, center=False, centertext=Fal
ponywidth = max([ len(re.sub(r'\x1B\[[0-9;]+m|\$.*\$', '', line)) for line in pony ])
indent = ' '*int((width-ponywidth)/2)
wre = re.compile('((\x1B\[[0-9;]+m)*.){0,%s}' % width)
- return ''.join([ indent+wre.search(line).group()+'\n' for line in pony ])
+ return ''.join([ indent+wre.search(line).group()+'\n' for line in pony ])