comparison core/functions.py @ 816:97f8fab9b1a3

Tweaking the quoting algorithm a bit. Trying to reduce trailing lines that are just ">".
author Brian Neal <bgneal@gmail.com>
date Wed, 10 Sep 2014 19:21:59 -0500
parents e888d627928f
children 79a71b9d0a2a
comparison
equal deleted inserted replaced
815:95462f4adb94 816:97f8fab9b1a3
121 def quote_message(who, message): 121 def quote_message(who, message):
122 """ 122 """
123 Builds a message reply by quoting the existing message in a 123 Builds a message reply by quoting the existing message in a
124 typical email-like fashion. The quoting is compatible with Markdown. 124 typical email-like fashion. The quoting is compatible with Markdown.
125 """ 125 """
126 msg = "> %s" % message.replace('\n', '\n> ') 126 msg = "> %s" % message.rstrip().replace('\n', '\n> ')
127 if msg.endswith('\n> '): 127 if msg.endswith('\n> '):
128 msg = msg[:-2] 128 msg = msg[:-2]
129 129
130 return "*%s wrote:*\n\n%s\n\n" % (who, msg) 130 return "*%s wrote:*\n\n%s\n\n" % (who, msg)