Workaround Qt's lack of support for HTML <hr>
When processing message HTML for the client from python, turn <hr> tags into <p>──────...</p> em dash lines
This commit is contained in:
parent
bcb9ffcf9d
commit
e601a378d8
|
@ -359,6 +359,7 @@ class HTMLProcessor:
|
||||||
],
|
],
|
||||||
"element_postprocessors": [
|
"element_postprocessors": [
|
||||||
self._font_color_to_span if outgoing else lambda el: el,
|
self._font_color_to_span if outgoing else lambda el: el,
|
||||||
|
self._hr_to_dashes if not outgoing else lambda el: el,
|
||||||
],
|
],
|
||||||
"is_mergeable": lambda e1, e2: e1.attrib == e2.attrib,
|
"is_mergeable": lambda e1, e2: e1.attrib == e2.attrib,
|
||||||
}
|
}
|
||||||
|
@ -555,4 +556,14 @@ class HTMLProcessor:
|
||||||
return el
|
return el
|
||||||
|
|
||||||
|
|
||||||
|
def _hr_to_dashes(self, el: HtmlElement) -> HtmlElement:
|
||||||
|
if el.tag != "hr":
|
||||||
|
return el
|
||||||
|
|
||||||
|
el.tag = "p"
|
||||||
|
el.attrib["class"] = "ruler"
|
||||||
|
el.text = "─" * 19
|
||||||
|
return el
|
||||||
|
|
||||||
|
|
||||||
HTML_PROCESSOR = HTMLProcessor()
|
HTML_PROCESSOR = HTMLProcessor()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user