We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5410cc6 commit 4e11ce1Copy full SHA for 4e11ce1
1 file changed
yaml_to_html.py
@@ -6,12 +6,19 @@
6
7
import re
8
9
-URL_RE = re.compile(r'(https?://[^\s,;]+)')
+URL_RE = re.compile(r'\b((?:https?://|www\.)[^\s<>"\']+)', re.IGNORECASE)
10
+
11
12
def linkify_cell(value):
13
if not isinstance(value, str):
14
return value
- return URL_RE.sub(r'<a href="\1">\1</a>', value)
15
16
+ def repl(m):
17
+ url = m.group(1)
18
+ href = url if url.lower().startswith(("http://", "https://")) else f"https://{url}"
19
+ return f'<a href="{href}">{url}</a>'
20
21
+ return URL_RE.sub(repl, value)
22
23
yaml_file = "problems.yaml"
24
0 commit comments