]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/backend/wiki.py
wiki: Support absolute links
[ipfire.org.git] / 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):