comparison gpp/core/functions.py @ 566:4b9970ad0edb

For bitbucket issue #6, try to improve quoting messages.
author Brian Neal <bgneal@gmail.com>
date Sun, 04 Mar 2012 14:52:24 -0600
parents 82b97697312e
children
comparison
equal deleted inserted replaced
565:6a265b5768ca 566:4b9970ad0edb
101 try: 101 try:
102 n = int(n) 102 n = int(n)
103 except ValueError: 103 except ValueError:
104 n = 1 104 n = 1
105 return n 105 return n
106
107
108 def quote_message(who, message):
109 """
110 Builds a message reply by quoting the existing message in a
111 typical email-like fashion. The quoting is compatible with Markdown.
112 """
113 msg = "> %s" % message.replace('\n', '\n> ')
114 if msg.endswith('\n> '):
115 msg = msg[:-2]
116
117 return "*%s wrote:*\n\n%s\n\n" % (who, msg)