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:
parent
39b4706c75
commit
986e39cdc2
1
TODO.md
1
TODO.md
|
@ -44,7 +44,6 @@
|
||||||
- When qml syntax highlighting supports ES6 string interpolation, use that
|
- When qml syntax highlighting supports ES6 string interpolation, use that
|
||||||
|
|
||||||
- Fixes
|
- Fixes
|
||||||
- Newlines and quote after newline in room subtitle
|
|
||||||
- Event delegates changing height don't scroll the list
|
- Event delegates changing height don't scroll the list
|
||||||
- When selecting text and scrolling up, selection stops working after a while
|
- When selecting text and scrolling up, selection stops working after a while
|
||||||
- Ensure all the text that should be copied is copied
|
- Ensure all the text that should be copied is copied
|
||||||
|
|
|
@ -42,7 +42,7 @@ class HtmlFilter:
|
||||||
r"(?P<body>magnet:\?xt=urn:[a-z0-9]+:.+)(?P<host>)",
|
r"(?P<body>magnet:\?xt=urn:[a-z0-9]+:.+)(?P<host>)",
|
||||||
]]
|
]]
|
||||||
|
|
||||||
inline_quote_regex = re.compile(r"(^\s*>.*)", re.MULTILINE)
|
inline_quote_regex = re.compile(r"(^|⏎)(\s*>[^⏎\n]*)", re.MULTILINE)
|
||||||
|
|
||||||
quote_regex = re.compile(
|
quote_regex = re.compile(
|
||||||
r"(^|<p/?>|<br/?>|<h\d/?>)(\s*>.*?)(</?p>|<br/?>|</?h\d>|$)",
|
r"(^|<p/?>|<br/?>|<h\d/?>)(\s*>.*?)(</?p>|<br/?>|</?h\d>|$)",
|
||||||
|
@ -90,7 +90,7 @@ class HtmlFilter:
|
||||||
|
|
||||||
# Client-side modifications
|
# Client-side modifications
|
||||||
return self.inline_quote_regex.sub(
|
return self.inline_quote_regex.sub(
|
||||||
r'<span class="quote">\1</span>', html,
|
r'\1<span class="quote">\2</span>', html,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ HTileDelegate {
|
||||||
) + ": " + ev.inline_content
|
) + ": " + ev.inline_content
|
||||||
|
|
||||||
return text.replace(
|
return text.replace(
|
||||||
/< *span +class=['"]?quote['"]? *>(.+)<\/ *span *>/g,
|
/< *span +class=['"]?quote['"]? *>(.+?)<\/ *span *>/g,
|
||||||
'<font color="' +
|
'<font color="' +
|
||||||
theme.sidePane.room.subtitleQuote +
|
theme.sidePane.room.subtitleQuote +
|
||||||
'">$1</font>',
|
'">$1</font>',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user