From fd60d5bdae7ea957a0b359168b72183db357802b Mon Sep 17 00:00:00 2001 From: squidfunk Date: Sun, 1 May 2022 14:04:36 +0200 Subject: [PATCH] Fixed issue with OS-specific paths in tags plugin --- material/plugins/tags/plugin.py | 6 +++++- src/plugins/tags/plugin.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/material/plugins/tags/plugin.py b/material/plugins/tags/plugin.py index eb0f018f708..be9678e9352 100644 --- a/material/plugins/tags/plugin.py +++ b/material/plugins/tags/plugin.py @@ -19,6 +19,7 @@ # IN THE SOFTWARE. import logging +import os import sys from collections import defaultdict @@ -109,9 +110,12 @@ def __render_tag_links(self, tag, pages): page.file.src_path, self.tags_file.src_path ) + + # Ensure forward slashes, as we have to use the path of the source + # file which contains the operating system's path separator. content.append("- [{}]({})".format( page.meta.get("title", page.title), - url + url.replace(os.path.sep, "/") )) # Return rendered tag links diff --git a/src/plugins/tags/plugin.py b/src/plugins/tags/plugin.py index eb0f018f708..be9678e9352 100644 --- a/src/plugins/tags/plugin.py +++ b/src/plugins/tags/plugin.py @@ -19,6 +19,7 @@ # IN THE SOFTWARE. import logging +import os import sys from collections import defaultdict @@ -109,9 +110,12 @@ def __render_tag_links(self, tag, pages): page.file.src_path, self.tags_file.src_path ) + + # Ensure forward slashes, as we have to use the path of the source + # file which contains the operating system's path separator. content.append("- [{}]({})".format( page.meta.get("title", page.title), - url + url.replace(os.path.sep, "/") )) # Return rendered tag links