control: tags -1 + pending Hi, see attached. This version also deals with several URLs in one note :) It also works for all three recent examples of Salvatore. cheers, Holger
From 7b4ea6cc46ffc1a507d94c2a13ef3c27e3123031 Mon Sep 17 00:00:00 2001 From: Holger Levsen <holger@layer-acht.org> Date: Sat, 13 Sep 2014 00:56:17 +0200 Subject: [PATCH 1/8] Show URLs in TODO/NOTE as hyperlinks in the web view. (Closes: #610220) --- lib/python/web_support.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/python/web_support.py b/lib/python/web_support.py index 72a4932..f1663a3 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. -- 1.9.1
Attachment:
signature.asc
Description: This is a digitally signed message part.