summaryrefslogtreecommitdiff
path: root/sphinx/builder.py
diff options
context:
space:
mode:
authorgeorg.brandl <devnull@localhost>2008-06-18 10:06:22 +0000
committergeorg.brandl <devnull@localhost>2008-06-18 10:06:22 +0000
commitd781ecabdda1cc9654c58e47432f47264c91f248 (patch)
tree69d47af07bea18e46212581ff8a611f42b06e57f /sphinx/builder.py
parent1ed9392fd2889ffc0daa9e2e24f6ffa984bdb173 (diff)
downloadsphinx-d781ecabdda1cc9654c58e47432f47264c91f248.tar.gz
Fix image handling.
Diffstat (limited to 'sphinx/builder.py')
-rw-r--r--sphinx/builder.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/sphinx/builder.py b/sphinx/builder.py
index 4c9a35a1..8ee11edd 100644
--- a/sphinx/builder.py
+++ b/sphinx/builder.py
@@ -128,20 +128,19 @@ class Builder(object):
Pick the best candidate for all image URIs.
"""
for node in doctree.traverse(nodes.image):
- uri = node['candidates'].get('*', None)
- if not uri:
+ if '*' not in node['candidates']:
for imgtype in self.supported_image_types:
- uri = node['candidates'].get(imgtype, None)
- if uri:
- node['uri'] = uri
+ candidate = node['candidates'].get(imgtype, None)
+ if candidate:
break
else:
- self.warn('%s:%s: %s' %
- (node.source, node.lineno,
- 'No matching candidate for uri: %(uri)s' % node))
+ self.warn('%s:%s: no matching candidate for image URI %r' %
+ (node.source, node.lineno, node['uri']))
continue
- if uri in self.env.images:
- self.images[uri] = self.env.images[uri][1]
+ node['uri'] = candidate
+ else:
+ candidate = node['uri']
+ self.images[candidate] = self.env.images[candidate][1]
# build methods