Closes #1358: Fix handling of image paths outside of the source directory when using the "wildcard" style reference.

This commit is contained in:
Georg Brandl 2014-01-23 10:24:58 +01:00
parent 216c664187
commit 4ab5d6eb52
4 changed files with 7 additions and 3 deletions

View File

@ -10,6 +10,8 @@ Bugs fixed
* PR#213: Fix a missing import in the setup command.
* #1357: Option names documented by :rst:dir:`option` are now again allowed to
not start with a dash or slash, and referencing them will work correctly.
* #1358: Fix handling of image paths outside of the source directory when using
the "wildcard" style reference.
Documentation
-------------

View File

@ -799,7 +799,8 @@ class BuildEnvironment:
node['uri'] = rel_imgpath
if rel_imgpath.endswith(os.extsep + '*'):
for filename in glob(full_imgpath):
new_imgpath = relative_path(self.srcdir, filename)
new_imgpath = relative_path(path.join(self.srcdir, 'dummy'),
filename)
if filename.lower().endswith('.pdf'):
candidates['application/pdf'] = new_imgpath
elif filename.lower().endswith('.svg'):

View File

@ -163,7 +163,8 @@ class Locale(Transform):
settings, source = self.document.settings, self.document['source']
# XXX check if this is reliable
assert source.startswith(env.srcdir)
docname = path.splitext(relative_path(env.srcdir, source))[0]
docname = path.splitext(relative_path(path.join(env.srcdir, 'dummy'),
source))[0]
textdomain = find_catalog(docname,
self.document.settings.gettext_compact)

View File

@ -142,7 +142,7 @@ def copy_static_entry(source, targetdir, builder, context={},
Handles all possible cases of files, directories and subdirectories.
"""
if exclude_matchers:
relpath = relative_path(builder.srcdir, source)
relpath = relative_path(path.join(builder.srcdir, 'dummy'), source)
for matcher in exclude_matchers:
if matcher(relpath):
return