Fixed issue with OS-specific paths in tags plugin

This commit is contained in:
squidfunk 2022-05-01 14:04:36 +02:00
parent 753ce19bc6
commit fd60d5bdae
2 changed files with 10 additions and 2 deletions

View File

@ -19,6 +19,7 @@
# IN THE SOFTWARE. # IN THE SOFTWARE.
import logging import logging
import os
import sys import sys
from collections import defaultdict from collections import defaultdict
@ -109,9 +110,12 @@ class TagsPlugin(BasePlugin):
page.file.src_path, page.file.src_path,
self.tags_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( content.append("- [{}]({})".format(
page.meta.get("title", page.title), page.meta.get("title", page.title),
url url.replace(os.path.sep, "/")
)) ))
# Return rendered tag links # Return rendered tag links

View File

@ -19,6 +19,7 @@
# IN THE SOFTWARE. # IN THE SOFTWARE.
import logging import logging
import os
import sys import sys
from collections import defaultdict from collections import defaultdict
@ -109,9 +110,12 @@ class TagsPlugin(BasePlugin):
page.file.src_path, page.file.src_path,
self.tags_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( content.append("- [{}]({})".format(
page.meta.get("title", page.title), page.meta.get("title", page.title),
url url.replace(os.path.sep, "/")
)) ))
# Return rendered tag links # Return rendered tag links