aboutsummaryrefslogtreecommitdiffstats
path: root/slack
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-10-15 12:48:47 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commitcbef2d00b12ea4b72b382508ff9b044e96f44f4a (patch)
tree9a7123fee81421e00e48376294f5caadf3ee76a2 /slack
parenta184d156aba210a81f0e13a9016088431ed50882 (diff)
downloadwee-slack-cbef2d00b12ea4b72b382508ff9b044e96f44f4a.tar.gz
Apply code block styles first
It looks better to have the `` characters around the other styles when there's styling inside code blocks. It makes it look a bit worse when theres code blocks inside styled text though. It should really remember the order the styles are opened to close them in the correct order.
Diffstat (limited to 'slack')
-rw-r--r--slack/slack_message.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/slack/slack_message.py b/slack/slack_message.py
index 39d6e57..4301560 100644
--- a/slack/slack_message.py
+++ b/slack/slack_message.py
@@ -926,6 +926,11 @@ class SlackMessage:
characters_remove: List[str] = []
prev_style = prev_element.get("style", {})
cur_style = element.get("style", {})
+ if cur_style.get("code", False) != prev_style.get("code", False):
+ if cur_style.get("code"):
+ characters_apply.append("`")
+ else:
+ characters_remove.append("`")
if cur_style.get("bold", False) != prev_style.get("bold", False):
if cur_style.get("bold"):
colors_apply.append(weechat.color("bold"))
@@ -945,11 +950,6 @@ class SlackMessage:
characters_apply.append("~")
else:
characters_remove.append("~")
- if cur_style.get("code", False) != prev_style.get("code", False):
- if cur_style.get("code"):
- characters_apply.append("`")
- else:
- characters_remove.append("`")
prepend = "".join(
characters_remove[::-1]