def _render_wiki_link(self, m):
path, alias = m.groups()
- # Allow relative links
- if not path.startswith("/"):
+ # Nothing to do for absolute links
+ if path.startswith("/"):
+ pass
+
+ # Relative links (one-level down)
+ elif path.startswith("./"):
path = os.path.join(self.path, path)
+ # All other relative links
+ else:
+ p = os.path.dirname(self.path)
+ path = os.path.join(p, path)
+
# Normalise links
path = os.path.normpath(path)