]> git.ipfire.org Git - ipfire.org.git/commitdiff
wiki: Support absolute links
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 24 Mar 2024 09:02:21 +0000 (09:02 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 24 Mar 2024 09:02:21 +0000 (09:02 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/wiki.py

index 21d3bceb47d79b56753f163fdd26a338e7040916..b0c9ec9071c0d650b300364791b4154eee499f86 100644 (file)
@@ -813,6 +813,14 @@ class WikiRenderer(misc.Object):
        def _render_link(self, m):
                url, text = m.groups()
 
+               # Treat linkes starting with a double slash as absolute
+               if url.startswith("//"):
+                       # Remove the double-lash
+                       url = url.removeprefix("/")
+
+                       # Return a link
+                       return """<a href="%s">%s</a>""" % (url, text or url)
+
                # External Links
                for schema in self.schemas:
                        if url.startswith(schema):