Mercurial > public > sg101
diff 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 |
line wrap: on
line diff
--- a/gpp/core/functions.py Sun Mar 04 13:20:40 2012 -0600 +++ b/gpp/core/functions.py Sun Mar 04 14:52:24 2012 -0600 @@ -103,3 +103,15 @@ except ValueError: n = 1 return n + + +def quote_message(who, message): + """ + Builds a message reply by quoting the existing message in a + typical email-like fashion. The quoting is compatible with Markdown. + """ + msg = "> %s" % message.replace('\n', '\n> ') + if msg.endswith('\n> '): + msg = msg[:-2] + + return "*%s wrote:*\n\n%s\n\n" % (who, msg)