diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-09 15:56:30 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-10-09 16:02:05 +0100 |
commit | ed0134dbe552281278b5d6f0864c6a7d7fae32e0 (patch) | |
tree | 221997fec7066b2f15cddaa77ceec68b3dbcd60b | |
parent | dc82fba1885cdfdb830b56690aad2c9fae45daf4 (diff) |
-rw-r--r-- | src/message.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/message.py b/src/message.py index e61957d..128dbed 100644 --- a/src/message.py +++ b/src/message.py @@ -20,7 +20,7 @@ from gi.repository import Adw, Gtk, GLib, Pango import re -re_url_exp = r"(\S+://[A-Za-z0-9_.\-~/@]+)" +re_url_exp = r"([A-Za-z0-9_.\-~/@]+://[A-Za-z0-9_.\-~/@?=&%#]+)" re_url = re.compile(re_url_exp) @Gtk.Template(resource_path='/com/fryzekconcepts/weegtk/gtk/message.ui') @@ -46,7 +46,8 @@ class WeegtkMessage(Gtk.Box): res_span = res.span() escaped = message[pos:res_span[0]] link = res.group() - result = GLib.markup_escape_text(escaped) + f"<a href=\"{link}\">{link}</a>" + marked_url = GLib.markup_escape_text(link) + result = GLib.markup_escape_text(escaped) + f"<a href=\"{marked_url}\">{marked_url}</a>" return result + self.parse_message(message, res_span[1]) else: return GLib.markup_escape_text(message[pos:]) |