Skip to content

Commit fd60d5b

Browse files
committed
Fixed issue with OS-specific paths in tags plugin
1 parent 753ce19 commit fd60d5b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

material/plugins/tags/plugin.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# IN THE SOFTWARE.
2020

2121
import logging
22+
import os
2223
import sys
2324

2425
from collections import defaultdict
@@ -109,9 +110,12 @@ def __render_tag_links(self, tag, pages):
109110
page.file.src_path,
110111
self.tags_file.src_path
111112
)
113+
114+
# Ensure forward slashes, as we have to use the path of the source
115+
# file which contains the operating system's path separator.
112116
content.append("- [{}]({})".format(
113117
page.meta.get("title", page.title),
114-
url
118+
url.replace(os.path.sep, "/")
115119
))
116120

117121
# Return rendered tag links

src/plugins/tags/plugin.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# IN THE SOFTWARE.
2020

2121
import logging
22+
import os
2223
import sys
2324

2425
from collections import defaultdict
@@ -109,9 +110,12 @@ def __render_tag_links(self, tag, pages):
109110
page.file.src_path,
110111
self.tags_file.src_path
111112
)
113+
114+
# Ensure forward slashes, as we have to use the path of the source
115+
# file which contains the operating system's path separator.
112116
content.append("- [{}]({})".format(
113117
page.meta.get("title", page.title),
114-
url
118+
url.replace(os.path.sep, "/")
115119
))
116120

117121
# Return rendered tag links

0 commit comments

Comments
 (0)