diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-03-13 11:04:44 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-03-13 11:04:44 +0000 |
| commit | 42db2016c4b99839f278c8a72c34ba50eb890470 (patch) | |
| tree | e12417aef66e5afd842368ce8504227502293a72 /docutils/transforms/references.py | |
| parent | a73f41ba87e8d268e5eed1be73835ea6ddac9b7a (diff) | |
| download | docutils-42db2016c4b99839f278c8a72c34ba50eb890470.tar.gz | |
renamed SectionTargets.condition() to possible_relocation_target();
added docs;
if we add support for multiple ids and names, we might be able to merge
ChainedTargets and SectionTargets;
David, am I correct that the reST spec is missing chained external targets?
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3031 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/transforms/references.py')
| -rw-r--r-- | docutils/transforms/references.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/docutils/transforms/references.py b/docutils/transforms/references.py index fdebfb993..6290c5153 100644 --- a/docutils/transforms/references.py +++ b/docutils/transforms/references.py @@ -34,15 +34,17 @@ class SectionTargets(Transform): """Move "target" elements into the next title element if necessary.""" assert isinstance(target, nodes.target) # Find next node which is not a target. - n = target.next_node(condition=self.condition) + n = target.next_node(condition=self.possible_relocation_target) if isinstance(n, nodes.section): assert isinstance(n[0], nodes.title) target.parent.remove(target) n[0].insert(0, target) - # This function needs a better name (and possibly a docstring), describing - # what it does and hopefully why: - def condition(self, node): + def possible_relocation_target(self, node): + """Return true if a preceding target could be relocated into node.""" + # True if node is not an internal target. (If it's an + # external target, we've just run into a not-yet resolved + # chained external target.) return (not isinstance(node, nodes.target) or node.has_key('refid') or node.has_key('refuri') or node.has_key('refname')) |
