Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Münchbach <182-FlorianMuenchbach@users.noreply.dev.gajim.org>2019-02-19 10:29:28 +0300
committerFlorian Münchbach <182-FlorianMuenchbach@users.noreply.dev.gajim.org>2019-02-19 10:29:28 +0300
commit908ee5e4ab4f5c8824d048fd81751cd9d61a3595 (patch)
tree6bdb29b8ab66a1586e637ab9f98aff2987bad7ac
parente419bfc1fe519aea71e790b4d80e65db2288e5c3 (diff)
[syntax_highlight] More strict checking for multi-line code blocks
-rw-r--r--syntax_highlight/chat_syntax_highlighter.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/syntax_highlight/chat_syntax_highlighter.py b/syntax_highlight/chat_syntax_highlighter.py
index ccecead..25645ff 100644
--- a/syntax_highlight/chat_syntax_highlighter.py
+++ b/syntax_highlight/chat_syntax_highlighter.py
@@ -71,7 +71,8 @@ class ChatSyntaxHighlighter:
def find_multiline_matches(self, text):
start = None
matches = []
- for i in re.finditer(r'\n?```(?:\S*\n)?', text, re.DOTALL):
+ #Less strict, allow prefixed whitespaces: for i in re.finditer(r'(?:^|\n)[ |\t]*(```)\S*[ |\t]*(?:\n|$)', text, re.DOTALL):
+ for i in re.finditer(r'(?:^|\n)(```)\S*(?:\n|$)', text, re.DOTALL):
if start is None:
start = i
elif re.match(r'^\n```', i.group(0)) is not None: