Fix quotes rendering in inline filtered html

Before:
a
>x
b
>z

This message would have been shown all gray in the client due to it not
beginning with a >. Now, the colors are properly shown for both quotes
and the non-quote text in between.
This commit is contained in:
miruka 2019-10-24 09:43:40 -04:00
parent 39b4706c75
commit 986e39cdc2
3 changed files with 3 additions and 4 deletions

View File

@ -44,7 +44,6 @@
- When qml syntax highlighting supports ES6 string interpolation, use that
- Fixes
- Newlines and quote after newline in room subtitle
- Event delegates changing height don't scroll the list
- When selecting text and scrolling up, selection stops working after a while
- Ensure all the text that should be copied is copied

View File

@ -42,7 +42,7 @@ class HtmlFilter:
r"(?P<body>magnet:\?xt=urn:[a-z0-9]+:.+)(?P<host>)",
]]
inline_quote_regex = re.compile(r"(^\s*&gt;.*)", re.MULTILINE)
inline_quote_regex = re.compile(r"(^|⏎)(\s*&gt;[^⏎\n]*)", re.MULTILINE)
quote_regex = re.compile(
r"(^|<p/?>|<br/?>|<h\d/?>)(\s*&gt;.*?)(</?p>|<br/?>|</?h\d>|$)",
@ -90,7 +90,7 @@ class HtmlFilter:
# Client-side modifications
return self.inline_quote_regex.sub(
r'<span class="quote">\1</span>', html,
r'\1<span class="quote">\2</span>', html,
)

View File

@ -80,7 +80,7 @@ HTileDelegate {
) + ": " + ev.inline_content
return text.replace(
/< *span +class=['"]?quote['"]? *>(.+)<\/ *span *>/g,
/< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g,
'<font color="' +
theme.sidePane.room.subtitleQuote +
'">$1</font>',