diff options
author | David Vo <auscompgeek@users.noreply.github.com> | 2018-04-24 23:45:18 +1000 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2019-01-25 23:45:04 +0100 |
commit | 111d276e271c4defd296512f2f91ec36eb3a8c82 (patch) | |
tree | e680fc0c63abd30346332588cf33bb9ce2d26650 | |
parent | f2770cf16e0948e08521c881d811574261f50a51 (diff) | |
download | wee-slack-111d276e271c4defd296512f2f91ec36eb3a8c82.tar.gz |
Preserve formatting characters
This allows copy-pasting messages preserving their formatting,
and will help avoid characters going missing within backticks.
Ref: #566
-rw-r--r-- | wee_slack.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/wee_slack.py b/wee_slack.py index 2b0fc3d..cfcd3de 100644 --- a/wee_slack.py +++ b/wee_slack.py @@ -2852,11 +2852,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_]|$)', - r'\1{}\2{}\3'.format(w.color(config.render_bold_as), + 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_]|$)', - r'\1{}\2{}\3'.format(w.color(config.render_italic_as), + r'\1{}_\2_{}\3'.format(w.color(config.render_italic_as), w.color('-' + config.render_italic_as)), text) return text |