Automatic link detection

This commit is contained in:
Edgar P. Burkhart 2022-01-27 18:07:21 +01:00
parent 8b9ce75959
commit 0b42dd7d52
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 7 additions and 2 deletions

View file

@ -31,7 +31,12 @@ class Event:
@property @property
def description(self): def description(self):
return self._description if self._description is None: return None
return re.sub(
r'(https?://\S+)',
r'<a href="\1">\1</a>',
self._description,
)
@property @property
def location(self): def location(self):

View file

@ -50,7 +50,7 @@
<div class="info"> <div class="info">
<div class="description"> <div class="description">
{% if event.description %} {% if event.description %}
{{ event.description }} {{ event.description | safe }}
{% endif %} {% endif %}
</div> </div>
<div class="other"> <div class="other">