From 33786e9153dee7c85d2dd61816c6a0099e54667c Mon Sep 17 00:00:00 2001
From: Pierre-Yves Chibon
Date: Apr 04 2017 08:14:35 +0000
Subject: Make the strikethrough regex non-greedy and add a test for this
---
diff --git a/pagure/pfmarkdown.py b/pagure/pfmarkdown.py
index 4308587..4be6cb8 100644
--- a/pagure/pfmarkdown.py
+++ b/pagure/pfmarkdown.py
@@ -54,7 +54,7 @@ COMMIT_LINK_RE = r'(?\w#])([a-f0-9]{7,40})'
-STRIKE_THROUGH_RE = r'~~(.*)~~'
+STRIKE_THROUGH_RE = r'~~(.*?)~~'
class MentionPattern(markdown.inlinepatterns.Pattern):
diff --git a/tests/test_pagure_lib.py b/tests/test_pagure_lib.py
index 63ad1f6..4fa467f 100644
--- a/tests/test_pagure_lib.py
+++ b/tests/test_pagure_lib.py
@@ -3431,6 +3431,7 @@ class PagureLibtests(tests.Modeltests):
"during F26AH boot 'error_name=org.freedesktop.systemd1."
"NoSuchDynamicUser'~~",
'``~~foo bar~~``',
+ '~~foo bar~~ and ~~another ~~',
]
expected = [
# 'foo bar test#1 see?',
@@ -3498,6 +3499,8 @@ class PagureLibtests(tests.Modeltests):
"org.freedesktop.systemd1.NoSuchDynamicUser'
",
# '``~~foo bar~~``'
'~~foo bar~~
',
+ # '~~foo bar~~ and ~~another ~~',
+ 'foo bar and another
',
]
with pagure.APP.app_context():