Skip to content

Commit 9a19dbf

Browse files
authored
Ext: Write paths with forward slashes (#15)
1 parent 5682ba8 commit 9a19dbf

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

sphinxext/rediraffe.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
import subprocess
44
from os.path import relpath
5-
from pathlib import Path, PurePath, PureWindowsPath
5+
from pathlib import Path, PurePath, PureWindowsPath, PurePosixPath
66
from typing import Any, Dict, List, Union
77

88
from jinja2 import Environment, FileSystemLoader, Template
@@ -224,7 +224,13 @@ def build_redirects(app: Sphinx, exception: Union[Exception, None]) -> None:
224224
with build_redirect_from.open("w") as f:
225225
f.write(
226226
rediraffe_template.render(
227-
rel_url=relpath(build_redirect_to, build_redirect_from.parent),
227+
rel_url=str(
228+
PurePosixPath(
229+
PureWindowsPath(
230+
relpath(build_redirect_to, build_redirect_from.parent)
231+
)
232+
)
233+
),
228234
from_file=src_redirect_from,
229235
to_file=src_redirect_to,
230236
from_url=redirect_from,

0 commit comments

Comments
 (0)