From 405573bb2d9f40f8eecca5b33a5180b0ee1080b7 Mon Sep 17 00:00:00 2001 From: miruka Date: Sun, 8 Sep 2019 10:48:58 -0400 Subject: [PATCH] Fix room subtitle quotes: second+ quote not green --- TODO.md | 1 + src/python/html_filter.py | 10 +++------- src/qml/SidePane/RoomDelegate.qml | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/TODO.md b/TODO.md index 1648b826..60d851b5 100644 --- a/TODO.md +++ b/TODO.md @@ -11,6 +11,7 @@ - When qml syntax highlighting supports ES6 string interpolation, use that - Fixes + - 256 min width when a non-image link preview is present - Pressing backspace in composer sometimes doesn't work - Message order isn't preserved when sending a first message in a E2E room, then while keys are being shared sending one with another account, diff --git a/src/python/html_filter.py b/src/python/html_filter.py index 72b24796..85dd4d4a 100644 --- a/src/python/html_filter.py +++ b/src/python/html_filter.py @@ -20,10 +20,11 @@ class HtmlFilter: r"(?Pmagnet:\?xt=urn:[a-z0-9]+:.+)(?P)", ]] - inline_quote_regex = re.compile(r"(^\s*>.*)") + inline_quote_regex = re.compile(r"(^\s*>.*)", re.MULTILINE) quote_regex = re.compile( r"(^|

|
|)(\s*>.*?)(|
||$)", + re.MULTILINE, ) @@ -58,9 +59,6 @@ class HtmlFilter: def filter_inline(self, html: str, outgoing: bool = False) -> str: text = self._inline_sanitizer.sanitize(html).strip("\n") - if outgoing: - return text - return self.inline_quote_regex.sub( r'\1', text, ) @@ -72,9 +70,7 @@ class HtmlFilter: if outgoing: return html - return self.quote_regex.sub( - r'\1\2\3', html, re.MULTILINE, - ) + return self.quote_regex.sub(r'\1\2\3', html) def sanitize_settings(self, inline: bool = False) -> dict: diff --git a/src/qml/SidePane/RoomDelegate.qml b/src/qml/SidePane/RoomDelegate.qml index 79f7806c..3a86b492 100644 --- a/src/qml/SidePane/RoomDelegate.qml +++ b/src/qml/SidePane/RoomDelegate.qml @@ -80,7 +80,7 @@ HTileDelegate { ) + ": " + ev.inline_content return text.replace( - /< *span +class=['"]?quote['"]? *>(.+)<\/ *span *>/, + /< *span +class=['"]?quote['"]? *>(.+)<\/ *span *>/g, '$1',