summaryrefslogtreecommitdiff
path: root/sphinx/directives.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-12-03 22:38:25 +0000
committerGeorg Brandl <georg@python.org>2007-12-03 22:38:25 +0000
commitcfa80454905adfae6f9fb9e52e3930f2c4f3cc43 (patch)
tree5bff8b89ed593e4e4b983a9aff1787df3f59f009 /sphinx/directives.py
parent4349b88f75ac7e19661f7e08999d43f0defaf607 (diff)
downloadsphinx-git-cfa80454905adfae6f9fb9e52e3930f2c4f3cc43.tar.gz
Apply Tim Golden's patch from #1520, which resolves confusion between
file paths and relative URIs so that building on Windows is flawlessly possible.
Diffstat (limited to 'sphinx/directives.py')
-rw-r--r--sphinx/directives.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/sphinx/directives.py b/sphinx/directives.py
index 5eaf49350..41625c377 100644
--- a/sphinx/directives.py
+++ b/sphinx/directives.py
@@ -19,6 +19,7 @@ from docutils.parsers.rst import directives, roles
from docutils.parsers.rst.directives import admonitions
from . import addnodes
+from .util import webify_filepath, unwebify_filepath
# ------ index markup --------------------------------------------------------------
@@ -554,7 +555,8 @@ def toctree_directive(name, arguments, options, content, lineno,
subnode = addnodes.toctree()
includefiles = filter(None, content)
# absolutize filenames
- includefiles = map(lambda x: path.normpath(path.join(dirname, x)), includefiles)
+ includefiles = [webify_filepath(path.normpath(path.join (dirname, x))) for x in includefiles]
+ #~ includefiles = map(lambda x: path.normpath(path.join(dirname, x)), includefiles)
subnode['includefiles'] = includefiles
subnode['maxdepth'] = options.get('maxdepth', -1)
return [subnode]
@@ -599,9 +601,9 @@ def literalinclude_directive(name, arguments, options, content, lineno,
return [state.document.reporter.warning('File insertion disabled', line=lineno)]
env = state.document.settings.env
fn = arguments[0]
- source_dir = path.dirname(path.abspath(state_machine.input_lines.source(
- lineno - state_machine.input_offset - 1)))
- fn = path.normpath(path.join(source_dir, fn))
+ source_dir = webify_filepath(path.dirname(path.abspath(state_machine.input_lines.source(
+ lineno - state_machine.input_offset - 1))))
+ fn = webify_filepath(path.normpath(path.join(source_dir, fn)))
try:
with open(fn) as f: