mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
support srearch template with extended-length path
some template file contains forward slash in the path, which is not supported by the extended path on windows. see also: - https://github.com/bazelbuild/rules_python/issues/680 - https://stackoverflow.com/questions/21194530/what-does-mean-when-prepended-to-a-file-path
This commit is contained in:
parent
068f802df9
commit
eb488031ba
@ -1,6 +1,7 @@
|
|||||||
"""Glue code for the jinja2 templating engine."""
|
"""Glue code for the jinja2 templating engine."""
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
|
import os
|
||||||
from pprint import pformat
|
from pprint import pformat
|
||||||
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Tuple, Union
|
from typing import TYPE_CHECKING, Any, Callable, Dict, Iterator, List, Tuple, Union
|
||||||
|
|
||||||
@ -117,6 +118,9 @@ class SphinxFileSystemLoader(FileSystemLoader):
|
|||||||
def get_source(self, environment: Environment, template: str) -> Tuple[str, str, Callable]:
|
def get_source(self, environment: Environment, template: str) -> Tuple[str, str, Callable]:
|
||||||
for searchpath in self.searchpath:
|
for searchpath in self.searchpath:
|
||||||
filename = path.join(searchpath, template)
|
filename = path.join(searchpath, template)
|
||||||
|
# Repalce '/' by os.sep if The searchpath is an extended-length path.
|
||||||
|
if filename.startswith("\\\\?\\"):
|
||||||
|
filename = filename.replace('/', os.sep)
|
||||||
f = open_if_exists(filename)
|
f = open_if_exists(filename)
|
||||||
if f is None:
|
if f is None:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user