summaryrefslogtreecommitdiff
path: root/docutils
diff options
context:
space:
mode:
Diffstat (limited to 'docutils')
-rw-r--r--docutils/docutils/transforms/components.py2
-rw-r--r--docutils/docutils/transforms/misc.py2
-rw-r--r--docutils/docutils/transforms/parts.py2
-rw-r--r--docutils/docutils/transforms/peps.py6
-rw-r--r--docutils/docutils/transforms/references.py16
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html4
-rw-r--r--docutils/test/functional/expected/standalone_rst_pseudoxml.txt4
-rwxr-xr-xdocutils/test/test_transforms/test_footnotes.py4
-rwxr-xr-xdocutils/test/test_transforms/test_hyperlinks.py4
9 files changed, 22 insertions, 22 deletions
diff --git a/docutils/docutils/transforms/components.py b/docutils/docutils/transforms/components.py
index 8f4a267e1..a31f09fb5 100644
--- a/docutils/docutils/transforms/components.py
+++ b/docutils/docutils/transforms/components.py
@@ -49,6 +49,6 @@ class Filter(Transform):
format = pending.details['format']
component = self.document.transformer.components[component_type]
if component.supports(format):
- pending.parent.replace(pending, pending.details['nodes'])
+ pending.substitute(pending.details['nodes'])
else:
pending.parent.remove(pending)
diff --git a/docutils/docutils/transforms/misc.py b/docutils/docutils/transforms/misc.py
index fd8ba6b25..18446944d 100644
--- a/docutils/docutils/transforms/misc.py
+++ b/docutils/docutils/transforms/misc.py
@@ -66,7 +66,7 @@ class ClassAttribute(Transform):
% pending.details['directive'],
nodes.literal_block(pending.rawsource, pending.rawsource),
line=pending.line)
- pending.parent.replace(pending, error)
+ pending.substitute(error)
class Transitions(Transform):
diff --git a/docutils/docutils/transforms/parts.py b/docutils/docutils/transforms/parts.py
index ff6a0e550..b28c44c71 100644
--- a/docutils/docutils/transforms/parts.py
+++ b/docutils/docutils/transforms/parts.py
@@ -97,7 +97,7 @@ class Contents(Transform):
self.backlinks = self.document.settings.toc_backlinks
contents = self.build_contents(startnode)
if len(contents):
- self.startnode.parent.replace(self.startnode, contents)
+ self.startnode.substitute(contents)
else:
self.startnode.parent.parent.remove(self.startnode.parent)
diff --git a/docutils/docutils/transforms/peps.py b/docutils/docutils/transforms/peps.py
index 201ce314b..96c265207 100644
--- a/docutils/docutils/transforms/peps.py
+++ b/docutils/docutils/transforms/peps.py
@@ -107,11 +107,11 @@ class Headers(Transform):
if name == 'author':
for node in para:
if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node))
+ node.substitute(mask_email(node))
elif name == 'discussions-to':
for node in para:
if isinstance(node, nodes.reference):
- node.parent.replace(node, mask_email(node, pep))
+ node.substitute(mask_email(node, pep))
elif name in ('replaces', 'replaced-by', 'requires'):
newbody = []
space = nodes.Text(' ')
@@ -241,7 +241,7 @@ class PEPZeroSpecial(nodes.SparseNodeVisitor):
pass
def visit_reference(self, node):
- node.parent.replace(node, mask_email(node))
+ node.substitute(mask_email(node))
def visit_field_list(self, node):
if 'rfc2822' in node['classes']:
diff --git a/docutils/docutils/transforms/references.py b/docutils/docutils/transforms/references.py
index 7e75402ae..92ab1b529 100644
--- a/docutils/docutils/transforms/references.py
+++ b/docutils/docutils/transforms/references.py
@@ -127,7 +127,7 @@ class AnonymousHyperlinks(Transform):
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- ref.parent.replace(ref, prb)
+ ref.substitute(prb)
return
for ref, target in zip(self.document.anonymous_refs,
self.document.anonymous_targets):
@@ -281,7 +281,7 @@ class IndirectHyperlinks(Transform):
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- ref.parent.replace(ref, prb)
+ ref.substitute(prb)
target.resolved = 1
def resolve_indirect_references(self, target):
@@ -540,7 +540,7 @@ class Footnotes(Transform):
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- ref.parent.replace(ref, prb)
+ ref.substitute(prb)
break
ref += nodes.Text(label)
id = self.document.nameids[label]
@@ -580,7 +580,7 @@ class Footnotes(Transform):
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- ref.parent.replace(ref, prb)
+ ref.substitute(prb)
break
footnote = self.document.symbol_footnotes[i]
assert len(footnote['ids']) == 1
@@ -674,7 +674,7 @@ class Substitutions(Transform):
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- ref.parent.replace(ref, prb)
+ ref.substitute(prb)
else:
subdef = defs[key]
parent = ref.parent
@@ -691,7 +691,7 @@ class Substitutions(Transform):
and isinstance(parent[index + 1], nodes.Text)):
parent.replace(parent[index + 1],
parent[index + 1].lstrip())
- parent.replace(ref, subdef.children)
+ ref.substitute(subdef.children)
self.document.substitution_refs = None # release replaced references
@@ -732,7 +732,7 @@ class TargetNotes(Transform):
if not notes.has_key(target['refuri']):
notes[target['refuri']] = footnote
nodelist.append(footnote)
- self.startnode.parent.replace(self.startnode, nodelist)
+ self.startnode.substitute(nodelist)
def make_target_footnote(self, target, refs, notes):
refuri = target['refuri']
@@ -838,7 +838,7 @@ class DanglingReferencesVisitor(nodes.SparseNodeVisitor):
node.rawsource, node.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
- node.parent.replace(node, prb)
+ node.substitute(prb)
else:
del node['refname']
node['refid'] = id
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index 2093ab1bb..da34c5fee 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -479,7 +479,7 @@ Here's a reference to the next footnote: <a class="footnote-reference" href="#id
<colgroup><col class="label" /><col /></colgroup>
<tbody valign="top">
<tr><td class="label"><a name="id13">[4]</a></td><td>Here's an unreferenced footnote, with a reference to a
-nonexistent footnote: <a href="#id25" name="id26"><span class="problematic" id="id26">[5]_</span></a>.</td></tr>
+nonexistent footnote: <a href="#id25" name="id26"><span class="problematic" id="id26"><span id="id14"></span>[5]_</span></a>.</td></tr>
</tbody>
</table>
</div>
@@ -492,7 +492,7 @@ nonexistent footnote: <a href="#id25" name="id26"><span class="problematic" id="
rendered separately and differently from footnotes.</td></tr>
</tbody>
</table>
-<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id27" name="id28"><span class="problematic" id="id28">[nonexistent]_</span></a>
+<p>Here's a reference to the above, <a class="citation-reference" href="#cit2002" id="id15" name="id15">[CIT2002]</a>, and a <a href="#id27" name="id28"><span class="problematic" id="id28"><span id="id16"></span>[nonexistent]_</span></a>
citation.</p>
</div>
<div class="section">
diff --git a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
index c2af4aaa9..1e16812f1 100644
--- a/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
+++ b/docutils/test/functional/expected/standalone_rst_pseudoxml.txt
@@ -948,7 +948,7 @@
<paragraph>
Here's an unreferenced footnote, with a reference to a
nonexistent footnote:
- <problematic ids="id26" refid="id25">
+ <problematic ids="id26 id14" refid="id25">
[5]_
.
<section ids="citations" names="citations">
@@ -967,7 +967,7 @@
<citation_reference ids="id15" refid="cit2002">
CIT2002
, and a
- <problematic ids="id28" refid="id27">
+ <problematic ids="id28 id16" refid="id27">
[nonexistent]_
citation.
diff --git a/docutils/test/test_transforms/test_footnotes.py b/docutils/test/test_transforms/test_footnotes.py
index f0a1a2ed0..86cbd2110 100755
--- a/docutils/test/test_transforms/test_footnotes.py
+++ b/docutils/test/test_transforms/test_footnotes.py
@@ -182,7 +182,7 @@ Mixed anonymous and labelled auto-numbered footnotes:
<footnote_reference auto="1" ids="id3" refid="id8">
3
should be 3, \n\
- <problematic ids="id11" refid="id10">
+ <problematic ids="id11 id4" refid="id10">
[#]_
is one too many,
<footnote_reference auto="1" ids="id5" refid="two">
@@ -327,7 +327,7 @@ and labelled auto-numbered footnotes:
<footnote_reference auto="1" ids="id5" refid="id12">
6
should be 6, \n\
- <problematic ids="id15" refid="id14">
+ <problematic ids="id15 id6" refid="id14">
[#]_
is one too many,
<footnote_reference auto="1" ids="id7" refname="five">
diff --git a/docutils/test/test_transforms/test_hyperlinks.py b/docutils/test/test_transforms/test_hyperlinks.py
index 8d7d6a029..d060043cd 100755
--- a/docutils/test/test_transforms/test_hyperlinks.py
+++ b/docutils/test/test_transforms/test_hyperlinks.py
@@ -145,7 +145,7 @@ circular_ indirect reference
circular_
indirect reference
<target ids="circular" names="circular" refid="circular">
- <problematic ids="id3" refid="id1">
+ <problematic ids="id3 indirect" names="indirect" refid="id1">
.. _indirect: circular_
<system_message backrefs="id2 id3" ids="id1" level="3" line="3" source="test data" type="ERROR">
<paragraph>
@@ -787,7 +787,7 @@ Duplicate manual footnote labels, with reference ([1]_):
<document source="test data">
<paragraph>
Duplicate manual footnote labels, with reference (
- <problematic ids="id5" refid="id4">
+ <problematic ids="id5 id1" refid="id4">
[1]_
):
<footnote dupnames="1" ids="id2">