make links clickable in task descriptions

This commit is contained in:
2023-03-22 21:59:09 -04:00
parent 437c093adf
commit a58cc0ffcb
4 changed files with 37 additions and 6 deletions

View File

@@ -12,7 +12,17 @@
</a>
<b>
{% if task.description != None %}
{{ task.description }}
{% set description = task.description %}
{% set url_regex = '(https?://[^\s]+)' %}
{% set match = re.search(url_regex, description) %}
{% if match %}
{% set url = match.group(0) %}
{% set rest = description[match.end(0):] %}
<p>{{ description[:match.start(0)] }}<a href="{{ url }}">{{ url }}</a>{{ rest }}</p>
{% else %}
<p>{{ description }}</p>
{% endif %}
{% endif %}
</b>
<div>