aboutsummaryrefslogtreecommitdiff
path: root/mu4web/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'mu4web/main.py')
-rw-r--r--mu4web/main.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/mu4web/main.py b/mu4web/main.py
index 59f14c7..bbe58cb 100644
--- a/mu4web/main.py
+++ b/mu4web/main.py
@@ -505,7 +505,17 @@ def response_for(id: str, mail: EmailMessage) -> str:
'height': '300',
}))
elif at.get_content_type() == 'text/plain':
- body.append(('pre', at.get_content()))
+ items: list[HTML] = []
+ for line in at.get_content().split('\n'):
+ if m := re.match(r'^((> *)+)', line):
+ for depth, str in enumerate(re.findall('> *', m[1])):
+ items.append(('span', {'class': f'quote-marker quote-{depth % 5}'}, str))
+ items.append(line[m.end():])
+ items.append("\n")
+ else:
+ items.append(line)
+ items.append("\n")
+ body.append(('pre', items))
elif at.get_content_type() == 'application/octet-stream':
url = '/part?' + urlencode({'id': id, 'idx': idx})
body.append(('a', {'href': url,