summaryrefslogtreecommitdiff
path: root/sphinx/domains/std.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2014-09-17 13:38:20 +0200
committerGeorg Brandl <georg@python.org>2014-09-17 13:38:20 +0200
commit4889ca9073e5e50ccc71edeeefd6e67cbfc3d023 (patch)
treeab62d89bf9658fb3f5485c6e5c7465ae844ef9ab /sphinx/domains/std.py
parentae5618e56edafcd859df7c20a424f93ecfb50180 (diff)
parent2182e1248b91d98f0048ccda8bbe446805982f1f (diff)
downloadsphinx-4889ca9073e5e50ccc71edeeefd6e67cbfc3d023.tar.gz
merge with stable
Diffstat (limited to 'sphinx/domains/std.py')
-rw-r--r--sphinx/domains/std.py28
1 files changed, 18 insertions, 10 deletions
diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
index 43341e42..bb044e30 100644
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -12,6 +12,7 @@
import re
import unicodedata
+from six import iteritems
from docutils import nodes
from docutils.parsers.rst import directives
from docutils.statemachine import ViewList
@@ -508,29 +509,29 @@ class StandardDomain(Domain):
}
def clear_doc(self, docname):
- for key, (fn, _) in self.data['progoptions'].items():
+ for key, (fn, _) in list(self.data['progoptions'].items()):
if fn == docname:
del self.data['progoptions'][key]
- for key, (fn, _) in self.data['objects'].items():
+ for key, (fn, _) in list(self.data['objects'].items()):
if fn == docname:
del self.data['objects'][key]
- for key, (fn, _, _) in self.data['labels'].items():
+ for key, (fn, _, _) in list(self.data['labels'].items()):
if fn == docname:
del self.data['labels'][key]
- for key, (fn, _) in self.data['anonlabels'].items():
+ for key, (fn, _) in list(self.data['anonlabels'].items()):
if fn == docname:
del self.data['anonlabels'][key]
def process_doc(self, env, docname, document):
labels, anonlabels = self.data['labels'], self.data['anonlabels']
- for name, explicit in document.nametypes.iteritems():
+ for name, explicit in iteritems(document.nametypes):
if not explicit:
continue
labelid = document.nameids[name]
if labelid is None:
continue
node = document.ids[labelid]
- if name.isdigit() or node.has_key('refuri') or \
+ if name.isdigit() or 'refuri' in node or \
node.tagname.startswith('desc_'):
# ignore footnote labels, labels automatically generated from a
# link and object descriptions
@@ -548,6 +549,13 @@ class StandardDomain(Domain):
break
else:
continue
+ elif node.tagname == 'image' and node.parent.tagname == 'figure':
+ for n in node.parent:
+ if n.tagname == 'caption':
+ sectname = clean_astext(n)
+ break
+ else:
+ continue
elif node.tagname == 'table':
for n in node:
if n.tagname == 'title':
@@ -621,16 +629,16 @@ class StandardDomain(Domain):
labelid, contnode)
def get_objects(self):
- for (prog, option), info in self.data['progoptions'].iteritems():
+ for (prog, option), info in iteritems(self.data['progoptions']):
yield (option, option, 'option', info[0], info[1], 1)
- for (type, name), info in self.data['objects'].iteritems():
+ for (type, name), info in iteritems(self.data['objects']):
yield (name, name, type, info[0], info[1],
self.object_types[type].attrs['searchprio'])
- for name, info in self.data['labels'].iteritems():
+ for name, info in iteritems(self.data['labels']):
yield (name, info[2], 'label', info[0], info[1], -1)
# add anonymous-only labels as well
non_anon_labels = set(self.data['labels'])
- for name, info in self.data['anonlabels'].iteritems():
+ for name, info in iteritems(self.data['anonlabels']):
if name not in non_anon_labels:
yield (name, name, 'label', info[0], info[1], -1)