aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-30 21:36:28 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-30 21:36:28 +0100
commit057829e5a7c99e6fe2ae933cc963c4664674315f (patch)
treed13f8b45084eb3b10bffe6b8437a2273c47acf54
parentFix some linter warnings. (diff)
downloadmu4web-master.tar.gz
mu4web-master.tar.xz
Highlight quotation marks depending on depth.HEADmaster
-rw-r--r--mu4web/main.py12
-rw-r--r--mu4web/static/style.css10
2 files changed, 21 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,
diff --git a/mu4web/static/style.css b/mu4web/static/style.css
index 75d4a28..0cba3af 100644
--- a/mu4web/static/style.css
+++ b/mu4web/static/style.css
@@ -135,3 +135,13 @@ table a {
display: inline-block;
max-width: calc(100vw/4);
}
+
+.quote-marker {
+ font-weight: bold;
+}
+
+.quote-0 { color: darkcyan; }
+.quote-1 { color: magenta; }
+.quote-2 { color: goldenrod; }
+.quote-3 { color: #00cc00; }
+.quote-4 { color: red; }