Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions snooty/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1349,7 +1349,7 @@ def _locate_text(text: str) -> int:
return doc

is_remote = root.startswith(("http://", "https://"))
if is_remote: # Remote mode (original mode): fetch from internet
if is_remote: # Remote mode (original mode): fetch from internet
url = urllib.parse.urljoin(root, argument_text)
try:
response = util.HTTPCache.singleton().get(url)
Expand All @@ -1359,11 +1359,13 @@ def _locate_text(text: str) -> int:
CannotOpenFile(Path(argument_text), str(err), node.get_line())
)
return doc
else: # File mode: treat sharedinclude_root as a filesystem directory
else: # File mode: treat sharedinclude_root as a filesystem directory
try:
# sharedinclude_root should be a relative path from the
# source directory of the project
file_path = self.project_config.source_path / Path(root) / argument_text
file_path = (
self.project_config.source_path / Path(root) / argument_text
)
content = file_path.read_text(encoding="utf-8")
except OSError as err:
self.diagnostics.append(
Expand Down