summaryrefslogtreecommitdiffstats
path: root/lib/python/web_support.py
diff options
context:
space:
mode:
authorHolger Levsen <holger@debian.org>2014-09-15 18:01:35 +0000
committerHolger Levsen <holger@debian.org>2014-09-15 18:01:35 +0000
commit53b2200e10c199317084bb581c886cb1ebdf8c7d (patch)
treee3d565e23d498c4a2fa95206312f35ddec336785 /lib/python/web_support.py
parent88617bc221cf738bec92300fd99009f040a13a89 (diff)
Show URLs in TODO/NOTE as hyperlinks in the web view. (Closes: #610220)
git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@28796 e39458fd-73e7-0310-bf30-c45bca0a0e42
Diffstat (limited to 'lib/python/web_support.py')
-rw-r--r--lib/python/web_support.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/python/web_support.py b/lib/python/web_support.py
index 72a4932660..f1663a33e9 100644
--- a/lib/python/web_support.py
+++ b/lib/python/web_support.py
@@ -453,12 +453,21 @@ def make_table(contents, caption=None, replacement=None, introduction=None):
def make_pre(lines):
"""Creates a pre-formatted text area."""
- r = []
- append = r.append
- for l in lines:
- append(l)
- append('\n')
- return tag('pre', ''.join(r))
+ pre = []
+ append = pre.append
+ for line in lines:
+ # turn https:// and http:// into links
+ results=re.search("(.*)(?P<url>https?://[^\s]+)(.*)", line)
+ if results:
+ for group in results.groups():
+ if group.startswith('http://') or group.startswith('https://'):
+ append(A(group))
+ else:
+ append(group)
+ else:
+ append(line)
+ append(BR())
+ return tag('pre', pre)
def make_menu(convert, *entries):
"""Creates an unnumbered list of hyperlinks.

© 2014-2024 Faster IT GmbH | imprint | privacy policy