This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new b64c542 [#8416] use regex library everywhere, particularly within
Markdown library that handles some of our markdown extensions
b64c542 is described below
commit b64c54209bb655d9886375ba5a63fc847c6e9285
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Mar 2 14:59:38 2022 -0500
[#8416] use regex library everywhere, particularly within Markdown library
that handles some of our markdown extensions
---
Allura/allura/lib/markdown_extensions.py | 2 +-
Allura/allura/tests/functional/test_site_admin.py | 2 +-
Allura/allura/tests/test_globals.py | 10 +++++-----
requirements.in | 1 +
requirements.txt | 4 ++++
5 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/Allura/allura/lib/markdown_extensions.py
b/Allura/allura/lib/markdown_extensions.py
index ba3fcf0..e576db4 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -47,7 +47,7 @@ SHORT_REF_RE = markdown.inlinepatterns.NOIMG + r'\[([^\]]+)\]'
# FORGE_LINK_RE copied from markdown pre 3.0's LINK_RE
# TODO: replace these with newer approach, see ForgeLinkPattern
-NOBRACKET = r'[^\]\[]{0,50}' # "*" changed to {0,50} for performance
mitigation
+NOBRACKET = r'[^\]\[]{0,100}' # "*" changed to {0,100} for performance
mitigation
BRK = (
r'\[(' +
(NOBRACKET + r'(\[')*6 +
diff --git a/Allura/allura/tests/functional/test_site_admin.py
b/Allura/allura/tests/functional/test_site_admin.py
index bd58ca7..f7eb9d2 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -136,7 +136,7 @@ class TestSiteAdmin(TestController):
r = self.app.get(
url, extra_environ=dict(username='*anonymous'), status=302)
r = self.app.get(url)
- assert 're.search' in r, r
+ assert 'regex.regex.search' in r, r
assert '<td>pattern</td>' in r, r
assert '<td>string</td>' in r, r
assert '<th class="second-column-headers side-header">flags</th>' in
r, r
diff --git a/Allura/allura/tests/test_globals.py
b/Allura/allura/tests/test_globals.py
index 47540c2..6163dff 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -647,11 +647,11 @@ def test_markdown_link_length_limits():
text = g.markdown.convert('See [this is 26 characters long](Home)')
assert 'href="/p/test/wiki-len/Home/">this is 26 characters long</a>'
in text, text # {0,12} fails {0,13} ok
- # breaking point, currently. Would be nice if this worked and made a
real link:
- char110long = '1234567890'*11
- text = g.markdown.convert(f'See [{char110long}](Home)')
- assert f'<span>[{char110long}]</span>(Home)' in text, text # current
limitation, not a link
- # assert f'href="/p/test/wiki-len/Home/">{char110long}</a>' in text,
text # ideal output
+ # limit, currently
+ charSuperLong = '1234567890'*21
+ text = g.markdown.convert(f'See [{charSuperLong}](Home)')
+ assert f'<span>[{charSuperLong}]</span>(Home)' in text, text #
current limitation, not a link
+ # assert f'href="/p/test/wiki-len/Home/">{charSuperLong}</a>' in text,
text # ideal output
@td.with_wiki
diff --git a/requirements.in b/requirements.in
index 6b8fc92..1546be7 100644
--- a/requirements.in
+++ b/requirements.in
@@ -38,6 +38,7 @@ python-magic
python-oembed
pytz
qrcode
+regex-as-re-globally
requests
requests-oauthlib
# for taskd proc name switching
diff --git a/requirements.txt b/requirements.txt
index ada000d..3ea8884 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -150,6 +150,10 @@ pytz==2021.3
# ming
qrcode==6.1
# via -r requirements.in
+regex==2022.3.2
+ # via regex-as-re-globally
+regex-as-re-globally==0.0.2
+ # via -r requirements.in
repoze.lru==0.7
# via turbogears2
requests==2.26.0