aboutsummaryrefslogtreecommitdiffstats
path: root/wee_slack.py
diff options
context:
space:
mode:
authorDavid Vo <auscompgeek@users.noreply.github.com>2018-04-24 23:49:16 +1000
committerTrygve Aaberge <trygveaa@gmail.com>2019-01-25 23:45:04 +0100
commit7691c97b9bc1a66b2aa3d037c506c0f090a40ac9 (patch)
treea374bbaf9a64cb7bddbc824e892314119b0ce849 /wee_slack.py
parent111d276e271c4defd296512f2f91ec36eb3a8c82 (diff)
downloadwee-slack-7691c97b9bc1a66b2aa3d037c506c0f090a40ac9.tar.gz
Avoid formatting matching into code spans/blocks
This won't stop formatting within backticks, but will avoid applying bold formatting to a message like this: * Run this find command: `find . -name '*.exe'` Ref: #566
Diffstat (limited to 'wee_slack.py')
-rw-r--r--wee_slack.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py
index cfcd3de..d088da0 100644
--- a/wee_slack.py
+++ b/wee_slack.py
@@ -2851,11 +2851,11 @@ def process_emoji_changed(message_json, eventrouter, **kwargs):
###### New module/global methods
def render_formatting(text):
- text = re.sub(r'(^| )\*([^*\n]+)\*([^a-zA-Z0-9_]|$)',
+ text = re.sub(r'(^| )\*([^*\n`]+)\*([^a-zA-Z0-9_]|$)',
r'\1{}*\2*{}\3'.format(w.color(config.render_bold_as),
w.color('-' + config.render_bold_as)),
text)
- text = re.sub(r'(^| )_([^_\n]+)_([^a-zA-Z0-9_]|$)',
+ text = re.sub(r'(^| )_([^_\n`]+)_([^a-zA-Z0-9_]|$)',
r'\1{}_\2_{}\3'.format(w.color(config.render_italic_as),
w.color('-' + config.render_italic_as)),
text)