summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docutils/BUGS.txt24
-rw-r--r--docutils/docs/dev/rst/alternatives.txt8
-rw-r--r--docutils/docs/ref/doctree.txt44
-rw-r--r--docutils/docs/ref/transforms.txt4
-rw-r--r--docutils/docutils/nodes.py116
-rw-r--r--docutils/docutils/parsers/rst/directives/images.py4
-rw-r--r--docutils/docutils/parsers/rst/directives/misc.py3
-rw-r--r--docutils/docutils/parsers/rst/directives/parts.py4
-rw-r--r--docutils/docutils/parsers/rst/roles.py18
-rw-r--r--docutils/docutils/parsers/rst/states.py19
-rw-r--r--docutils/docutils/readers/pep.py3
-rw-r--r--docutils/docutils/readers/standalone.py3
-rw-r--r--docutils/docutils/transforms/frontmatter.py10
-rw-r--r--docutils/docutils/transforms/parts.py6
-rw-r--r--docutils/docutils/transforms/peps.py12
-rw-r--r--docutils/docutils/transforms/references.py442
-rw-r--r--docutils/docutils/transforms/universal.py19
-rw-r--r--docutils/docutils/writers/html4css1.py89
-rw-r--r--docutils/docutils/writers/latex2e.py35
-rw-r--r--docutils/docutils/writers/pep_html.py2
-rw-r--r--docutils/test/functional/expected/standalone_rst_html4css1.html8
-rw-r--r--docutils/test/functional/expected/standalone_rst_latex.tex2
-rwxr-xr-xdocutils/test/test_nodes.py23
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_citations.py16
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_definition_lists.py44
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_admonitions.py6
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_contents.py14
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_include.py22
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_line_blocks.py4
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_replace.py12
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_role.py32
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_tables.py10
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_directives/test_unicode.py18
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_field_lists.py4
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_footnotes.py96
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_inline_markup.py82
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_interpreted.py32
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_line_blocks.py16
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_section_headers.py74
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_substitutions.py30
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_targets.py94
-rwxr-xr-xdocutils/test/test_parsers/test_rst/test_transitions.py18
-rwxr-xr-xdocutils/test/test_readers/test_pep/test_inline_markup.py6
-rwxr-xr-xdocutils/test/test_readers/test_pep/test_rfc2822.py18
-rwxr-xr-xdocutils/test/test_transforms/test_class.py16
-rwxr-xr-xdocutils/test/test_transforms/test_contents.py92
-rwxr-xr-xdocutils/test/test_transforms/test_docinfo.py4
-rwxr-xr-xdocutils/test/test_transforms/test_doctitle.py26
-rwxr-xr-xdocutils/test/test_transforms/test_final_checks.py28
-rwxr-xr-xdocutils/test/test_transforms/test_footnotes.py162
-rwxr-xr-xdocutils/test/test_transforms/test_hyperlinks.py315
-rwxr-xr-xdocutils/test/test_transforms/test_messages.py6
-rwxr-xr-xdocutils/test/test_transforms/test_peps.py8
-rwxr-xr-xdocutils/test/test_transforms/test_sectnum.py116
-rwxr-xr-xdocutils/test/test_transforms/test_substitutions.py28
-rwxr-xr-xdocutils/test/test_writers/test_docutils_xml.py8
-rwxr-xr-xdocutils/test/test_writers/test_pseudoxml.py4
57 files changed, 1268 insertions, 1091 deletions
diff --git a/docutils/BUGS.txt b/docutils/BUGS.txt
index b1e6dbb5c..2f036d24b 100644
--- a/docutils/BUGS.txt
+++ b/docutils/BUGS.txt
@@ -189,34 +189,34 @@ Also see the `SourceForge Bug Tracker`_.
> EOF
<document source="<stdin>">
<paragraph>
- ref
- <footnote_reference auto="1" id="id1" refid="abc">
+ ref
+ <footnote_reference auto="1" ids="id1" refid="abc">
2
-
- <footnote_reference auto="1" id="id2" refid="id5">
+
+ <footnote_reference auto="1" ids="id2" refid="id5">
3
-
- <footnote_reference id="id3" refid="id6">
+
+ <footnote_reference ids="id3" refid="id6">
1
-
- <footnote_reference auto="1" id="id4" refid="id7">
+
+ <footnote_reference auto="1" ids="id4" refid="id7">
5
- <footnote auto="1" backrefs="id1" id="abc" name="abc">
+ <footnote auto="1" backrefs="id1" ids="abc" names="abc">
<label>
2
<paragraph>
footnote
- <footnote auto="1" backrefs="id2" id="id5" name="3">
+ <footnote auto="1" backrefs="id2" ids="id5" names="3">
<label>
3
<paragraph>
two
- <footnote backrefs="id3" id="id6" name="1">
+ <footnote backrefs="id3" ids="id6" names="1">
<label>
1
<paragraph>
one
- <footnote auto="1" backrefs="id4" id="id7" name="4">
+ <footnote auto="1" backrefs="id4" ids="id7" names="4">
<label>
5
<paragraph>
diff --git a/docutils/docs/dev/rst/alternatives.txt b/docutils/docs/dev/rst/alternatives.txt
index 25732189f..08c94bbbb 100644
--- a/docutils/docs/dev/rst/alternatives.txt
+++ b/docutils/docs/dev/rst/alternatives.txt
@@ -1165,7 +1165,7 @@ start of a new "division". Before implementation, the parsed document
tree would be::
<document>
- <section name="document">
+ <section names="document">
<title>
Document
<paragraph>
@@ -1181,7 +1181,7 @@ There are several possibilities for the implementation:
try at an implementation looked like this::
<document>
- <section name="document">
+ <section names="document">
<title>
Document
<paragraph>
@@ -1199,7 +1199,7 @@ There are several possibilities for the implementation:
possibility::
<document>
- <section name="document">
+ <section names="document">
<title>
Document
<division>
@@ -1220,7 +1220,7 @@ There are several possibilities for the implementation:
3. Implement them as "transitions", empty elements::
<document>
- <section name="document">
+ <section names="document">
<title>
Document
<paragraph>
diff --git a/docutils/docs/ref/doctree.txt b/docutils/docs/ref/doctree.txt
index 43ce91d33..dc19bdff3 100644
--- a/docutils/docs/ref/doctree.txt
+++ b/docutils/docs/ref/doctree.txt
@@ -264,7 +264,7 @@ following subsections:
- Real XML::
<document>
- <section id="a-title" name="a title">
+ <section ids="a-title" names="a title">
<title>A Title</title>
<paragraph>A paragraph.</paragraph>
</section>
@@ -273,7 +273,7 @@ following subsections:
- Pseudo-XML::
<document>
- <section id="a-title" name="a title">
+ <section ids="a-title" names="a title">
<title>
A Title
<paragraph>
@@ -359,7 +359,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -559,7 +559,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -625,7 +625,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -1016,7 +1016,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -1082,7 +1082,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -1210,7 +1210,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -1617,7 +1617,7 @@ into a ``docinfo`` element and its children by a transform. Source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="docinfo-example" name="docinfo example">
+ <document ids="docinfo-example" names="docinfo example">
<title>
Docinfo Example
<docinfo>
@@ -1794,7 +1794,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result from simple parsing::
<document>
- <section id="a-title" name="a title">
+ <section ids="a-title" names="a title">
<title>
A Title
<paragraph>
@@ -1803,7 +1803,7 @@ Complete pseudo-XML_ result from simple parsing::
After applying transforms, the section title is promoted to become the
document title::
- <document id="a-title" name="a title">
+ <document ids="a-title" names="a title">
<title>
A Title
<paragraph>
@@ -3221,7 +3221,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -3371,7 +3371,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -3479,22 +3479,22 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing::
<document>
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title>
Title 4
<paragraph>
@@ -3638,7 +3638,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
@@ -3728,10 +3728,10 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="title" name="title">
+ <document ids="title" names="title">
<title>
Title
- <subtitle id="subtitle" name="subtitle">
+ <subtitle ids="subtitle" names="subtitle">
Subtitle
<paragraph>
A paragraph.
@@ -3946,7 +3946,7 @@ reStructuredText_ source::
Pseudo-XML_ fragment from simple parsing::
- <section id="a-title" name="a title">
+ <section ids="a-title" names="a title">
<title>
A Title
<paragraph>
@@ -4170,7 +4170,7 @@ reStructuredText_ source::
Complete pseudo-XML_ result after parsing and applying transforms::
- <document id="document-title" name="document title">
+ <document ids="document-title" names="document title">
<title>
Document Title
<docinfo>
diff --git a/docutils/docs/ref/transforms.txt b/docutils/docs/ref/transforms.txt
index db4d3c426..9e4687a72 100644
--- a/docutils/docs/ref/transforms.txt
+++ b/docutils/docs/ref/transforms.txt
@@ -28,7 +28,7 @@ misc.class "class" (d/p) 210
references.Substitutions standalone (r), pep (r) 220
-references.SectionTargets standalone (r), pep (r) 260
+references.PropagateTargets standalone (r), pep (r) 260
frontmatter.DocTitle standalone (r) 320
@@ -38,8 +38,6 @@ peps.Headers pep (r) 360
peps.Contents pep (r) 380
-references.ChainedTargets standalone (r), pep (r) 420
-
references.AnonymousHyperlinks standalone (r), pep (r) 440
references.IndirectHyperlinks standalone (r), pep (r) 460
diff --git a/docutils/docutils/nodes.py b/docutils/docutils/nodes.py
index 1ff84de1f..2fb111427 100644
--- a/docutils/docutils/nodes.py
+++ b/docutils/docutils/nodes.py
@@ -27,6 +27,7 @@ import sys
import os
import re
import xml.dom.minidom
+from copy import deepcopy
from types import IntType, SliceType, StringType, UnicodeType, \
TupleType, ListType
from UserString import UserString
@@ -326,6 +327,10 @@ class Element(Node):
This is equivalent to ``element.extend([node1, node2])``.
"""
+ attr_defaults = {'ids': [], 'classes': [], 'names': [], 'dupnames': []}
+ """Default attributes. ``attributes`` is initialized with a copy
+ of ``attr_defaults``."""
+
tagname = None
"""The element generic identifier. If None, it is set as an instance
attribute to the name of the class."""
@@ -342,7 +347,7 @@ class Element(Node):
self.extend(children) # maintain parent info
- self.attributes = {}
+ self.attributes = deepcopy(self.attr_defaults)
"""Dictionary of attribute {name: value}."""
for att, value in attributes.items():
@@ -353,7 +358,7 @@ class Element(Node):
def _dom_node(self, domroot):
element = domroot.createElement(self.tagname)
- for attribute, value in self.attributes.items():
+ for attribute, value in self.attlist():
if isinstance(value, ListType):
value = ' '.join(['%s' % v for v in value])
element.setAttribute(attribute, '%s' % value)
@@ -368,16 +373,16 @@ class Element(Node):
if len(data) > 60:
data = data[:56] + ' ...'
break
- if self.hasattr('name'):
+ if self['names']:
return '<%s "%s": %s>' % (self.__class__.__name__,
- self.attributes['name'], data)
+ '; '.join(self['names']), data)
else:
return '<%s: %s>' % (self.__class__.__name__, data)
def shortrepr(self):
- if self.hasattr('name'):
+ if self['names']:
return '<%s "%s"...>' % (self.__class__.__name__,
- self.attributes['name'])
+ '; '.join(self['names']))
else:
return '<%s...>' % self.tagname
@@ -472,8 +477,15 @@ class Element(Node):
return self.child_text_separator.join(
[child.astext() for child in self.children])
+ def non_default_attributes(self):
+ atts = {}
+ for key, value in self.attributes.items():
+ if self.is_not_default(key):
+ atts[key] = value
+ return atts
+
def attlist(self):
- attlist = self.attributes.items()
+ attlist = self.non_default_attributes().items()
attlist.sort()
return attlist
@@ -516,6 +528,12 @@ class Element(Node):
def index(self, item):
return self.children.index(item)
+ def is_not_default(self, key):
+ try:
+ return self[key] != self.attr_defaults[key]
+ except KeyError:
+ return 1
+
def clear(self):
self.children = []
@@ -579,8 +597,24 @@ class Element(Node):
def set_class(self, name):
"""Add a new name to the "class" attribute."""
- self.attributes['class'] = (self.attributes.get('class', '') + ' '
- + name.lower()).strip()
+ self['classes'].append(name.lower())
+
+ def note_referenced_by(self, name=None, id=None):
+ """Note that this Element has been referenced by its name
+ `name` or id `id`."""
+ self.referenced = 1
+ # Element.expect_referenced_by_* dictionaries map names or ids
+ # to nodes whose ``referenced`` attribute is set to true as
+ # soon as this node is referenced by the given name or id.
+ # Needed for target propagation.
+ by_name = getattr(self, 'expect_referenced_by_name', {}).get(name)
+ by_id = getattr(self, 'expect_referenced_by_id', {}).get(id)
+ if by_name:
+ assert name is not None
+ by_name.referenced = 1
+ if by_id:
+ assert id is not None
+ by_id.referenced = 1
class TextElement(Element):
@@ -630,8 +664,11 @@ class Resolvable:
class BackLinkable:
+ attr_defaults = Element.attr_defaults.copy()
+ attr_defaults['backrefs'] = []
+
def add_backref(self, refid):
- self.setdefault('backrefs', []).append(refid)
+ self['backrefs'].append(refid)
# ====================
@@ -678,9 +715,6 @@ class Targetable(Resolvable):
referenced = 0
- indirect_reference_name = None
- """Holds the whitespace_normalized_name (contains mixed case) of a target"""
-
class Labeled:
"""Contains a `label` as its first element."""
@@ -800,21 +834,22 @@ class document(Root, Structural, Element):
return domroot
def set_id(self, node, msgnode=None):
- if node.has_key('id'):
- id = node['id']
+ for id in node['ids']:
if self.ids.has_key(id) and self.ids[id] is not node:
msg = self.reporter.severe('Duplicate ID: "%s".' % id)
if msgnode != None:
msgnode += msg
- else:
- if node.has_key('name'):
- id = make_id(node['name'])
+ if not node['ids']:
+ for name in node['names']:
+ id = make_id(name)
+ if id and not self.ids.has_key(id):
+ break
else:
id = ''
- while not id or self.ids.has_key(id):
- id = 'id%s' % self.id_start
- self.id_start += 1
- node['id'] = id
+ while not id or self.ids.has_key(id):
+ id = 'id%s' % self.id_start
+ self.id_start += 1
+ node['ids'].append(id)
self.ids[id] = node
return id
@@ -849,8 +884,7 @@ class document(Root, Structural, Element):
both old and new targets are external and refer to identical URIs.
The new target is invalidated regardless.
"""
- if node.has_key('name'):
- name = node['name']
+ for name in node['names']:
if self.nameids.has_key(name):
self.set_duplicate_name_id(node, id, name, msgnode, explicit)
else:
@@ -868,30 +902,30 @@ class document(Root, Structural, Element):
old_node = self.ids[old_id]
if node.has_key('refuri'):
refuri = node['refuri']
- if old_node.has_key('name') \
+ if old_node['names'] \
and old_node.has_key('refuri') \
and old_node['refuri'] == refuri:
level = 1 # just inform if refuri's identical
if level > 1:
- dupname(old_node)
+ dupname(old_node, name)
self.nameids[name] = None
msg = self.reporter.system_message(
level, 'Duplicate explicit target name: "%s".' % name,
backrefs=[id], base_node=node)
if msgnode != None:
msgnode += msg
- dupname(node)
+ dupname(node, name)
else:
self.nameids[name] = id
if old_id is not None:
old_node = self.ids[old_id]
- dupname(old_node)
+ dupname(old_node, name)
else:
if old_id is not None and not old_explicit:
self.nameids[name] = None
old_node = self.ids[old_id]
- dupname(old_node)
- dupname(node)
+ dupname(old_node, name)
+ dupname(node, name)
if not explicit or (not old_explicit and old_id is not None):
msg = self.reporter.info(
'Duplicate implicit target name: "%s".' % name,
@@ -925,7 +959,7 @@ class document(Root, Structural, Element):
def note_indirect_target(self, target):
self.indirect_targets.append(target)
- if target.has_key('name'):
+ if target['names']:
self.note_refname(target)
def note_anonymous_target(self, target):
@@ -969,7 +1003,8 @@ class document(Root, Structural, Element):
self.note_refname(ref)
def note_substitution_def(self, subdef, def_name, msgnode=None):
- name = subdef['name'] = whitespace_normalize_name(def_name)
+ name = whitespace_normalize_name(def_name)
+ subdef['names'].append(name)
if self.substitution_defs.has_key(name):
msg = self.reporter.error(
'Duplicate substitution definition name: "%s".' % name,
@@ -977,7 +1012,7 @@ class document(Root, Structural, Element):
if msgnode != None:
msgnode += msg
oldnode = self.substitution_defs[name]
- dupname(oldnode)
+ dupname(oldnode, name)
# keep only the last definition:
self.substitution_defs[name] = subdef
# case-insensitive mapping:
@@ -1155,8 +1190,8 @@ class admonition(Admonition, Element): pass
class comment(Special, Invisible, FixedTextElement): pass
class substitution_definition(Special, Invisible, TextElement): pass
class target(Special, Invisible, Inline, TextElement, Targetable): pass
-class footnote(General, Element, Labeled, BackLinkable): pass
-class citation(General, Element, Labeled, BackLinkable): pass
+class footnote(General, BackLinkable, Element, Labeled, Targetable): pass
+class citation(General, BackLinkable, Element, Labeled, Targetable): pass
class label(Part, TextElement): pass
class figure(General, Element): pass
class caption(Part, TextElement): pass
@@ -1170,7 +1205,7 @@ class row(Part, Element): pass
class entry(Part, Element): pass
-class system_message(Special, PreBibliographic, Element, BackLinkable):
+class system_message(Special, BackLinkable, PreBibliographic, Element):
def __init__(self, message=None, *children, **attributes):
if message:
@@ -1610,9 +1645,12 @@ def make_id(string):
_non_id_chars = re.compile('[^a-z0-9]+')
_non_id_at_ends = re.compile('^[-0-9]+|-+$')
-def dupname(node):
- node['dupname'] = node['name']
- del node['name']
+def dupname(node, name):
+ node['dupnames'].append(name)
+ node['names'].remove(name)
+ # Assume that this method is referenced, even though it isn't; we
+ # don't want to throw unnecessary system_messages.
+ node.referenced = 1
def fully_normalize_name(name):
"""Return a case- and whitespace-normalized name."""
diff --git a/docutils/docutils/parsers/rst/directives/images.py b/docutils/docutils/parsers/rst/directives/images.py
index d6ac5a0c9..76d0d75eb 100644
--- a/docutils/docutils/parsers/rst/directives/images.py
+++ b/docutils/docutils/parsers/rst/directives/images.py
@@ -39,8 +39,8 @@ def image(name, arguments, options, content, lineno,
if target_type == 'refuri':
reference_node = nodes.reference(refuri=data)
elif target_type == 'refname':
- reference_node = nodes.reference(
- refname=data, name=whitespace_normalize_name(options['target']))
+ reference_node = nodes.reference(refname=data,
+ name=whitespace_normalize_name(options['target']))
state.document.note_refname(reference_node)
else: # malformed target
messages.append(data) # data is a system message
diff --git a/docutils/docutils/parsers/rst/directives/misc.py b/docutils/docutils/parsers/rst/directives/misc.py
index 1a6cbc17c..7bae832d2 100644
--- a/docutils/docutils/parsers/rst/directives/misc.py
+++ b/docutils/docutils/parsers/rst/directives/misc.py
@@ -188,8 +188,7 @@ def replace(name, arguments, options, content, lineno,
messages = []
for node in element:
if isinstance(node, nodes.system_message):
- if node.has_key('backrefs'):
- del node['backrefs']
+ node['backrefs'] = []
messages.append(node)
error = state_machine.reporter.error(
'Error in "%s" directive: may contain a single paragraph '
diff --git a/docutils/docutils/parsers/rst/directives/parts.py b/docutils/docutils/parsers/rst/directives/parts.py
index c182ad0fd..217def5b6 100644
--- a/docutils/docutils/parsers/rst/directives/parts.py
+++ b/docutils/docutils/parsers/rst/directives/parts.py
@@ -41,7 +41,7 @@ def contents(name, arguments, options, content, lineno,
else:
title = nodes.title('', language.labels['contents'])
- topic = nodes.topic(CLASS='contents')
+ topic = nodes.topic(classes=['contents'])
cls = options.get('class')
if cls:
@@ -55,7 +55,7 @@ def contents(name, arguments, options, content, lineno,
name = nodes.fully_normalize_name(name)
if not document.has_name(name):
- topic['name'] = name
+ topic['names'].append(name)
document.note_implicit_target(topic)
pending = nodes.pending(parts.Contents, rawsource=block_text)
diff --git a/docutils/docutils/parsers/rst/roles.py b/docutils/docutils/parsers/rst/roles.py
index 2f3ab11a5..cf6d5a971 100644
--- a/docutils/docutils/parsers/rst/roles.py
+++ b/docutils/docutils/parsers/rst/roles.py
@@ -174,7 +174,7 @@ def set_implicit_options(role_fn):
if not hasattr(role_fn, 'options') or role_fn.options is None:
role_fn.options = {'class': directives.class_option}
elif not role_fn.options.has_key('class'):
- role_fn.options['class'] = directives.class_option
+ role_fn.options['class'] = directives.class_option
def register_generic_role(canonical_name, node_class):
"""For roles which simply wrap a given `node_class` around the text."""
@@ -195,6 +195,7 @@ class GenericRole:
def __call__(self, role, rawtext, text, lineno, inliner,
options={}, content=[]):
+ set_classes(options)
return [self.node_class(rawtext, utils.unescape(text), **options)], []
@@ -233,6 +234,7 @@ def generic_custom_role(role, rawtext, text, lineno, inliner,
""""""
# Once nested inline markup is implemented, this and other methods should
# recursively call inliner.nested_parse().
+ set_classes(options)
return [nodes.inline(rawtext, utils.unescape(text), **options)], []
generic_custom_role.options = {'class': directives.class_option}
@@ -265,6 +267,7 @@ def pep_reference_role(role, rawtext, text, lineno, inliner,
return [prb], [msg]
# Base URL mainly used by inliner.pep_reference; so this is correct:
ref = inliner.document.settings.pep_base_url + inliner.pep_url % pepnum
+ set_classes(options)
return [nodes.reference(rawtext, 'PEP ' + utils.unescape(text), refuri=ref,
**options)], []
@@ -284,6 +287,7 @@ def rfc_reference_role(role, rawtext, text, lineno, inliner,
return [prb], [msg]
# Base URL mainly used by inliner.rfc_reference, so this is correct:
ref = inliner.document.settings.rfc_base_url + inliner.rfc_url % rfcnum
+ set_classes(options)
node = nodes.reference(rawtext, 'RFC ' + utils.unescape(text), refuri=ref,
**options)
return [node], []
@@ -299,6 +303,7 @@ def raw_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
'an associated format.' % role, line=lineno)
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
+ set_classes(options)
node = nodes.raw(rawtext, utils.unescape(text, 1), **options)
return [node], []
@@ -329,3 +334,14 @@ register_canonical_role('target', unimplemented_role)
# This should remain unimplemented, for testing purposes:
register_canonical_role('restructuredtext-unimplemented-role',
unimplemented_role)
+
+
+def set_classes(options):
+ """
+ Auxiliary function to set options['classes'] and delete
+ options['class'].
+ """
+ if options.has_key('class'):
+ assert not options.has_key('classes')
+ options['classes'] = options['class'].split()
+ del options['class']
diff --git a/docutils/docutils/parsers/rst/states.py b/docutils/docutils/parsers/rst/states.py
index ddf47df7f..a44f47027 100644
--- a/docutils/docutils/parsers/rst/states.py
+++ b/docutils/docutils/parsers/rst/states.py
@@ -365,7 +365,7 @@ class RSTState(StateWS):
textnodes, title_messages = self.inline_text(title, lineno)
titlenode = nodes.title(title, '', *textnodes)
name = normalize_name(titlenode.astext())
- section_node['name'] = name
+ section_node['names'].append(name)
section_node += titlenode
section_node += messages
section_node += title_messages
@@ -787,7 +787,7 @@ class Inliner:
else:
if target:
reference['refuri'] = uri
- target['name'] = refname
+ target['names'].append(refname)
self.document.note_external_target(target)
self.document.note_explicit_target(target, self.parent)
node_list.append(target)
@@ -829,7 +829,7 @@ class Inliner:
assert len(inlines) == 1
target = inlines[0]
name = normalize_name(target.astext())
- target['name'] = name
+ target['names'].append(name)
self.document.note_explicit_target(target, self.parent)
return before, inlines, remaining, sysmessages
@@ -1751,7 +1751,7 @@ class Body(RSTState):
name = name[1:] # autonumber label
footnote['auto'] = 1
if name:
- footnote['name'] = name
+ footnote['names'].append(name)
self.document.note_autofootnote(footnote)
elif name == '*': # auto-symbol
name = ''
@@ -1759,7 +1759,7 @@ class Body(RSTState):
self.document.note_symbol_footnote(footnote)
else: # manually numbered
footnote += nodes.label('', label)
- footnote['name'] = name
+ footnote['names'].append(name)
self.document.note_footnote(footnote)
if name:
self.document.note_explicit_target(footnote, footnote)
@@ -1778,7 +1778,7 @@ class Body(RSTState):
citation = nodes.citation('\n'.join(indented))
citation.line = lineno
citation += nodes.label('', label)
- citation['name'] = name
+ citation['names'].append(name)
self.document.note_citation(citation)
self.document.note_explicit_target(citation, citation)
if indented:
@@ -1814,7 +1814,6 @@ class Body(RSTState):
target_type, data = self.parse_target(block, block_text, lineno)
if target_type == 'refname':
target = nodes.target(block_text, '', refname=normalize_name(data))
- target.indirect_reference_name = data
self.add_target(target_name, '', target, lineno)
self.document.note_indirect_target(target)
return target
@@ -1854,7 +1853,7 @@ class Body(RSTState):
target.line = lineno
if targetname:
name = normalize_name(unescape(targetname))
- target['name'] = name
+ target['names'].append(name)
if refuri:
uri = self.inliner.adjust_uri(refuri)
if uri:
@@ -2259,7 +2258,7 @@ class RFC2822Body(Body):
def rfc2822(self, match, context, next_state):
"""RFC2822-style field list item."""
- fieldlist = nodes.field_list(CLASS='rfc2822')
+ fieldlist = nodes.field_list(classes=['rfc2822'])
self.parent += fieldlist
field, blank_finish = self.rfc2822_field(match)
fieldlist += field
@@ -2497,7 +2496,7 @@ class SubstitutionDef(Body):
def embedded_directive(self, match, context, next_state):
nodelist, blank_finish = self.directive(match,
- alt=self.parent['name'])
+ alt=self.parent['names'][0])
self.parent += nodelist
if not self.state_machine.at_eof():
self.blank_finish = blank_finish
diff --git a/docutils/docutils/readers/pep.py b/docutils/docutils/readers/pep.py
index b7774a949..b2326666f 100644
--- a/docutils/docutils/readers/pep.py
+++ b/docutils/docutils/readers/pep.py
@@ -31,10 +31,9 @@ class Reader(standalone.Reader):
config_section_dependencies = ('readers', 'standalone reader')
default_transforms = (references.Substitutions,
- references.SectionTargets,
+ references.PropagateTargets,
peps.Headers,
peps.Contents,
- references.ChainedTargets,
references.AnonymousHyperlinks,
references.IndirectHyperlinks,
peps.TargetNotes,
diff --git a/docutils/docutils/readers/standalone.py b/docutils/docutils/readers/standalone.py
index 82541c297..63e618b51 100644
--- a/docutils/docutils/readers/standalone.py
+++ b/docutils/docutils/readers/standalone.py
@@ -43,10 +43,9 @@ class Reader(readers.Reader):
config_section_dependencies = ('readers',)
default_transforms = (references.Substitutions,
- references.SectionTargets,
+ references.PropagateTargets,
frontmatter.DocTitle,
frontmatter.DocInfo,
- references.ChainedTargets,
references.AnonymousHyperlinks,
references.IndirectHyperlinks,
references.Footnotes,
diff --git a/docutils/docutils/transforms/frontmatter.py b/docutils/docutils/transforms/frontmatter.py
index 1a45c1336..8a5581313 100644
--- a/docutils/docutils/transforms/frontmatter.py
+++ b/docutils/docutils/transforms/frontmatter.py
@@ -50,7 +50,7 @@ class DocTitle(Transform):
Once parsed, it looks like this::
<document>
- <section name="top-level title">
+ <section names="top-level title">
<title>
Top-Level Title
<paragraph>
@@ -58,7 +58,7 @@ class DocTitle(Transform):
After running the DocTitle transform, we have::
- <document name="top-level title">
+ <document names="top-level title">
<title>
Top-Level Title
<paragraph>
@@ -85,10 +85,10 @@ class DocTitle(Transform):
After parsing and running the Section Promotion transform, the
result is::
- <document name="top-level title">
+ <document names="top-level title">
<title>
Top-Level Title
- <subtitle name="second-level title">
+ <subtitle names="second-level title">
Second-Level Title
<paragraph>
A paragraph.
@@ -294,7 +294,7 @@ class DocInfo(Transform):
raise TransformError
title = nodes.title(name, labels[canonical])
topics[canonical] = biblioclass(
- '', title, CLASS=canonical, *field[1].children)
+ '', title, classes=[canonical], *field[1].children)
else:
docinfo.append(biblioclass('', *field[1].children))
except TransformError:
diff --git a/docutils/docutils/transforms/parts.py b/docutils/docutils/transforms/parts.py
index d0537d5aa..a1405f729 100644
--- a/docutils/docutils/transforms/parts.py
+++ b/docutils/docutils/transforms/parts.py
@@ -54,7 +54,7 @@ class SectNum(Transform):
generated = nodes.generated(
'', (self.prefix + '.'.join(numbers) + self.suffix
+ u'\u00a0' * 3),
- CLASS='sectnum')
+ classes=['sectnum'])
title.insert(0, generated)
title['auto'] = 1
if depth < self.maxdepth:
@@ -91,7 +91,7 @@ class Contents(Transform):
else:
startnode = self.document
- self.toc_id = self.startnode.parent['id']
+ self.toc_id = self.startnode.parent['ids'][0]
if details.has_key('backlinks'):
self.backlinks = details['backlinks']
else:
@@ -117,7 +117,7 @@ class Contents(Transform):
title = section[0]
auto = title.get('auto') # May be set by SectNum.
entrytext = self.copy_and_filter(title)
- reference = nodes.reference('', '', refid=section['id'],
+ reference = nodes.reference('', '', refid=section['ids'][0],
*entrytext)
ref_id = self.document.set_id(reference)
entry = nodes.paragraph('', '', reference)
diff --git a/docutils/docutils/transforms/peps.py b/docutils/docutils/transforms/peps.py
index 16260367a..201ce314b 100644
--- a/docutils/docutils/transforms/peps.py
+++ b/docutils/docutils/transforms/peps.py
@@ -46,7 +46,7 @@ class Headers(Transform):
raise DataError('Document tree is empty.')
header = self.document[0]
if not isinstance(header, nodes.field_list) or \
- header.get('class') != 'rfc2822':
+ 'rfc2822' not in header['classes']:
raise DataError('Document does not begin with an RFC-2822 '
'header; it is not a PEP.')
pep = None
@@ -149,10 +149,10 @@ class Contents(Transform):
language = languages.get_language(self.document.settings.language_code)
name = language.labels['contents']
title = nodes.title('', name)
- topic = nodes.topic('', title, CLASS='contents')
+ topic = nodes.topic('', title, classes=['contents'])
name = nodes.fully_normalize_name(name)
if not self.document.has_name(name):
- topic['name'] = name
+ topic['names'].append(name)
self.document.note_implicit_target(topic)
pending = nodes.pending(parts.Contents)
topic += pending
@@ -244,7 +244,7 @@ class PEPZeroSpecial(nodes.SparseNodeVisitor):
node.parent.replace(node, mask_email(node))
def visit_field_list(self, node):
- if node.hasattr('class') and node['class'] == 'rfc2822':
+ if 'rfc2822' in node['classes']:
raise nodes.SkipNode
def visit_tgroup(self, node):
@@ -254,7 +254,7 @@ class PEPZeroSpecial(nodes.SparseNodeVisitor):
def visit_colspec(self, node):
self.entry += 1
if self.pep_table and self.entry == 2:
- node['class'] = 'num'
+ node['classes'].append('num')
def visit_row(self, node):
self.entry = 0
@@ -262,7 +262,7 @@ class PEPZeroSpecial(nodes.SparseNodeVisitor):
def visit_entry(self, node):
self.entry += 1
if self.pep_table and self.entry == 2 and len(node) == 1:
- node['class'] = 'num'
+ node['classes'].append('num')
p = node[0]
if isinstance(p, nodes.paragraph) and len(p) == 1:
text = p.astext()
diff --git a/docutils/docutils/transforms/references.py b/docutils/docutils/transforms/references.py
index e2196452c..80bafbf2a 100644
--- a/docutils/docutils/transforms/references.py
+++ b/docutils/docutils/transforms/references.py
@@ -16,114 +16,75 @@ from docutils import nodes, utils
from docutils.transforms import TransformError, Transform
-class SectionTargets(Transform):
+class PropagateTargets(Transform):
- default_priority = 260
-
- def apply(self):
- for target in self.document.internal_targets:
- if not (target.attributes.has_key('refid')
- or target.attributes.has_key('refuri')
- or target.attributes.has_key('refname')):
- self.relocate(target)
-
- def relocate(self, target):
- """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(self.possible_relocation_target, ascend=1)
- if isinstance(n, nodes.section):
- assert isinstance(n[0], nodes.title)
- target.parent.remove(target)
- n[0].insert(0, target)
-
- 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'))
-
-
-class ChainedTargets(Transform):
-
- """
- Attributes "refuri" and "refname" are migrated from the final direct
- target up the chain of contiguous adjacent internal targets, using
- `ChainedTargetResolver`.
"""
+ Propagate empty internal targets to the next element.
- default_priority = 420
-
- def apply(self):
- visitor = ChainedTargetResolver(self.document)
- self.document.walk(visitor)
-
-
-class ChainedTargetResolver(nodes.SparseNodeVisitor):
-
- """
- Copy reference attributes up the length of a hyperlink target chain.
+ Given the following nodes::
- "Chained targets" are multiple adjacent internal hyperlink targets which
- "point to" an external or indirect target. After the transform, all
- chained targets will effectively point to the same place.
-
- Given the following ``document`` as input::
-
- <document>
- <target id="a" name="a">
- <target id="b" name="b">
- <target id="c" name="c" refuri="http://chained.external.targets">
- <target id="d" name="d">
- <paragraph>
- I'm known as "d".
- <target id="e" name="e">
- <target id="id1">
- <target id="f" name="f" refname="d">
+ <target ids="internal1" names="internal1">
+ <target anonymous="1" ids="id1">
+ <target ids="internal2" names="internal2">
+ <paragraph>
+ This is a test.
- ``ChainedTargetResolver(document).walk()`` will transform the above into::
+ PropagateTargets propagates the ids and names of the internal
+ targets preceding the paragraph to the paragraph itself::
- <document>
- <target id="a" name="a" refuri="http://chained.external.targets">
- <target id="b" name="b" refuri="http://chained.external.targets">
- <target id="c" name="c" refuri="http://chained.external.targets">
- <target id="d" name="d">
- <paragraph>
- I'm known as "d".
- <target id="e" name="e" refname="d">
- <target id="id1" refname="d">
- <target id="f" name="f" refname="d">
+ <target refid="internal1">
+ <target anonymous="1" refid="id1">
+ <target refid="internal2">
+ <paragraph ids="internal2 id1 internal1" names="internal2 internal1">
+ This is a test.
"""
- def unknown_visit(self, node):
- pass
+ default_priority = 260
- def visit_target(self, node):
- if node.hasattr('refuri'):
- attname = 'refuri'
- call_if_named = self.document.note_external_target
- elif node.hasattr('refname'):
- attname = 'refname'
- call_if_named = self.document.note_indirect_target
- elif node.hasattr('refid'):
- attname = 'refid'
- call_if_named = None
- else:
- return
- attval = node[attname]
- index = node.parent.index(node)
- for i in range(index - 1, -1, -1):
- sibling = node.parent[i]
- if not isinstance(sibling, nodes.target) \
- or sibling.hasattr('refuri') \
- or sibling.hasattr('refname') \
- or sibling.hasattr('refid'):
- break
- sibling[attname] = attval
- if sibling.hasattr('name') and call_if_named:
- call_if_named(sibling)
+ def apply(self):
+ for target in self.document.internal_targets:
+ if not (len(target) == 0 and
+ not (target.attributes.has_key('refid') or
+ target.attributes.has_key('refuri') or
+ target.attributes.has_key('refname'))):
+ continue
+ next_node = target.next_node(ascend=1)
+ # Do not move names and ids into Invisibles (we'd lose the
+ # attributes) or different Targetables (e.g. footnotes).
+ if (next_node is not None and
+ ((not isinstance(next_node, nodes.Invisible) and
+ not isinstance(next_node, nodes.Targetable)) or
+ isinstance(next_node, nodes.target))):
+ next_node['ids'].extend(target['ids'])
+ next_node['names'].extend(target['names'])
+ # Set defaults for next_node.expect_referenced_by_name/id.
+ if not hasattr(next_node, 'expect_referenced_by_name'):
+ next_node.expect_referenced_by_name = {}
+ if not hasattr(next_node, 'expect_referenced_by_id'):
+ next_node.expect_referenced_by_id = {}
+ for id in target['ids']:
+ # Update IDs to node mapping.
+ self.document.ids[id] = next_node
+ # If next_node is referenced by id ``id``, this
+ # target shall be marked as referenced.
+ next_node.expect_referenced_by_id[id] = target
+ for name in target['names']:
+ next_node.expect_referenced_by_name[name] = target
+ # If there are any expect_referenced_by_... attributes
+ # in target set, copy them to next_node.
+ next_node.expect_referenced_by_name.update(
+ getattr(target, 'expect_referenced_by_name', {}))
+ next_node.expect_referenced_by_id.update(
+ getattr(target, 'expect_referenced_by_id', {}))
+ # Set refid to point to the first former ID of target
+ # which is now an ID of next_node.
+ target['refid'] = target['ids'][0]
+ # Clear ids and names; they have been moved to
+ # next_node.
+ target['ids'] = []
+ target['names'] = []
+ self.document.note_refid(target)
+ self.document.note_internal_target(next_node)
class AnonymousHyperlinks(Transform):
@@ -136,8 +97,8 @@ class AnonymousHyperlinks(Transform):
internal
<reference anonymous="1">
external
- <target anonymous="1" id="id1">
- <target anonymous="1" id="id2" refuri="http://external">
+ <target anonymous="1" ids="id1">
+ <target anonymous="1" ids="id2" refuri="http://external">
Corresponding references are linked via "refid" or resolved via "refuri"::
@@ -146,8 +107,8 @@ class AnonymousHyperlinks(Transform):
text
<reference anonymous="1" refuri="http://external">
external
- <target anonymous="1" id="id1">
- <target anonymous="1" id="id2" refuri="http://external">
+ <target anonymous="1" ids="id1">
+ <target anonymous="1" ids="id2" refuri="http://external">
"""
default_priority = 440
@@ -167,16 +128,28 @@ class AnonymousHyperlinks(Transform):
prbid = self.document.set_id(prb)
msg.add_backref(prbid)
ref.parent.replace(ref, prb)
+ for target in self.document.anonymous_targets:
+ # Assume that all anonymous targets have been
+ # referenced to avoid generating lots of
+ # system_messages.
+ target.referenced = 1
return
for ref, target in zip(self.document.anonymous_refs,
self.document.anonymous_targets):
- if target.hasattr('refuri'):
- ref['refuri'] = target['refuri']
- ref.resolved = 1
- else:
- ref['refid'] = target['id']
- self.document.note_refid(ref)
target.referenced = 1
+ while 1:
+ if target.hasattr('refuri'):
+ ref['refuri'] = target['refuri']
+ ref.resolved = 1
+ break
+ else:
+ if not target['ids']:
+ # Propagated target.
+ target = self.document.ids[target['refid']]
+ continue
+ ref['refid'] = target['ids'][0]
+ self.document.note_refid(ref)
+ break
class IndirectHyperlinks(Transform):
@@ -240,20 +213,24 @@ class IndirectHyperlinks(Transform):
self.resolve_indirect_references(target)
def resolve_indirect_target(self, target):
- refname = target['refname']
- reftarget_id = self.document.nameids.get(refname)
- if not reftarget_id:
- # Check the unknown_reference_resolvers
- for resolver_function in (self.document.transformer
- .unknown_reference_resolvers):
- if resolver_function(target):
- break
- else:
- self.nonexistent_indirect_target(target)
- return
+ refname = target.get('refname')
+ if refname is None:
+ reftarget_id = target['refid']
+ else:
+ reftarget_id = self.document.nameids.get(refname)
+ if not reftarget_id:
+ # Check the unknown_reference_resolvers
+ for resolver_function in \
+ self.document.transformer.unknown_reference_resolvers:
+ if resolver_function(target):
+ break
+ else:
+ self.nonexistent_indirect_target(target)
+ return
reftarget = self.document.ids[reftarget_id]
+ reftarget.note_referenced_by(id=reftarget_id)
if isinstance(reftarget, nodes.target) \
- and not reftarget.resolved and reftarget.hasattr('refname'):
+ and not reftarget.resolved and reftarget.hasattr('refname'):
if hasattr(target, 'multiply_indirect'):
#and target.multiply_indirect):
#del target.multiply_indirect
@@ -264,21 +241,23 @@ class IndirectHyperlinks(Transform):
del target.multiply_indirect
if reftarget.hasattr('refuri'):
target['refuri'] = reftarget['refuri']
- if target.hasattr('name'):
+ if target['names']:
self.document.note_external_target(target)
+ if target.has_key('refid'):
+ del target['refid']
elif reftarget.hasattr('refid'):
target['refid'] = reftarget['refid']
self.document.note_refid(target)
else:
- try:
- target['refid'] = reftarget['id']
+ if reftarget['ids']:
+ target['refid'] = reftarget_id
self.document.note_refid(target)
- except KeyError:
+ else:
self.nonexistent_indirect_target(target)
return
- del target['refname']
+ if refname is not None:
+ del target['refname']
target.resolved = 1
- reftarget.referenced = 1
def nonexistent_indirect_target(self, target):
if self.document.nameids.has_key(target['refname']):
@@ -292,18 +271,19 @@ class IndirectHyperlinks(Transform):
def indirect_target_error(self, target, explanation):
naming = ''
- if target.hasattr('name'):
- naming = '"%s" ' % target['name']
- reflist = self.document.refnames.get(target['name'], [])
- else:
- reflist = self.document.refids.get(target['id'], [])
- naming += '(id="%s")' % target['id']
+ reflist = []
+ if target['names']:
+ naming = '"%s" ' % target['names'][0]
+ for name in target['names']:
+ reflist.extend(self.document.refnames.get(name, []))
+ for id in target['ids']:
+ reflist.extend(self.document.refids.get(id, []))
+ naming += '(id="%s")' % target['ids'][0]
msg = self.document.reporter.error(
'Indirect hyperlink target %s refers to target "%s", %s.'
- % (naming, target['refname'], explanation),
- base_node=target)
+ % (naming, target['refname'], explanation), base_node=target)
msgid = self.document.set_id(msg)
- for ref in reflist:
+ for ref in uniq(reflist):
prb = nodes.problematic(
ref.rawsource, ref.rawsource, refid=msgid)
prbid = self.document.set_id(prb)
@@ -323,43 +303,34 @@ class IndirectHyperlinks(Transform):
else:
return
attval = target[attname]
- if target.hasattr('name'):
- name = target['name']
- try:
- reflist = self.document.refnames[name]
- except KeyError, instance:
- if target.referenced:
- return
- msg = self.document.reporter.info(
- 'Indirect hyperlink target "%s" is not referenced.'
- % name, base_node=target)
- target.referenced = 1
- return
- delatt = 'refname'
- else:
- id = target['id']
- try:
- reflist = self.document.refids[id]
- except KeyError, instance:
- if target.referenced:
- return
- msg = self.document.reporter.info(
- 'Indirect hyperlink target id="%s" is not referenced.'
- % id, base_node=target)
- target.referenced = 1
- return
- delatt = 'refid'
- for ref in reflist:
- if ref.resolved:
- continue
- del ref[delatt]
- ref[attname] = attval
- if not call_if_named or ref.hasattr('name'):
- call_method(ref)
- ref.resolved = 1
- if isinstance(ref, nodes.target):
- self.resolve_indirect_references(ref)
- target.referenced = 1
+ for name in target['names']:
+ reflist = self.document.refnames.get(name, [])
+ if reflist:
+ target.note_referenced_by(name=name)
+ for ref in reflist:
+ if ref.resolved:
+ continue
+ del ref['refname']
+ ref[attname] = attval
+ if not call_if_named or ref['names']:
+ call_method(ref)
+ ref.resolved = 1
+ if isinstance(ref, nodes.target):
+ self.resolve_indirect_references(ref)
+ for id in target['ids']:
+ reflist = self.document.refids.get(id, [])
+ if reflist:
+ target.note_referenced_by(id=id)
+ for ref in reflist:
+ if ref.resolved:
+ continue
+ del ref['refid']
+ ref[attname] = attval
+ if not call_if_named or ref['names']:
+ call_method(ref)
+ ref.resolved = 1
+ if isinstance(ref, nodes.target):
+ self.resolve_indirect_references(ref)
class ExternalTargets(Transform):
@@ -384,27 +355,18 @@ class ExternalTargets(Transform):
def apply(self):
for target in self.document.external_targets:
- if target.hasattr('refuri') and target.hasattr('name'):
- name = target['name']
+ if target.hasattr('refuri'):
refuri = target['refuri']
- try:
- reflist = self.document.refnames[name]
- except KeyError, instance:
- # @@@ First clause correct???
- if not isinstance(target, nodes.target) or target.referenced:
- continue
- msg = self.document.reporter.info(
- 'External hyperlink target "%s" is not referenced.'
- % name, base_node=target)
- target.referenced = 1
- continue
- for ref in reflist:
- if ref.resolved:
- continue
- del ref['refname']
- ref['refuri'] = refuri
- ref.resolved = 1
- target.referenced = 1
+ for name in target['names']:
+ reflist = self.document.refnames.get(name, [])
+ if reflist:
+ target.note_referenced_by(name=name)
+ for ref in reflist:
+ if ref.resolved:
+ continue
+ del ref['refname']
+ ref['refuri'] = refuri
+ ref.resolved = 1
class InternalTargets(Transform):
@@ -433,27 +395,19 @@ class InternalTargets(Transform):
<target id="id1" name="direct internal">
"""
if target.hasattr('refuri') or target.hasattr('refid') \
- or not target.hasattr('name'):
- return
- name = target['name']
- refid = target['id']
- try:
- reflist = self.document.refnames[name]
- except KeyError, instance:
- if target.referenced:
- return
- msg = self.document.reporter.info(
- 'Internal hyperlink target "%s" is not referenced.'
- % name, base_node=target)
- target.referenced = 1
+ or not target['names']:
return
- for ref in reflist:
- if ref.resolved:
- return
- del ref['refname']
- ref['refid'] = refid
- ref.resolved = 1
- target.referenced = 1
+ for name in target['names']:
+ refid = self.document.nameids[name]
+ reflist = self.document.refnames.get(name, [])
+ if reflist:
+ target.note_referenced_by(name=name)
+ for ref in reflist:
+ if ref.resolved:
+ continue
+ del ref['refname']
+ ref['refid'] = refid
+ ref.resolved = 1
class Footnotes(Transform):
@@ -561,19 +515,17 @@ class Footnotes(Transform):
if not self.document.nameids.has_key(label):
break
footnote.insert(0, nodes.label('', label))
- if footnote.hasattr('dupname'):
- continue
- if footnote.hasattr('name'):
- name = footnote['name']
+ for name in footnote['names']:
for ref in self.document.footnote_refs.get(name, []):
ref += nodes.Text(label)
ref.delattr('refname')
- ref['refid'] = footnote['id']
- footnote.add_backref(ref['id'])
+ assert len(footnote['ids']) == len(ref['ids']) == 1
+ ref['refid'] = footnote['ids'][0]
+ footnote.add_backref(ref['ids'][0])
self.document.note_refid(ref)
ref.resolved = 1
- else:
- footnote['name'] = label
+ if not footnote['names'] and not footnote['dupnames']:
+ footnote['names'].append(label)
self.document.note_explicit_target(footnote, footnote)
self.autofootnote_labels.append(label)
return startnum
@@ -606,7 +558,8 @@ class Footnotes(Transform):
footnote = self.document.ids[id]
ref['refid'] = id
self.document.note_refid(ref)
- footnote.add_backref(ref['id'])
+ assert len(ref['ids']) == 1
+ footnote.add_backref(ref['ids'][0])
ref.resolved = 1
i += 1
@@ -641,9 +594,10 @@ class Footnotes(Transform):
ref.parent.replace(ref, prb)
break
footnote = self.document.symbol_footnotes[i]
- ref['refid'] = footnote['id']
+ assert len(footnote['ids']) == 1
+ ref['refid'] = footnote['ids'][0]
self.document.note_refid(ref)
- footnote.add_backref(ref['id'])
+ footnote.add_backref(ref['ids'][0])
i += 1
def resolve_footnotes_and_citations(self):
@@ -652,26 +606,26 @@ class Footnotes(Transform):
references.
"""
for footnote in self.document.footnotes:
- if footnote.hasattr('name'):
- label = footnote['name']
+ for label in footnote['names']:
if self.document.footnote_refs.has_key(label):
reflist = self.document.footnote_refs[label]
self.resolve_references(footnote, reflist)
for citation in self.document.citations:
- if citation.hasattr('name'):
- label = citation['name']
+ for label in citation['names']:
if self.document.citation_refs.has_key(label):
reflist = self.document.citation_refs[label]
self.resolve_references(citation, reflist)
def resolve_references(self, note, reflist):
- id = note['id']
+ assert len(note['ids']) == 1
+ id = note['ids'][0]
for ref in reflist:
if ref.resolved:
continue
ref.delattr('refname')
ref['refid'] = id
- note.add_backref(ref['id'])
+ assert len(ref['ids']) == 1
+ note.add_backref(ref['ids'][0])
ref.resolved = 1
note.resolved = 1
@@ -765,11 +719,12 @@ class TargetNotes(Transform):
notes = {}
nodelist = []
for target in self.document.external_targets:
- name = target.get('name')
- if not name:
- print >>sys.stderr, 'no name on target: %r' % target
- continue
- refs = self.document.refnames.get(name, [])
+ names = target['names']
+ # Only named targets.
+ assert names
+ refs = []
+ for name in names:
+ refs.extend(self.document.refnames.get(name, []))
if not refs:
continue
footnote = self.make_target_footnote(target, refs, notes)
@@ -791,14 +746,16 @@ class TargetNotes(Transform):
refuri = target['refuri']
if notes.has_key(refuri): # duplicate?
footnote = notes[refuri]
- footnote_name = footnote['name']
+ assert len(footnote['names']) == 1
+ footnote_name = footnote['names'][0]
else: # original
footnote = nodes.footnote()
footnote_id = self.document.set_id(footnote)
- # Use a colon; they can't be produced inside names by the parser:
- footnote_name = 'target_note: ' + footnote_id
+ # Use uppercase letters and a colon; they can't be
+ # produced inside names by the parser.
+ footnote_name = 'TARGET_NOTE: ' + footnote_id
footnote['auto'] = 1
- footnote['name'] = footnote_name
+ footnote['names'] = [footnote_name]
footnote_paragraph = nodes.paragraph()
footnote_paragraph += nodes.reference('', refuri, refuri=refuri)
footnote += footnote_paragraph
@@ -817,3 +774,10 @@ class TargetNotes(Transform):
reflist.insert(0, nodes.Text(' '))
ref.parent.insert(index, reflist)
return footnote
+
+
+def uniq(L):
+ d = {}
+ for x in L:
+ d[x] = None
+ return d.keys()
diff --git a/docutils/docutils/transforms/universal.py b/docutils/docutils/transforms/universal.py
index 62304e2a8..7d8a796cc 100644
--- a/docutils/docutils/transforms/universal.py
+++ b/docutils/docutils/transforms/universal.py
@@ -103,7 +103,7 @@ class Messages(Transform):
if msg['level'] >= threshold and not msg.parent:
messages.append(msg)
if messages:
- section = nodes.section(CLASS='system-messages')
+ section = nodes.section(classes=['system-messages'])
# @@@ get this from the language module?
section += nodes.title('', 'Docutils System Messages')
section += messages
@@ -167,6 +167,21 @@ class FinalChecks(Transform):
if self.document.settings.expose_internals:
visitor = InternalAttributeExposer(self.document)
self.document.walk(visitor)
+ # *After* resolving all references, check for unreferenced
+ # targets:
+ for target in self.document.traverse():
+ if isinstance(target, nodes.target) and not target.referenced:
+ if target['names']:
+ naming = target['names'][0]
+ elif target['ids']:
+ naming = target['ids'][0]
+ else:
+ # Hack: Propagated targets always have their refid
+ # attribute set.
+ naming = target['refid']
+ self.document.reporter.info(
+ 'Hyperlink target "%s" is not referenced.'
+ % naming, base_node=target)
class FinalCheckVisitor(nodes.SparseNodeVisitor):
@@ -206,7 +221,7 @@ class FinalCheckVisitor(nodes.SparseNodeVisitor):
else:
del node['refname']
node['refid'] = id
- self.document.ids[id].referenced = 1
+ self.document.ids[id].note_referenced_by(id=id)
node.resolved = 1
visit_footnote_reference = visit_citation_reference = visit_reference
diff --git a/docutils/docutils/writers/html4css1.py b/docutils/docutils/writers/html4css1.py
index c0938c590..a3b85f9a2 100644
--- a/docutils/docutils/writers/html4css1.py
+++ b/docutils/docutils/writers/html4css1.py
@@ -215,7 +215,7 @@ class HTMLTranslator(nodes.NodeVisitor):
# A heterogenous stack used in conjunction with the tree traversal.
# Make sure that the pops correspond to the pushes:
self.context = []
- self.topic_class = ''
+ self.topic_class = []
self.colspecs = []
self.compact_p = 1
self.compact_simple = None
@@ -256,16 +256,20 @@ class HTMLTranslator(nodes.NodeVisitor):
are extracted), tag name, and optional attributes.
"""
tagname = tagname.lower()
+ prefix = []
atts = {}
for (name, value) in attributes.items():
atts[name.lower()] = value
- for att in ('class',): # append to node attribute
- if node.has_key(att) or atts.has_key(att):
- atts[att] = \
- (node.get(att, '') + ' ' + atts.get(att, '')).strip()
- for att in ('id',): # node attribute overrides
- if node.has_key(att):
- atts[att] = node[att]
+ classes = node.get('classes', [])
+ if atts.has_key('class'):
+ classes.append(atts['class'])
+ if classes:
+ atts['class'] = ' '.join(classes)
+ assert not atts.has_key('id')
+ if node.get('ids'):
+ atts['id'] = node['ids'][0]
+ for id in node['ids'][1:]:
+ prefix.append('<span id="%s"></span>' % id)
if atts.has_key('id') and tagname in self.named_tags:
atts['name'] = atts['id'] # for compatibility with old browsers
attlist = atts.items()
@@ -285,7 +289,7 @@ class HTMLTranslator(nodes.NodeVisitor):
except TypeError: # for Python 2.1 compatibility:
uval = unicode(str(value))
parts.append('%s="%s"' % (name.lower(), self.attval(uval)))
- return '<%s%s>%s' % (' '.join(parts), infix, suffix)
+ return ''.join(prefix) + '<%s%s>' % (' '.join(parts), infix) + suffix
def emptytag(self, node, tagname, suffix='\n', **attributes):
"""Construct and return an XML-compatible empty tag."""
@@ -389,7 +393,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.compact_p = None
self.compact_simple = (self.settings.compact_lists and
(self.compact_simple
- or self.topic_class == 'contents'
+ or self.topic_classes == ['contents']
or self.check_simple_list(node)))
if self.compact_simple and not old_compact_simple:
atts['class'] = 'simple'
@@ -629,7 +633,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.compact_p = None
self.compact_simple = (self.settings.compact_lists and
(self.compact_simple
- or self.topic_class == 'contents'
+ or self.topic_classes == ['contents']
or self.check_simple_list(node)))
if self.compact_simple and not old_compact_simple:
atts['class'] = (atts.get('class', '') + ' simple').strip()
@@ -718,12 +722,13 @@ class HTMLTranslator(nodes.NodeVisitor):
def footnote_backrefs(self, node):
backlinks = []
- if self.settings.footnote_backlinks and node.hasattr('backrefs'):
- backrefs = node['backrefs']
+ backrefs = node['backrefs']
+ if self.settings.footnote_backlinks and backrefs:
if len(backrefs) == 1:
self.context.append('')
- self.context.append('<a class="fn-backref" href="#%s" '
- 'name="%s">' % (backrefs[0], node['id']))
+ self.context.append(
+ '<a class="fn-backref" href="#%s" name="%s">'
+ % (backrefs[0], node['ids'][0]))
else:
i = 1
for backref in backrefs:
@@ -731,10 +736,10 @@ class HTMLTranslator(nodes.NodeVisitor):
% (backref, i))
i += 1
self.context.append('<em>(%s)</em> ' % ', '.join(backlinks))
- self.context.append('<a name="%s">' % node['id'])
+ self.context.append('<a name="%s">' % node['ids'][0])
else:
self.context.append('')
- self.context.append('<a name="%s">' % node['id'])
+ self.context.append('<a name="%s">' % node['ids'][0])
# If the node does not only consist of a label.
if len(node) > 1:
# If there are preceding backlinks, we do not set class
@@ -795,7 +800,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.depart_admonition()
def visit_image(self, node):
- atts = node.attributes.copy()
+ atts = node.non_default_attributes()
if atts.has_key('class'):
del atts['class'] # prevent duplication with node attrs
atts['src'] = atts['uri']
@@ -832,9 +837,8 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append(self.emptytag(node, 'img', '', **atts))
def image_div_atts(self, image_node):
- div_atts = {'class': 'image'}
- if image_node.attributes.has_key('class'):
- div_atts['class'] += ' ' + image_node.attributes['class']
+ div_atts = {}
+ div_atts['class'] = ' '.join(['image'] + image_node['classes'])
if image_node.attributes.has_key('align'):
div_atts['align'] = self.attval(image_node.attributes['align'])
div_atts['class'] += ' align-%s' % div_atts['align']
@@ -917,7 +921,7 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append('\n</pre>\n')
def visit_meta(self, node):
- meta = self.emptytag(node, 'meta', **node.attributes)
+ meta = self.emptytag(node, 'meta', **node.non_default_attributes())
self.add_meta(meta)
def depart_meta(self, node):
@@ -1003,12 +1007,16 @@ class HTMLTranslator(nodes.NodeVisitor):
isinstance(node.parent, nodes.compound)):
# Never compact paragraphs in document or compound.
return 0
- if ((node.attributes in ({}, {'class': 'first'}, {'class': 'last'},
- {'class': 'first last'})) and
- (self.compact_simple or
- self.compact_p and (len(node.parent) == 1 or
- len(node.parent) == 2 and
- isinstance(node.parent[0], nodes.label)))):
+ for key, value in node.attlist():
+ if (node.is_not_default(key) and
+ not (key == 'classes' and value in
+ ([], ['first'], ['last'], ['first', 'last']))):
+ # Attribute which needs to survive.
+ return 0
+ if (self.compact_simple or
+ self.compact_p and (len(node.parent) == 1 or
+ len(node.parent) == 2 and
+ isinstance(node.parent[0], nodes.label))):
return 1
return 0
@@ -1025,7 +1033,7 @@ class HTMLTranslator(nodes.NodeVisitor):
def visit_problematic(self, node):
if node.hasattr('refid'):
self.body.append('<a href="#%s" name="%s">' % (node['refid'],
- node['id']))
+ node['ids'][0]))
self.context.append('</a>')
else:
self.context.append('')
@@ -1037,12 +1045,11 @@ class HTMLTranslator(nodes.NodeVisitor):
def visit_raw(self, node):
if 'html' in node.get('format', '').split():
- add_class = node.attributes.get('class') is not None
t = isinstance(node.parent, nodes.TextElement) and 'span' or 'div'
- if add_class:
+ if node['classes']:
self.body.append(self.starttag(node, t, suffix=''))
self.body.append(node.astext())
- if add_class:
+ if node['classes']:
self.body.append('</%s>' % t)
# Keep non-HTML raw text out of output:
raise nodes.SkipNode
@@ -1162,9 +1169,9 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append('<p class="system-message-title">')
attr = {}
backref_text = ''
- if node.hasattr('id'):
- attr['name'] = node['id']
- if node.hasattr('backrefs'):
+ if node['ids']:
+ attr['name'] = node['ids'][0]
+ if len(node['backrefs']):
backrefs = node['backrefs']
if len(backrefs) == 1:
backref_text = ('; <em><a href="#%s">backlink</a></em>'
@@ -1288,17 +1295,17 @@ class HTMLTranslator(nodes.NodeVisitor):
self.body.append(
self.starttag(node, 'h%s' % h_level, ''))
atts = {}
- if node.parent.hasattr('id'):
- atts['name'] = node.parent['id']
+ if node.parent['ids']:
+ atts['name'] = node.parent['ids'][0]
if node.hasattr('refid'):
atts['class'] = 'toc-backref'
atts['href'] = '#' + node['refid']
self.body.append(self.starttag({}, 'a', '', **atts))
self.context.append('</a></h%s>\n' % (h_level))
if check_id:
- if node.parent.hasattr('id'):
+ if node.parent['ids']:
self.body.append(
- self.starttag({}, 'a', '', name=node.parent['id']))
+ self.starttag({}, 'a', '', name=node.parent['ids'][0]))
self.context.append('</a>' + close_tag)
else:
self.context.append(close_tag)
@@ -1319,11 +1326,11 @@ class HTMLTranslator(nodes.NodeVisitor):
def visit_topic(self, node):
self.body.append(self.starttag(node, 'div', CLASS='topic'))
- self.topic_class = node.get('class')
+ self.topic_classes = node['classes']
def depart_topic(self, node):
self.body.append('</div>\n')
- self.topic_class = ''
+ self.topic_classes = []
def visit_transition(self, node):
self.body.append(self.emptytag(node, 'hr', CLASS='docutils'))
diff --git a/docutils/docutils/writers/latex2e.py b/docutils/docutils/writers/latex2e.py
index 1ce091add..7506c9f52 100644
--- a/docutils/docutils/writers/latex2e.py
+++ b/docutils/docutils/writers/latex2e.py
@@ -678,7 +678,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body_suffix = ['\n']
self.section_level = 0
self.context = []
- self.topic_class = ''
+ self.topic_classes = []
# column specification for tables
self.table_caption = None
@@ -946,14 +946,14 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append( '\\end{quote}\n')
def visit_bullet_list(self, node):
- if self.topic_class == 'contents':
+ if self.topic_classes == ['contents']:
if not self.use_latex_toc:
self.body.append( '\\begin{list}{}{}\n' )
else:
self.body.append( '\\begin{itemize}\n' )
def depart_bullet_list(self, node):
- if self.topic_class == 'contents':
+ if self.topic_classes == ['contents']:
if not self.use_latex_toc:
self.body.append( '\\end{list}\n' )
else:
@@ -1001,7 +1001,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.context.append(len(self.body))
else:
self.body.append('\\begin{figure}[b]')
- self.body.append('\\hypertarget{%s}' % node['id'])
+ for id in node['ids']:
+ self.body.append('\\hypertarget{%s}' % id)
def depart_citation(self, node):
if self._use_latex_citations:
@@ -1395,7 +1396,8 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append('{')
else:
self.body.append('\\begin{figure}[b]')
- self.body.append('\\hypertarget{%s}' % node['id'])
+ for id in node['ids']:
+ self.body.append('\\hypertarget{%s}' % id)
def depart_footnote(self, node):
if self.use_latex_footnotes:
@@ -1703,7 +1705,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
def visit_paragraph(self, node):
index = node.parent.index(node)
- if not (self.topic_class == 'contents' or
+ if not (self.topic_classes == ['contents'] or
(isinstance(node.parent, nodes.compound) and
index > 0 and
not isinstance(node.parent[index - 1], nodes.paragraph) and
@@ -1841,8 +1843,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
# BUG: why not (refuri or refid or refname) means not footnote ?
if not (node.has_key('refuri') or node.has_key('refid')
or node.has_key('refname')):
- self.body.append('\\hypertarget{%s}{' % node['id'])
- self.context.append('}')
+ for id in node['ids']:
+ self.body.append('\\hypertarget{%s}{' % id)
+ self.context.append('}' * len(node['ids']))
else:
self.context.append('')
@@ -1906,8 +1909,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
def bookmark(self, node):
"""Append latex href and pdfbookmarks for titles.
"""
- if node.parent.hasattr('id'):
- self.body.append('\\hypertarget{%s}{}\n' % node.parent['id'])
+ if node.parent['ids']:
+ for id in node.parent['ids']:
+ self.body.append('\\hypertarget{%s}{}\n' % id)
if not self.use_latex_toc:
# BUG level depends on style. pdflatex allows level 0 to 3
# ToC would be the only on level 0 so i choose to decrement the rest.
@@ -1918,8 +1922,9 @@ class LaTeXTranslator(nodes.NodeVisitor):
l = l-1
# pdftex does not like "_" subscripts in titles
text = self.encode(node.astext())
- self.body.append('\\pdfbookmark[%d]{%s}{%s}\n' % \
- (l,text,node.parent['id']))
+ for id in node.parent['ids']:
+ self.body.append('\\pdfbookmark[%d]{%s}{%s}\n' % \
+ (l, text, id))
def visit_title(self, node):
"""Only 3 section levels are supported by LaTeX article (AFAIR)."""
@@ -1968,10 +1973,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append(self.context.pop())
def visit_topic(self, node):
- self.topic_class = node.get('class')
+ self.topic_classes = node['classes']
if self.use_latex_toc:
self.body.append('\\tableofcontents\n\n\\bigskip\n')
- self.topic_class = ''
+ self.topic_classes = []
raise nodes.SkipNode
def visit_inline(self, node): # titlereference
@@ -1981,7 +1986,7 @@ class LaTeXTranslator(nodes.NodeVisitor):
self.body.append( '}' )
def depart_topic(self, node):
- self.topic_class = ''
+ self.topic_classes = []
self.body.append('\n')
def visit_rubric(self, node):
diff --git a/docutils/docutils/writers/pep_html.py b/docutils/docutils/writers/pep_html.py
index a8c74bbc7..f6601120a 100644
--- a/docutils/docutils/writers/pep_html.py
+++ b/docutils/docutils/writers/pep_html.py
@@ -86,5 +86,5 @@ class HTMLTranslator(html4css1.HTMLTranslator):
def depart_field_list(self, node):
html4css1.HTMLTranslator.depart_field_list(self, node)
- if node.get('class') == 'rfc2822':
+ if 'rfc2822' in node['classes']:
self.body.append('<hr />\n')
diff --git a/docutils/test/functional/expected/standalone_rst_html4css1.html b/docutils/test/functional/expected/standalone_rst_html4css1.html
index e4a03e6cb..f7db7b852 100644
--- a/docutils/test/functional/expected/standalone_rst_html4css1.html
+++ b/docutils/test/functional/expected/standalone_rst_html4css1.html
@@ -17,9 +17,9 @@
<link rel="stylesheet" href="../../../tools/stylesheets/default.css" type="text/css" />
</head>
<body>
-<div class="document" id="restructuredtext-test-document">
-<h1 class="title"><span class="target" id="doctitle"></span>reStructuredText Test Document</h1>
-<h2 class="subtitle" id="examples-of-syntax-constructs"><span class="target" id="subtitle"></span>Examples of Syntax Constructs</h2>
+<span id="doctitle"></span><div class="document" id="restructuredtext-test-document">
+<h1 class="title">reStructuredText Test Document</h1>
+<span id="subtitle"></span><h2 class="subtitle" id="examples-of-syntax-constructs">Examples of Syntax Constructs</h2>
<table class="docinfo" frame="void" rules="none">
<col class="docinfo-name" />
<col class="docinfo-content" />
@@ -490,7 +490,7 @@ citation.</p>
</div>
<div class="section" id="targets">
<h2><a class="toc-backref" href="#id43" name="targets">2.13&nbsp;&nbsp;&nbsp;Targets</a></h2>
-<span class="target" id="example"></span><p>This paragraph is pointed to by the explicit &quot;example&quot; target. A
+<p id="example">This paragraph is pointed to by the explicit &quot;example&quot; target. A
reference can be found under <a class="reference" href="#inline-markup">Inline Markup</a>, above. <a class="reference" href="#inline-hyperlink-targets">Inline
hyperlink targets</a> are also possible.</p>
<p>Section headers are implicit targets, referred to by name. See
diff --git a/docutils/test/functional/expected/standalone_rst_latex.tex b/docutils/test/functional/expected/standalone_rst_latex.tex
index 9f57af6ea..23d16de34 100644
--- a/docutils/test/functional/expected/standalone_rst_latex.tex
+++ b/docutils/test/functional/expected/standalone_rst_latex.tex
@@ -772,7 +772,7 @@ citation.
\hypertarget{targets}{}
\pdfbookmark[1]{2.13~~~Targets}{targets}
\subsection*{2.13~~~Targets}
-\hypertarget{example}{}
+
This paragraph is pointed to by the explicit ``example'' target. A
reference can be found under \href{\#inline-markup}{Inline Markup}, above. \href{\#inline-hyperlink-targets}{Inline
hyperlink targets} are also possible.
diff --git a/docutils/test/test_nodes.py b/docutils/test/test_nodes.py
index ebf9da3f0..faeb61eb7 100755
--- a/docutils/test/test_nodes.py
+++ b/docutils/test/test_nodes.py
@@ -84,6 +84,27 @@ class ElementTests(unittest.TestCase):
element.clear()
self.assert_(not len(element))
+ def test_normal_attributes(self):
+ element = nodes.Element()
+ self.assert_(not element.has_key('foo'))
+ self.assertRaises(KeyError, element.__getitem__, 'foo')
+ element['foo'] = 'sometext'
+ self.assertEquals(element['foo'], 'sometext')
+ del element['foo']
+ self.assertRaises(KeyError, element.__getitem__, 'foo')
+
+ def test_default_attributes(self):
+ element = nodes.Element()
+ self.assertEquals(element['ids'], [])
+ self.assertEquals(element.non_default_attributes(), {})
+ self.assert_(not element.is_not_default('ids'))
+ self.assert_(element['ids'] is not nodes.Element()['ids'])
+ element['ids'].append('someid')
+ self.assertEquals(element['ids'], ['someid'])
+ self.assertEquals(element.non_default_attributes(),
+ {'ids': ['someid']})
+ self.assert_(element.is_not_default('ids'))
+
class MiscTests(unittest.TestCase):
@@ -91,7 +112,7 @@ class MiscTests(unittest.TestCase):
node_class_names = []
for x in dir(nodes):
c = getattr(nodes, x)
- if type(c) is ClassType and issubclass(c, nodes.Node) \
+ if isinstance(c, ClassType) and issubclass(c, nodes.Node) \
and len(c.__bases__) > 1:
node_class_names.append(x)
node_class_names.sort()
diff --git a/docutils/test/test_parsers/test_rst/test_citations.py b/docutils/test/test_parsers/test_rst/test_citations.py
index a92e151a4..c50e28e0b 100755
--- a/docutils/test/test_parsers/test_rst/test_citations.py
+++ b/docutils/test/test_parsers/test_rst/test_citations.py
@@ -25,7 +25,7 @@ totest['citations'] = [
""",
"""\
<document source="test data">
- <citation id="citation" name="citation">
+ <citation ids="citation" names="citation">
<label>
citation
<paragraph>
@@ -36,7 +36,7 @@ totest['citations'] = [
""",
"""\
<document source="test data">
- <citation id="citation1234" name="citation1234">
+ <citation ids="citation1234" names="citation1234">
<label>
citation1234
<paragraph>
@@ -48,7 +48,7 @@ totest['citations'] = [
""",
"""\
<document source="test data">
- <citation id="citation" name="citation">
+ <citation ids="citation" names="citation">
<label>
citation
<paragraph>
@@ -64,13 +64,13 @@ totest['citations'] = [
""",
"""\
<document source="test data">
- <citation id="citation1" name="citation1">
+ <citation ids="citation1" names="citation1">
<label>
citation1
<paragraph>
This is a citation
on multiple lines with more space.
- <citation id="citation2" name="citation2">
+ <citation ids="citation2" names="citation2">
<label>
citation2
<paragraph>
@@ -84,7 +84,7 @@ totest['citations'] = [
""",
"""\
<document source="test data">
- <citation id="citation" name="citation">
+ <citation ids="citation" names="citation">
<label>
citation
<paragraph>
@@ -98,7 +98,7 @@ That was an empty citation.
""",
"""\
<document source="test data">
- <citation id="citation" name="citation">
+ <citation ids="citation" names="citation">
<label>
citation
<paragraph>
@@ -110,7 +110,7 @@ No blank line.
""",
"""\
<document source="test data">
- <citation id="citation" name="citation">
+ <citation ids="citation" names="citation">
<label>
citation
<system_message level="2" line="2" source="test data" type="WARNING">
diff --git a/docutils/test/test_parsers/test_rst/test_definition_lists.py b/docutils/test/test_parsers/test_rst/test_definition_lists.py
index ee7d070f6..d9f3211c0 100755
--- a/docutils/test/test_parsers/test_rst/test_definition_lists.py
+++ b/docutils/test/test_parsers/test_rst/test_definition_lists.py
@@ -298,75 +298,75 @@ Term `with *inline ``text **errors : classifier `with *errors ``too
<definition_list_item>
<term>
Term \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`
with \n\
- <problematic id="id4" refid="id3">
+ <problematic ids="id4" refid="id3">
*
inline \n\
- <problematic id="id6" refid="id5">
+ <problematic ids="id6" refid="id5">
``
text \n\
- <problematic id="id8" refid="id7">
+ <problematic ids="id8" refid="id7">
**
errors
<classifier>
classifier \n\
- <problematic id="id10" refid="id9">
+ <problematic ids="id10" refid="id9">
`
with \n\
- <problematic id="id12" refid="id11">
+ <problematic ids="id12" refid="id11">
*
errors \n\
- <problematic id="id14" refid="id13">
+ <problematic ids="id14" refid="id13">
``
too
<definition>
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
- <system_message backrefs="id4" id="id3" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id4" ids="id3" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
- <system_message backrefs="id6" id="id5" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id6" ids="id5" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
- <system_message backrefs="id8" id="id7" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id8" ids="id7" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline strong start-string without end-string.
- <system_message backrefs="id10" id="id9" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id10" ids="id9" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
- <system_message backrefs="id12" id="id11" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id12" ids="id11" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
- <system_message backrefs="id14" id="id13" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id14" ids="id13" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
<paragraph>
Definition \n\
- <problematic id="id16" refid="id15">
+ <problematic ids="id16" refid="id15">
`
with \n\
- <problematic id="id18" refid="id17">
+ <problematic ids="id18" refid="id17">
*
inline \n\
- <problematic id="id20" refid="id19">
+ <problematic ids="id20" refid="id19">
``
text \n\
- <problematic id="id22" refid="id21">
+ <problematic ids="id22" refid="id21">
**
markup errors.
- <system_message backrefs="id16" id="id15" level="2" line="2" source="test data" type="WARNING">
+ <system_message backrefs="id16" ids="id15" level="2" line="2" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
- <system_message backrefs="id18" id="id17" level="2" line="2" source="test data" type="WARNING">
+ <system_message backrefs="id18" ids="id17" level="2" line="2" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
- <system_message backrefs="id20" id="id19" level="2" line="2" source="test data" type="WARNING">
+ <system_message backrefs="id20" ids="id19" level="2" line="2" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
- <system_message backrefs="id22" id="id21" level="2" line="2" source="test data" type="WARNING">
+ <system_message backrefs="id22" ids="id21" level="2" line="2" source="test data" type="WARNING">
<paragraph>
Inline strong start-string without end-string.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_admonitions.py b/docutils/test/test_parsers/test_rst/test_directives/test_admonitions.py
index af24935c1..aaa5aa8d3 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_admonitions.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_admonitions.py
@@ -127,7 +127,7 @@ totest['admonitions'] = [
""",
"""\
<document source="test data">
- <admonition class="admonition-admonition">
+ <admonition classes="admonition-admonition">
<title>
Admonition
<paragraph>
@@ -140,7 +140,7 @@ totest['admonitions'] = [
""",
"""\
<document source="test data">
- <admonition class="admonition-and-by-the-way">
+ <admonition classes="admonition-and-by-the-way">
<title>
And, by the way...
<paragraph>
@@ -154,7 +154,7 @@ totest['admonitions'] = [
""",
"""\
<document source="test data">
- <admonition class="emergency">
+ <admonition classes="emergency">
<title>
Admonition
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_contents.py b/docutils/test/test_parsers/test_rst/test_directives/test_contents.py
index a37d4c06d..7577152cc 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_contents.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_contents.py
@@ -25,7 +25,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
<pending>
@@ -38,7 +38,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table of Contents
<pending>
@@ -52,7 +52,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table of Contents
<pending>
@@ -67,7 +67,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table
of
@@ -82,7 +82,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
<emphasis>
Table
@@ -101,7 +101,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<pending>
.. internal attributes:
.transform: docutils.transforms.parts.Contents
@@ -132,7 +132,7 @@ totest['contents'] = [
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table of Contents
<pending>
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_include.py b/docutils/test/test_parsers/test_rst/test_directives/test_include.py
index 31544dd6e..2b0c33b09 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_include.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_include.py
@@ -47,10 +47,10 @@ A paragraph.
""" % include1,
"""\
<document source="test data">
- <section id="include-test" name="include test">
+ <section ids="include-test" names="include test">
<title>
Include Test
- <section id="inclusion-1" name="inclusion 1">
+ <section ids="inclusion-1" names="inclusion 1">
<title>
Inclusion 1
<paragraph>
@@ -72,7 +72,7 @@ A paragraph.
""" % include1,
"""\
<document source="test data">
- <section id="include-test" name="include test">
+ <section ids="include-test" names="include test">
<title>
Include Test
<literal_block source="%s" xml:space="preserve">
@@ -120,7 +120,7 @@ A paragraph.
""",
"""\
<document source="test data">
- <section id="include-test" name="include test">
+ <section ids="include-test" names="include test">
<title>
Include Test
<system_message level="4" line="4" source="test data" type="SEVERE">
@@ -144,10 +144,10 @@ A paragraph.
""" % (include1, include1),
"""\
<document source="test data">
- <section id="include-test" name="include test">
+ <section ids="include-test" names="include test">
<title>
Include Test
- <section dupname="inclusion 1" id="inclusion-1">
+ <section dupnames="inclusion 1" ids="inclusion-1">
<title>
Inclusion 1
<paragraph>
@@ -155,7 +155,7 @@ A paragraph.
<literal>
test_include.py
.
- <section dupname="inclusion 1" id="id1">
+ <section dupnames="inclusion 1" ids="id1">
<title>
Inclusion 1
<system_message backrefs="id1" level="1" line="2" source="%s" type="INFO">
@@ -183,10 +183,10 @@ A paragraph.
""" % (include1, include1),
"""\
<document source="test data">
- <section id="include-test" name="include test">
+ <section ids="include-test" names="include test">
<title>
Include Test
- <section dupname="inclusion 1" id="inclusion-1">
+ <section dupnames="inclusion 1" ids="inclusion-1">
<title>
Inclusion 1
<paragraph>
@@ -195,7 +195,7 @@ A paragraph.
test_include.py
.
<transition>
- <section dupname="inclusion 1" id="id1">
+ <section dupnames="inclusion 1" ids="id1">
<title>
Inclusion 1
<system_message backrefs="id1" level="1" line="2" source="%s" type="INFO">
@@ -243,7 +243,7 @@ Section
<document source="test data">
<paragraph>
In test data
- <section id="section" name="section">
+ <section ids="section" names="section">
<title>
Section
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_line_blocks.py b/docutils/test/test_parsers/test_rst/test_directives/test_line_blocks.py
index f8d156e4b..131ceaa05 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_line_blocks.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_line_blocks.py
@@ -52,13 +52,13 @@ totest['line_blocks'] = [
<line_block>
<line>
Inline markup \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
may not span
<line_block>
<line>
multiple lines* of a line block.
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_replace.py b/docutils/test/test_parsers/test_rst/test_directives/test_replace.py
index 6de59d3a4..f5fd2495b 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_replace.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_replace.py
@@ -33,7 +33,7 @@ Test the |name| directive.
<substitution_reference refname="name">
name
directive.
- <substitution_definition name="name">
+ <substitution_definition names="name">
"
<strong>
replace
@@ -80,12 +80,12 @@ I recommend you try |Python|_.
""",
"""\
<document source="test data">
- <substitution_definition name="Python">
+ <substitution_definition names="Python">
Python,
<emphasis>
the
best language around
- <target id="python" name="python" refuri="http://www.python.org/">
+ <target ids="python" names="python" refuri="http://www.python.org/">
<paragraph>
I recommend you try
<reference refname="python">
@@ -98,13 +98,13 @@ I recommend you try |Python|_.
""",
"""\
<document source="test data">
- <system_message id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
- <system_message id="id3" level="2" line="1" source="test data" type="WARNING">
+ <system_message ids="id3" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline strong start-string without end-string.
- <system_message id="id5" level="2" line="1" source="test data" type="WARNING">
+ <system_message ids="id5" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
<system_message level="3" line="1" source="test data" type="ERROR">
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_role.py b/docutils/test/test_parsers/test_rst/test_directives/test_role.py
index 8fcfa9081..0cd10c967 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_role.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_role.py
@@ -30,10 +30,10 @@ totest['role'] = [
"""\
<document source="test data">
<paragraph>
- <inline class="custom">
+ <inline classes="custom">
interpreted
and \n\
- <inline class="special">
+ <inline classes="special">
interpreted
"""],
["""\
@@ -47,10 +47,10 @@ totest['role'] = [
"""\
<document source="test data">
<paragraph>
- <inline class="custom-class">
+ <inline classes="custom-class">
interpreted
and \n\
- <inline class="special-class">
+ <inline classes="special-class">
interpreted
"""],
["""\
@@ -64,19 +64,19 @@ Now that it's defined, :custom:`interpreted` works.
<document source="test data">
<paragraph>
Must define
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:custom:`interpreted`
before using it.
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
No role entry for "custom" in module "docutils.parsers.rst.languages.en".
Trying "custom" as canonical role name.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Unknown interpreted text role "custom".
<paragraph>
Now that it's defined, \n\
- <inline class="custom">
+ <inline classes="custom">
interpreted
works.
"""],
@@ -88,7 +88,7 @@ Now that it's defined, :custom:`interpreted` works.
"""\
<document source="test data">
<paragraph>
- <emphasis class="custom">
+ <emphasis classes="custom">
text
"""],
["""\
@@ -99,7 +99,7 @@ Now that it's defined, :custom:`interpreted` works.
"""\
<document source="test data">
<paragraph>
- <emphasis class="custom">
+ <emphasis classes="custom">
text
"""],
["""\
@@ -111,7 +111,7 @@ Now that it's defined, :custom:`interpreted` works.
"""\
<document source="test data">
<paragraph>
- <emphasis class="special">
+ <emphasis classes="special">
text
"""],
["""\
@@ -166,12 +166,12 @@ Testing a :fileref:`role` in a nested parse.
""",
"""\
<document source="test data">
- <section id="test" name="test">
+ <section ids="test" names="test">
<title>
Test
<paragraph>
Testing a \n\
- <emphasis class="fileref">
+ <emphasis classes="fileref">
role
in a nested parse.
"""],
@@ -188,7 +188,7 @@ Here's some :html:`<i>raw HTML data</i>`.
<document source="test data">
<paragraph>
Here's some \n\
- <raw class="html" format="html" xml:space="preserve">
+ <raw classes="html" format="html" xml:space="preserve">
<i>raw HTML data</i>
.
"""],
@@ -202,7 +202,7 @@ Here's some itex markup: :itex:`$x^\\infty$`.
<document source="test data">
<paragraph>
Here's some itex markup: \n\
- <raw class="itex" format="latex html" xml:space="preserve">
+ <raw classes="itex" format="latex html" xml:space="preserve">
$x^\\infty$
.
"""],
@@ -213,10 +213,10 @@ Can't use the :raw:`role` directly.
<document source="test data">
<paragraph>
Can't use the \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:raw:`role`
directly.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
No format (Writer name) is associated with this role: "raw".
The "raw" role cannot be used directly.
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_tables.py b/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
index ab03f8518..7f1c54798 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_tables.py
@@ -45,7 +45,7 @@ totest['table'] = [
""",
"""\
<document source="test data">
- <table class="custom">
+ <table classes="custom">
<title>
Truth table for "not"
<tgroup cols="2">
@@ -87,7 +87,7 @@ totest['table'] = [
<table>
<title>
title with an \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
error
<tgroup cols="2">
@@ -101,7 +101,7 @@ totest['table'] = [
<entry>
<paragraph>
table
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
"""],
@@ -459,7 +459,7 @@ u"""\
<table>
<title>
error in the \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
title
<tgroup cols="3">
@@ -477,7 +477,7 @@ u"""\
<entry>
<paragraph>
data
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_directives/test_unicode.py b/docutils/test/test_parsers/test_rst/test_directives/test_unicode.py
index 3de704233..526182a62 100755
--- a/docutils/test/test_parsers/test_rst/test_directives/test_unicode.py
+++ b/docutils/test/test_parsers/test_rst/test_directives/test_unicode.py
@@ -51,16 +51,16 @@ u"""\
<substitution_reference refname="Omega">
Omega
).
- <substitution_definition name="mdash">
+ <substitution_definition names="mdash">
\u2014
- <substitution_definition name="copy">
+ <substitution_definition names="copy">
\u00A9
- <substitution_definition name="nbsp">
+ <substitution_definition names="nbsp">
\u00A0
- <substitution_definition name="bne">
+ <substitution_definition names="bne">
=
\u20e5
- <substitution_definition name="Omega">
+ <substitution_definition names="Omega">
\u03a9
"""],
["""
@@ -92,9 +92,9 @@ Bad input:
Substitution definition "empty too" empty or invalid.
<literal_block xml:space="preserve">
.. |empty too| unicode:: .. comment doesn't count as content
- <substitution_definition name="not hex">
+ <substitution_definition names="not hex">
0xHEX
- <substitution_definition name="not all hex">
+ <substitution_definition names="not all hex">
UABCX
<system_message level="3" line="8" source="test data" type="ERROR">
<paragraph>
@@ -123,9 +123,9 @@ u"""\
<substitution_reference refname="BogusMegaCorp (TM)">
BogusMegaCorp (TM)
.
- <substitution_definition name="copy">
+ <substitution_definition names="copy">
\u00A9
- <substitution_definition name="BogusMegaCorp (TM)">
+ <substitution_definition names="BogusMegaCorp (TM)">
BogusMegaCorp
\u2122
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_field_lists.py b/docutils/test/test_parsers/test_rst/test_field_lists.py
index cfc001705..4bda460bf 100755
--- a/docutils/test/test_parsers/test_rst/test_field_lists.py
+++ b/docutils/test/test_parsers/test_rst/test_field_lists.py
@@ -444,11 +444,11 @@ Nested field lists on one line:
<field>
<field_name>
Field name with \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
bad inline markup
<field_body>
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_footnotes.py b/docutils/test/test_parsers/test_rst/test_footnotes.py
index 49bff5a4b..cca255cbc 100755
--- a/docutils/test/test_parsers/test_rst/test_footnotes.py
+++ b/docutils/test/test_parsers/test_rst/test_footnotes.py
@@ -25,7 +25,7 @@ totest['footnotes'] = [
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
@@ -37,7 +37,7 @@ totest['footnotes'] = [
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
@@ -53,13 +53,13 @@ totest['footnotes'] = [
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
This is a footnote
on multiple lines with more space.
- <footnote id="id2" name="2">
+ <footnote ids="id2" names="2">
<label>
2
<paragraph>
@@ -73,7 +73,7 @@ totest['footnotes'] = [
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
@@ -87,7 +87,7 @@ That was an empty footnote.
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
@@ -99,7 +99,7 @@ No blank line.
""",
"""\
<document source="test data">
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<system_message level="2" line="2" source="test data" type="WARNING">
@@ -124,21 +124,21 @@ totest['auto_numbered_footnotes'] = [
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1">
+ <footnote_reference auto="1" ids="id1">
is the first auto-numbered footnote reference.
- <footnote_reference auto="1" id="id2">
+ <footnote_reference auto="1" ids="id2">
is the second auto-numbered footnote reference.
- <footnote auto="1" id="id3">
+ <footnote auto="1" ids="id3">
<paragraph>
Auto-numbered footnote 1.
- <footnote auto="1" id="id4">
+ <footnote auto="1" ids="id4">
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" id="id5">
+ <footnote auto="1" ids="id5">
<paragraph>
Auto-numbered footnote 3.
<paragraph>
- <footnote_reference auto="1" id="id6">
+ <footnote_reference auto="1" ids="id6">
is the third auto-numbered footnote reference.
"""],
["""\
@@ -158,23 +158,23 @@ the footnotes: first_, second_, third_.
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1" refname="third">
+ <footnote_reference auto="1" ids="id1" refname="third">
is a reference to the third auto-numbered footnote.
- <footnote auto="1" id="first" name="first">
+ <footnote auto="1" ids="first" names="first">
<paragraph>
First auto-numbered footnote.
- <footnote auto="1" id="second" name="second">
+ <footnote auto="1" ids="second" names="second">
<paragraph>
Second auto-numbered footnote.
- <footnote auto="1" id="third" name="third">
+ <footnote auto="1" ids="third" names="third">
<paragraph>
Third auto-numbered footnote.
<paragraph>
- <footnote_reference auto="1" id="id2" refname="second">
+ <footnote_reference auto="1" ids="id2" refname="second">
is a reference to the second auto-numbered footnote.
- <footnote_reference auto="1" id="id3" refname="first">
+ <footnote_reference auto="1" ids="id3" refname="first">
is a reference to the first auto-numbered footnote.
- <footnote_reference auto="1" id="id4" refname="third">
+ <footnote_reference auto="1" ids="id4" refname="third">
is another reference to the third auto-numbered footnote.
<paragraph>
Here are some internal cross-references to the targets generated by
@@ -208,34 +208,34 @@ Mixed anonymous and labelled auto-numbered footnotes:
<paragraph>
Mixed anonymous and labelled auto-numbered footnotes:
<paragraph>
- <footnote_reference auto="1" id="id1" refname="four">
+ <footnote_reference auto="1" ids="id1" refname="four">
should be 4, \n\
- <footnote_reference auto="1" id="id2">
+ <footnote_reference auto="1" ids="id2">
should be 1,
- <footnote_reference auto="1" id="id3">
+ <footnote_reference auto="1" ids="id3">
should be 3, \n\
- <footnote_reference auto="1" id="id4">
+ <footnote_reference auto="1" ids="id4">
is one too many,
- <footnote_reference auto="1" id="id5" refname="two">
+ <footnote_reference auto="1" ids="id5" refname="two">
should be 2, and \n\
- <footnote_reference auto="1" id="id6" refname="six">
+ <footnote_reference auto="1" ids="id6" refname="six">
doesn't exist.
- <footnote auto="1" id="id7">
+ <footnote auto="1" ids="id7">
<paragraph>
Auto-numbered footnote 1.
- <footnote auto="1" id="two" name="two">
+ <footnote auto="1" ids="two" names="two">
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" id="id8">
+ <footnote auto="1" ids="id8">
<paragraph>
Auto-numbered footnote 3.
- <footnote auto="1" id="four" name="four">
+ <footnote auto="1" ids="four" names="four">
<paragraph>
Auto-numbered footnote 4.
- <footnote auto="1" dupname="five" id="five">
+ <footnote auto="1" dupnames="five" ids="five">
<paragraph>
Auto-numbered footnote 5.
- <footnote auto="1" dupname="five" id="id9">
+ <footnote auto="1" dupnames="five" ids="id9">
<system_message backrefs="id9" level="2" line="12" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "five".
@@ -265,50 +265,50 @@ and labelled auto-numbered footnotes:
Mixed manually-numbered, anonymous auto-numbered,
and labelled auto-numbered footnotes:
<paragraph>
- <footnote_reference auto="1" id="id1" refname="four">
+ <footnote_reference auto="1" ids="id1" refname="four">
should be 4, \n\
- <footnote_reference auto="1" id="id2">
+ <footnote_reference auto="1" ids="id2">
should be 2,
- <footnote_reference id="id3" refname="1">
+ <footnote_reference ids="id3" refname="1">
1
is 1, \n\
- <footnote_reference id="id4" refname="3">
+ <footnote_reference ids="id4" refname="3">
3
is 3,
- <footnote_reference auto="1" id="id5">
+ <footnote_reference auto="1" ids="id5">
should be 6, \n\
- <footnote_reference auto="1" id="id6">
+ <footnote_reference auto="1" ids="id6">
is one too many,
- <footnote_reference auto="1" id="id7" refname="five">
+ <footnote_reference auto="1" ids="id7" refname="five">
should be 5, and \n\
- <footnote_reference auto="1" id="id8" refname="six">
+ <footnote_reference auto="1" ids="id8" refname="six">
doesn't exist.
- <footnote id="id9" name="1">
+ <footnote ids="id9" names="1">
<label>
1
<paragraph>
Manually-numbered footnote 1.
- <footnote auto="1" id="id10">
+ <footnote auto="1" ids="id10">
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" id="four" name="four">
+ <footnote auto="1" ids="four" names="four">
<paragraph>
Auto-numbered footnote 4.
- <footnote id="id11" name="3">
+ <footnote ids="id11" names="3">
<label>
3
<paragraph>
Manually-numbered footnote 3
- <footnote auto="1" dupname="five" id="five">
+ <footnote auto="1" dupnames="five" ids="five">
<paragraph>
Auto-numbered footnote 5.
- <footnote auto="1" dupname="five" id="id12">
+ <footnote auto="1" dupnames="five" ids="id12">
<system_message backrefs="id12" level="2" line="14" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "five".
<paragraph>
Auto-numbered footnote 5 again (duplicate).
- <footnote auto="1" id="id13">
+ <footnote auto="1" ids="id13">
<paragraph>
Auto-numbered footnote 6.
"""],
@@ -320,7 +320,7 @@ totest['auto_symbol_footnotes'] = [
""",
"""\
<document source="test data">
- <footnote auto="*" id="id1">
+ <footnote auto="*" ids="id1">
<paragraph>
This is an auto-symbol footnote.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_inline_markup.py b/docutils/test/test_parsers/test_rst/test_inline_markup.py
index fa83132ac..598902370 100755
--- a/docutils/test/test_parsers/test_rst/test_inline_markup.py
+++ b/docutils/test/test_parsers/test_rst/test_inline_markup.py
@@ -47,10 +47,10 @@ across lines*
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
emphasis without closing asterisk
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
"""],
@@ -85,10 +85,10 @@ what about *this**?
the* *stars\* *inside
<paragraph>
(however, '
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
args' will trigger a warning and may be problematic)
- <system_message backrefs="id2" id="id1" level="2" line="5" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="5" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
<paragraph>
@@ -139,10 +139,10 @@ totest['strong'] = [
) but not (**) or '(** ' or x**2 or **kwargs or **
<paragraph>
(however, '
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
**
kwargs' will trigger a warning and may be problematic)
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Inline strong start-string without end-string.
"""],
@@ -168,10 +168,10 @@ Strong double asterisk: ******
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
**
strong without closing asterisks
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline strong start-string without end-string.
"""],
@@ -228,11 +228,11 @@ and may be problematic)
but not "``" or ``
<paragraph>
(however, \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
``
standalone TeX quotes'' will trigger a warning
and may be problematic)
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
"""],
@@ -253,10 +253,10 @@ Find the ```interpreted text``` in this paragraph!
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
``
literal without closing backquotes
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline literal start-string without end-string.
"""],
@@ -367,9 +367,9 @@ Invalid phrase reference:
<paragraph>
Invalid phrase reference:
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:role:`phrase reference`_
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Mismatch: both interpreted text role prefix and reference suffix.
"""],
@@ -383,9 +383,9 @@ Invalid phrase reference:
<paragraph>
Invalid phrase reference:
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`phrase reference`:role:_
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Mismatch: both interpreted text role suffix and reference suffix.
"""],
@@ -395,13 +395,13 @@ Invalid phrase reference:
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`
phrase \n\
<reference name="reference" refname="reference">
reference
without closing backquote
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
"""],
@@ -411,13 +411,13 @@ Invalid phrase reference:
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`
anonymous phrase \n\
<reference anonymous="1" name="reference">
reference
without closing backquote
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
"""],
@@ -432,7 +432,7 @@ totest['embedded_URIs'] = [
<paragraph>
<reference name="phrase reference" refuri="http://example.com">
phrase reference
- <target id="phrase-reference" name="phrase reference" refuri="http://example.com">
+ <target ids="phrase-reference" names="phrase reference" refuri="http://example.com">
"""],
["""\
`anonymous reference <http://example.com>`__
@@ -537,7 +537,7 @@ Relative URIs' reference text can be omitted:
<paragraph>
<reference name="reference" refuri="reference">
reference
- <target id="reference" name="reference" refuri="reference">
+ <target ids="reference" names="reference" refuri="reference">
<paragraph>
<reference name="anonymous" refuri="anonymous">
anonymous
@@ -556,19 +556,19 @@ _`Here is a TaRgeT` with case and spacial difficulties.
"""\
<document source="test data">
<paragraph>
- <target id="target" name="target">
+ <target ids="target" names="target">
target
<paragraph>
Here is \n\
- <target id="another-target" name="another target">
+ <target ids="another-target" names="another target">
another target
in some text. And \n\
- <target id="yet-another-target" name="yet another target">
+ <target ids="yet-another-target" names="yet another target">
yet
another target
, spanning lines.
<paragraph>
- <target id="here-is-a-target" name="here is a target">
+ <target ids="here-is-a-target" names="here is a target">
Here is a TaRgeT
with case and spacial difficulties.
"""],
@@ -583,10 +583,10 @@ And _`this`_ is just plain confusing.
But this isn't a _target; targets require backquotes.
<paragraph>
And \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
_`
this`_ is just plain confusing.
- <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
<paragraph>
Inline target start-string without end-string.
"""],
@@ -596,10 +596,10 @@ _`inline target without closing backquote
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
_`
inline target without closing backquote
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline target start-string without end-string.
"""],
@@ -612,7 +612,7 @@ totest['footnote_reference'] = [
"""\
<document source="test data">
<paragraph>
- <footnote_reference id="id1" refname="1">
+ <footnote_reference ids="id1" refname="1">
1
"""],
["""\
@@ -621,7 +621,7 @@ totest['footnote_reference'] = [
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1">
+ <footnote_reference auto="1" ids="id1">
"""],
["""\
[#label]_
@@ -629,7 +629,7 @@ totest['footnote_reference'] = [
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1" refname="label">
+ <footnote_reference auto="1" ids="id1" refname="label">
"""],
["""\
[*]_
@@ -637,7 +637,7 @@ totest['footnote_reference'] = [
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="*" id="id1">
+ <footnote_reference auto="*" ids="id1">
"""],
]
@@ -648,7 +648,7 @@ totest['citation_reference'] = [
"""\
<document source="test data">
<paragraph>
- <citation_reference id="id1" refname="citation">
+ <citation_reference ids="id1" refname="citation">
citation
"""],
["""\
@@ -657,16 +657,16 @@ totest['citation_reference'] = [
"""\
<document source="test data">
<paragraph>
- <citation_reference id="id1" refname="citation">
+ <citation_reference ids="id1" refname="citation">
citation
and \n\
- <citation_reference id="id2" refname="cit-ation">
+ <citation_reference ids="id2" refname="cit-ation">
cit-ation
and \n\
- <citation_reference id="id3" refname="cit.ation">
+ <citation_reference ids="id3" refname="cit.ation">
cit.ation
and \n\
- <citation_reference id="id4" refname="cit1">
+ <citation_reference ids="id4" refname="cit1">
CIT1
but not [CIT 1]_
"""],
@@ -722,10 +722,10 @@ reference|
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
|
substitution reference without closing verbar
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline substitution_reference start-string without end-string.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_interpreted.py b/docutils/test/test_parsers/test_rst/test_interpreted.py
index 057cd0fb8..a5392d497 100755
--- a/docutils/test/test_parsers/test_rst/test_interpreted.py
+++ b/docutils/test/test_parsers/test_rst/test_interpreted.py
@@ -100,10 +100,10 @@ totest['basics'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`
interpreted without closing backquote
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline interpreted text or phrase reference start-string without end-string.
"""],
@@ -191,9 +191,9 @@ totest['references'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:PEP:`-1`
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
PEP number must be a number from 0 to 9999; "-1" is invalid.
"""],
@@ -212,9 +212,9 @@ totest['references'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:RFC:`0`
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
RFC number must be a number greater than or equal to 1; "0" is invalid.
"""],
@@ -227,13 +227,13 @@ totest['unknown_roles'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:role:`interpreted`
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
No role entry for "role" in module "docutils.parsers.rst.languages.en".
Trying "role" as canonical role name.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Unknown interpreted text role "role".
"""],
@@ -243,13 +243,13 @@ totest['unknown_roles'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
`interpreted`:role:
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
No role entry for "role" in module "docutils.parsers.rst.languages.en".
Trying "role" as canonical role name.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Unknown interpreted text role "role".
"""],
@@ -259,9 +259,9 @@ totest['unknown_roles'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:role:`interpreted`:role:
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Multiple roles in interpreted text (both prefix and suffix present; only one allowed).
"""],
@@ -271,13 +271,13 @@ totest['unknown_roles'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:very.long-role_name:`interpreted`
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
No role entry for "very.long-role_name" in module "docutils.parsers.rst.languages.en".
Trying "very.long-role_name" as canonical role name.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Unknown interpreted text role "very.long-role_name".
"""],
@@ -287,13 +287,13 @@ totest['unknown_roles'] = [
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
:restructuredtext-unimplemented-role:`interpreted`
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
No role entry for "restructuredtext-unimplemented-role" in module "docutils.parsers.rst.languages.en".
Trying "restructuredtext-unimplemented-role" as canonical role name.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Interpreted text role "restructuredtext-unimplemented-role" not implemented.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_line_blocks.py b/docutils/test/test_parsers/test_rst/test_line_blocks.py
index b41a27167..10eaa8354 100755
--- a/docutils/test/test_parsers/test_rst/test_line_blocks.py
+++ b/docutils/test/test_parsers/test_rst/test_line_blocks.py
@@ -246,16 +246,16 @@ This is not
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
|
This is not
- <problematic id="id4" refid="id3">
+ <problematic ids="id4" refid="id3">
|
a line block
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline substitution_reference start-string without end-string.
- <system_message backrefs="id4" id="id3" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id4" ids="id3" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline substitution_reference start-string without end-string.
<line_block>
@@ -265,10 +265,10 @@ This is not
<paragraph>
Line block ends without a blank line.
<paragraph>
- <problematic id="id6" refid="id5">
+ <problematic ids="id6" refid="id5">
|
incomplete line block.
- <system_message backrefs="id6" id="id5" level="2" line="5" source="test data" type="WARNING">
+ <system_message backrefs="id6" ids="id5" level="2" line="5" source="test data" type="WARNING">
<paragraph>
Inline substitution_reference start-string without end-string.
"""],
@@ -281,12 +281,12 @@ This is not
<line_block>
<line>
Inline markup \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
*
may not
<line>
wrap* over several lines.
- <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
+ <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
<paragraph>
Inline emphasis start-string without end-string.
"""],
diff --git a/docutils/test/test_parsers/test_rst/test_section_headers.py b/docutils/test/test_parsers/test_rst/test_section_headers.py
index f95ee6f89..e1557fcb9 100755
--- a/docutils/test/test_parsers/test_rst/test_section_headers.py
+++ b/docutils/test/test_parsers/test_rst/test_section_headers.py
@@ -26,7 +26,7 @@ Paragraph.
""",
"""\
<document source="test data">
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -39,7 +39,7 @@ Paragraph (no blank line).
""",
"""\
<document source="test data">
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -57,7 +57,7 @@ Paragraph.
<document source="test data">
<paragraph>
Paragraph.
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -110,7 +110,7 @@ Test short underline.
""",
"""\
<document source="test data">
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<system_message level="2" line="2" source="test data" type="WARNING">
@@ -131,7 +131,7 @@ Test overline title.
""",
"""\
<document source="test data">
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -146,7 +146,7 @@ Test overline title with inset.
""",
"""\
<document source="test data">
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -205,7 +205,7 @@ Test long title and space normalization.
""",
"""\
<document source="test data">
- <section id="long-title" name="long title">
+ <section ids="long-title" names="long title">
<title>
Long Title
<system_message level="2" line="1" source="test data" type="WARNING">
@@ -306,22 +306,22 @@ Paragraph 4.
<document source="test data">
<comment xml:space="preserve">
Test return to existing, highest-level section (Title 3).
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title>
Title 4
<paragraph>
@@ -354,22 +354,22 @@ Paragraph 4.
<document source="test data">
<paragraph>
Test return to existing, highest-level section (Title 3, with overlines).
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title>
Title 4
<paragraph>
@@ -398,22 +398,22 @@ Paragraph 4.
<document source="test data">
<paragraph>
Test return to existing, higher-level section (Title 4).
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title>
Title 4
<paragraph>
@@ -442,17 +442,17 @@ Paragraph 4.
<document source="test data">
<paragraph>
Test bad subsection order (Title 4).
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
@@ -493,17 +493,17 @@ Paragraph 4.
<document source="test data">
<paragraph>
Test bad subsection order (Title 4, with overlines).
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
@@ -526,7 +526,7 @@ Paragraph.
""",
"""\
<document source="test data">
- <section id="title-containing-inline-markup" name="title containing inline markup">
+ <section ids="title-containing-inline-markup" names="title containing inline markup">
<title>
Title containing \n\
<emphasis>
@@ -545,7 +545,7 @@ Paragraph.
""",
"""\
<document source="test data">
- <section id="numbered-title" name="1. numbered title">
+ <section ids="numbered-title" names="1. numbered title">
<title>
1. Numbered Title
<paragraph>
@@ -571,7 +571,7 @@ Paragraph.
<system_message level="2" line="3" source="test data" type="WARNING">
<paragraph>
Enumerated list ends without a blank line; unexpected unindent.
- <section id="numbered-title" name="3. numbered title">
+ <section ids="numbered-title" names="3. numbered title">
<title>
3. Numbered Title
<paragraph>
@@ -585,7 +585,7 @@ Short title.
""",
"""\
<document source="test data">
- <section id="abc" name="abc">
+ <section ids="abc" names="abc">
<title>
ABC
<paragraph>
@@ -788,14 +788,14 @@ Paragraph
<paragraph>
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
- <section dupname="..." id="id1">
+ <section dupnames="..." ids="id1">
<title>
...
<system_message level="1" line="4" source="test data" type="INFO">
<paragraph>
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
- <section dupname="..." id="id2">
+ <section dupnames="..." ids="id2">
<title>
...
<system_message backrefs="id2" level="1" line="5" source="test data" type="INFO">
@@ -809,7 +809,7 @@ Paragraph
<paragraph>
Possible incomplete section title.
Treating the overline as ordinary text because it's so short.
- <section dupname="..." id="id3">
+ <section dupnames="..." ids="id3">
<title>
...
<system_message backrefs="id3" level="1" line="8" source="test data" type="INFO">
@@ -835,10 +835,10 @@ Ho
<system_message level="2" line="2" source="test data" type="WARNING">
<paragraph>
Explicit markup ends without a blank line; unexpected unindent.
- <section id="hi" name="hi">
+ <section ids="hi" names="hi">
<title>
Hi
- <section id="yo" name="yo">
+ <section ids="yo" names="yo">
<title>
Yo
<paragraph>
@@ -850,7 +850,7 @@ Empty Section
""",
"""\
<document source="test data">
- <section id="empty-section" name="empty section">
+ <section ids="empty-section" names="empty section">
<title>
Empty Section
"""],
@@ -871,13 +871,13 @@ Without it, the parser ends up in an infinite loop.
""",
"""\
<document source="test data">
- <section id="one" name="one">
+ <section ids="one" names="one">
<title>
One
<paragraph>
The bubble-up parser strategy conflicts with short titles
(<= 3 char-long over- & underlines).
- <section id="two" name="two">
+ <section ids="two" names="two">
<title>
Two
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_substitutions.py b/docutils/test/test_parsers/test_rst/test_substitutions.py
index dbdf97e13..48e880c6e 100755
--- a/docutils/test/test_parsers/test_rst/test_substitutions.py
+++ b/docutils/test/test_parsers/test_rst/test_substitutions.py
@@ -29,7 +29,7 @@ Here's an image substitution definition:
<document source="test data">
<paragraph>
Here's an image substitution definition:
- <substitution_definition name="symbol">
+ <substitution_definition names="symbol">
<image alt="symbol" uri="symbol.png">
"""],
["""\
@@ -42,7 +42,7 @@ Embedded directive starts on the next line:
<document source="test data">
<paragraph>
Embedded directive starts on the next line:
- <substitution_definition name="symbol">
+ <substitution_definition names="symbol">
<image alt="symbol" uri="symbol.png">
"""],
["""\
@@ -55,7 +55,7 @@ Trailing spaces should not be significant:
<document source="test data">
<paragraph>
Trailing spaces should not be significant:
- <substitution_definition name="symbol">
+ <substitution_definition names="symbol">
<image alt="symbol" uri="symbol.png">
"""],
["""\
@@ -71,11 +71,11 @@ Here's a series of substitution definitions:
<document source="test data">
<paragraph>
Here's a series of substitution definitions:
- <substitution_definition name="symbol 1">
+ <substitution_definition names="symbol 1">
<image alt="symbol 1" uri="symbol1.png">
- <substitution_definition name="SYMBOL 2">
+ <substitution_definition names="SYMBOL 2">
<image alt="SYMBOL 2" height="50" uri="symbol2.png" width="100">
- <substitution_definition name="symbol 3">
+ <substitution_definition names="symbol 3">
<image alt="symbol 3" uri="symbol3.png">
"""],
["""\
@@ -84,7 +84,7 @@ Here's a series of substitution definitions:
""",
"""\
<document source="test data">
- <substitution_definition name="very long substitution text, split across lines">
+ <substitution_definition names="very long substitution text, split across lines">
<image alt="very long substitution text, split across lines" uri="symbol.png">
"""],
["""\
@@ -123,11 +123,11 @@ Followed by a paragraph.
""",
"""\
<document source="test data">
- <substitution_definition name="symbol 1">
+ <substitution_definition names="symbol 1">
<image alt="symbol 1" uri="symbol.png">
<paragraph>
Followed by a paragraph.
- <substitution_definition name="symbol 2">
+ <substitution_definition names="symbol 2">
<image alt="symbol 2" uri="symbol.png">
<comment xml:space="preserve">
<block_quote>
@@ -144,9 +144,9 @@ u"""\
<document source="test data">
<paragraph>
Substitutions support case differences:
- <substitution_definition name="eacute">
+ <substitution_definition names="eacute">
\u00E9
- <substitution_definition name="Eacute">
+ <substitution_definition names="Eacute">
\u00C9
"""],
["""\
@@ -160,7 +160,7 @@ Raw substitution, backslashes should be preserved:
<document source="test data">
<paragraph>
Raw substitution, backslashes should be preserved:
- <substitution_definition name="alpha">
+ <substitution_definition names="alpha">
<raw format="latex" xml:space="preserve">
$\\\\alpha$
"""],
@@ -174,12 +174,12 @@ Here are some duplicate substitution definitions:
<document source="test data">
<paragraph>
Here are some duplicate substitution definitions:
- <substitution_definition dupname="symbol">
+ <substitution_definition dupnames="symbol">
<image alt="symbol" uri="symbol.png">
<system_message level="3" line="4" source="test data" type="ERROR">
<paragraph>
Duplicate substitution definition name: "symbol".
- <substitution_definition name="symbol">
+ <substitution_definition names="symbol">
<image alt="symbol" uri="symbol.png">
"""],
["""\
@@ -205,7 +205,7 @@ No blank line after.
<document source="test data">
<paragraph>
Here are some bad cases:
- <substitution_definition name="symbol">
+ <substitution_definition names="symbol">
<image alt="symbol" uri="symbol.png">
<system_message level="2" line="4" source="test data" type="WARNING">
<paragraph>
diff --git a/docutils/test/test_parsers/test_rst/test_targets.py b/docutils/test/test_parsers/test_rst/test_targets.py
index 9f5d12672..9d846c142 100755
--- a/docutils/test/test_parsers/test_rst/test_targets.py
+++ b/docutils/test/test_parsers/test_rst/test_targets.py
@@ -27,7 +27,7 @@ totest['targets'] = [
""",
"""\
<document source="test data">
- <target id="target" name="target">
+ <target ids="target" names="target">
<paragraph>
(Internal hyperlink target.)
"""],
@@ -36,7 +36,7 @@ totest['targets'] = [
""",
"""\
<document source="test data">
- <target id="optional-space-before-colon" name="optional space before colon">
+ <target ids="optional-space-before-colon" names="optional space before colon">
"""],
["""\
External hyperlink targets:
@@ -57,10 +57,10 @@ External hyperlink targets:
<document source="test data">
<paragraph>
External hyperlink targets:
- <target id="one-liner" name="one-liner" refuri="http://structuredtext.sourceforge.net">
- <target id="starts-on-this-line" name="starts-on-this-line" refuri="http://structuredtext.sourceforge.net">
- <target id="entirely-below" name="entirely-below" refuri="http://structuredtext.sourceforge.net">
- <target id="not-indirect" name="not-indirect" refuri="uri_">
+ <target ids="one-liner" names="one-liner" refuri="http://structuredtext.sourceforge.net">
+ <target ids="starts-on-this-line" names="starts-on-this-line" refuri="http://structuredtext.sourceforge.net">
+ <target ids="entirely-below" names="entirely-below" refuri="http://structuredtext.sourceforge.net">
+ <target ids="not-indirect" names="not-indirect" refuri="uri_">
"""],
["""\
Indirect hyperlink targets:
@@ -73,8 +73,8 @@ Indirect hyperlink targets:
<document source="test data">
<paragraph>
Indirect hyperlink targets:
- <target id="target1" name="target1" refname="reference">
- <target id="target2" name="target2" refname="phrase-link reference">
+ <target ids="target1" names="target1" refname="reference">
+ <target ids="target2" names="target2" refname="phrase-link reference">
"""],
["""\
.. _a long target name:
@@ -85,9 +85,9 @@ Indirect hyperlink targets:
""",
"""\
<document source="test data">
- <target id="a-long-target-name" name="a long target name">
- <target id="a-target-name-including-a-colon-quoted" name="a target name: including a colon (quoted)">
- <target id="a-target-name-including-a-colon-escaped" name="a target name: including a colon (escaped)">
+ <target ids="a-long-target-name" names="a long target name">
+ <target ids="a-target-name-including-a-colon-quoted" names="a target name: including a colon (quoted)">
+ <target ids="a-target-name-including-a-colon-escaped" names="a target name: including a colon (escaped)">
"""],
["""\
.. _a very long target name,
@@ -97,8 +97,8 @@ Indirect hyperlink targets:
""",
"""\
<document source="test data">
- <target id="a-very-long-target-name-split-across-lines" name="a very long target name, split across lines">
- <target id="and-another-with-backquotes" name="and another, with backquotes">
+ <target ids="a-very-long-target-name-split-across-lines" names="a very long target name, split across lines">
+ <target ids="and-another-with-backquotes" names="and another, with backquotes">
"""],
["""\
External hyperlink:
@@ -109,7 +109,7 @@ External hyperlink:
<document source="test data">
<paragraph>
External hyperlink:
- <target id="target" name="target" refuri="http://www.python.org/">
+ <target ids="target" names="target" refuri="http://www.python.org/">
"""],
["""\
.. _email: jdoe@example.com
@@ -119,8 +119,8 @@ External hyperlink:
""",
"""\
<document source="test data">
- <target id="email" name="email" refuri="mailto:jdoe@example.com">
- <target id="multi-line-email" name="multi-line email" refuri="mailto:jdoe@example.com">
+ <target ids="email" names="email" refuri="mailto:jdoe@example.com">
+ <target ids="multi-line-email" names="multi-line email" refuri="mailto:jdoe@example.com">
"""],
["""\
Duplicate external targets (different URIs):
@@ -133,11 +133,11 @@ Duplicate external targets (different URIs):
<document source="test data">
<paragraph>
Duplicate external targets (different URIs):
- <target dupname="target" id="target" refuri="first">
+ <target dupnames="target" ids="target" refuri="first">
<system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "target".
- <target dupname="target" id="id1" refuri="second">
+ <target dupnames="target" ids="id1" refuri="second">
"""],
["""\
Duplicate external targets (same URIs):
@@ -150,11 +150,11 @@ Duplicate external targets (same URIs):
<document source="test data">
<paragraph>
Duplicate external targets (same URIs):
- <target id="target" name="target" refuri="first">
+ <target ids="target" names="target" refuri="first">
<system_message backrefs="id1" level="1" line="5" source="test data" type="INFO">
<paragraph>
Duplicate explicit target name: "target".
- <target dupname="target" id="id1" refuri="first">
+ <target dupnames="target" ids="id1" refuri="first">
"""],
["""\
Duplicate implicit targets.
@@ -173,12 +173,12 @@ Paragraph.
<document source="test data">
<paragraph>
Duplicate implicit targets.
- <section dupname="title" id="title">
+ <section dupnames="title" ids="title">
<title>
Title
<paragraph>
Paragraph.
- <section dupname="title" id="id1">
+ <section dupnames="title" ids="id1">
<title>
Title
<system_message backrefs="id1" level="1" line="9" source="test data" type="INFO">
@@ -201,13 +201,13 @@ Paragraph.
<document source="test data">
<paragraph>
Duplicate implicit/explicit targets.
- <section dupname="title" id="title">
+ <section dupnames="title" ids="title">
<title>
Title
<system_message backrefs="id1" level="1" line="6" source="test data" type="INFO">
<paragraph>
Duplicate implicit target name: "title".
- <target id="id1" name="title">
+ <target ids="id1" names="title">
<paragraph>
Paragraph.
"""],
@@ -230,19 +230,19 @@ Third.
<document source="test data">
<paragraph>
Duplicate explicit targets.
- <target dupname="title" id="title">
+ <target dupnames="title" ids="title">
<paragraph>
First.
<system_message backrefs="id1" level="2" line="7" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "title".
- <target dupname="title" id="id1">
+ <target dupnames="title" ids="id1">
<paragraph>
Second.
<system_message backrefs="id2" level="2" line="11" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "title".
- <target dupname="title" id="id2">
+ <target dupnames="title" ids="id2">
<paragraph>
Third.
"""],
@@ -268,12 +268,12 @@ Explicit internal target.
<document source="test data">
<paragraph>
Duplicate targets:
- <section dupname="target" id="target">
+ <section dupnames="target" ids="target">
<title>
Target
<paragraph>
Implicit section header target.
- <citation dupname="target" id="id1">
+ <citation dupnames="target" ids="id1">
<label>
target
<system_message backrefs="id1" level="1" line="8" source="test data" type="INFO">
@@ -281,7 +281,7 @@ Explicit internal target.
Duplicate implicit target name: "target".
<paragraph>
Citation target.
- <footnote auto="1" dupname="target" id="id2">
+ <footnote auto="1" dupnames="target" ids="id2">
<system_message backrefs="id2" level="2" line="10" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "target".
@@ -290,13 +290,13 @@ Explicit internal target.
<system_message backrefs="id3" level="2" line="12" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "target".
- <target dupname="target" id="id3">
+ <target dupnames="target" ids="id3">
<paragraph>
Explicit internal target.
<system_message backrefs="id4" level="2" line="16" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "target".
- <target dupname="target" id="id4" refuri="Explicit_external_target">
+ <target dupnames="target" ids="id4" refuri="Explicit_external_target">
"""],
]
@@ -310,7 +310,7 @@ Anonymous external hyperlink target:
<document source="test data">
<paragraph>
Anonymous external hyperlink target:
- <target anonymous="1" id="id1" refuri="http://w3c.org/">
+ <target anonymous="1" ids="id1" refuri="http://w3c.org/">
"""],
["""\
Anonymous external hyperlink target:
@@ -321,7 +321,7 @@ __ http://w3c.org/
<document source="test data">
<paragraph>
Anonymous external hyperlink target:
- <target anonymous="1" id="id1" refuri="http://w3c.org/">
+ <target anonymous="1" ids="id1" refuri="http://w3c.org/">
"""],
["""\
Anonymous indirect hyperlink target:
@@ -332,7 +332,7 @@ Anonymous indirect hyperlink target:
<document source="test data">
<paragraph>
Anonymous indirect hyperlink target:
- <target anonymous="1" id="id1" refname="reference">
+ <target anonymous="1" ids="id1" refname="reference">
"""],
["""\
Anonymous external hyperlink target, not indirect:
@@ -345,8 +345,8 @@ __ this URI ends with an underscore_
<document source="test data">
<paragraph>
Anonymous external hyperlink target, not indirect:
- <target anonymous="1" id="id1" refuri="uri_">
- <target anonymous="1" id="id2" refuri="thisURIendswithanunderscore_">
+ <target anonymous="1" ids="id1" refuri="uri_">
+ <target anonymous="1" ids="id2" refuri="thisURIendswithanunderscore_">
"""],
["""\
Anonymous indirect hyperlink targets:
@@ -359,8 +359,8 @@ __ `a very long
<document source="test data">
<paragraph>
Anonymous indirect hyperlink targets:
- <target anonymous="1" id="id1" refname="reference">
- <target anonymous="1" id="id2" refname="a very long reference">
+ <target anonymous="1" ids="id1" refname="reference">
+ <target anonymous="1" ids="id2" refname="a very long reference">
"""],
["""\
Mixed anonymous & named indirect hyperlink targets:
@@ -381,19 +381,19 @@ no blank line
<document source="test data">
<paragraph>
Mixed anonymous & named indirect hyperlink targets:
- <target anonymous="1" id="id1" refname="reference">
- <target anonymous="1" id="id2" refname="reference">
- <target anonymous="1" id="id3" refname="reference">
- <target id="target1" name="target1" refname="reference">
+ <target anonymous="1" ids="id1" refname="reference">
+ <target anonymous="1" ids="id2" refname="reference">
+ <target anonymous="1" ids="id3" refname="reference">
+ <target ids="target1" names="target1" refname="reference">
<system_message level="2" line="7" source="test data" type="WARNING">
<paragraph>
Explicit markup ends without a blank line; unexpected unindent.
<paragraph>
no blank line
- <target id="target2" name="target2" refname="reference">
- <target anonymous="1" id="id4" refname="reference">
- <target anonymous="1" id="id5" refname="reference">
- <target anonymous="1" id="id6" refname="reference">
+ <target ids="target2" names="target2" refname="reference">
+ <target anonymous="1" ids="id4" refname="reference">
+ <target anonymous="1" ids="id5" refname="reference">
+ <target anonymous="1" ids="id6" refname="reference">
<system_message level="2" line="13" source="test data" type="WARNING">
<paragraph>
Explicit markup ends without a blank line; unexpected unindent.
diff --git a/docutils/test/test_parsers/test_rst/test_transitions.py b/docutils/test/test_parsers/test_rst/test_transitions.py
index a143fd264..8b143832c 100755
--- a/docutils/test/test_parsers/test_rst/test_transitions.py
+++ b/docutils/test/test_parsers/test_rst/test_transitions.py
@@ -52,7 +52,7 @@ Paragraph 2 in section 2.
""",
"""\
<document source="test data">
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<paragraph>
@@ -60,7 +60,7 @@ Paragraph 2 in section 2.
<transition>
<paragraph>
Second text division of section 1.
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<paragraph>
@@ -162,14 +162,14 @@ Section 2
<document source="test data">
<paragraph>
Sections with transitions at beginning and end.
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<transition>
<paragraph>
The next transition is legal:
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<transition>
@@ -232,16 +232,16 @@ Some text.
""",
"""\
<document source="test data">
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
- <section id="subsection-1" name="subsection 1">
+ <section ids="subsection-1" names="subsection 1">
<title>
Subsection 1
<paragraph>
Some text.
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<paragraph>
@@ -264,13 +264,13 @@ Some text.
""",
"""\
<document source="test data">
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<transition>
<transition>
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<paragraph>
diff --git a/docutils/test/test_readers/test_pep/test_inline_markup.py b/docutils/test/test_readers/test_pep/test_inline_markup.py
index d2fc97321..4965af3d1 100755
--- a/docutils/test/test_readers/test_pep/test_inline_markup.py
+++ b/docutils/test/test_readers/test_pep/test_inline_markup.py
@@ -105,7 +105,7 @@ For *completeness*, _`let's` ``test`` **other** forms_
<emphasis>
completeness
, \n\
- <target id="let-s" name="let's">
+ <target ids="let-s" names="let's">
let's
\n\
<literal>
@@ -123,9 +123,9 @@ For *completeness*, _`let's` ``test`` **other** forms_
<title_reference>
inline markup
\n\
- <footnote_reference auto="*" id="id1">
+ <footnote_reference auto="*" ids="id1">
.
- <footnote auto="*" id="id2">
+ <footnote auto="*" ids="id2">
<paragraph>
See \n\
<reference refuri="http://docutils.sf.net/docs/ref/rst/restructuredtext.html">
diff --git a/docutils/test/test_readers/test_pep/test_rfc2822.py b/docutils/test/test_readers/test_pep/test_rfc2822.py
index f13de16d2..82fa27543 100755
--- a/docutils/test/test_readers/test_pep/test_rfc2822.py
+++ b/docutils/test/test_readers/test_pep/test_rfc2822.py
@@ -27,7 +27,7 @@ Date: 2002-04-23
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Author
@@ -58,7 +58,7 @@ Date: 2002-04-23
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Author
@@ -104,7 +104,7 @@ Date: 2002-04-23
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Author
@@ -121,7 +121,7 @@ empty item above, no blank line
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
field
@@ -142,7 +142,7 @@ Date:
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Author
@@ -173,7 +173,7 @@ Date: 2002-04-23
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Authors
@@ -208,7 +208,7 @@ Date: 2002-04-23
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Authors
@@ -240,7 +240,7 @@ Version:
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Authors
@@ -268,7 +268,7 @@ Version:
""",
"""\
<document source="test data">
- <field_list class="rfc2822">
+ <field_list classes="rfc2822">
<field>
<field_name>
Authors
diff --git a/docutils/test/test_transforms/test_class.py b/docutils/test/test_transforms/test_class.py
index 2825cdf28..6fc2b33a5 100755
--- a/docutils/test/test_transforms/test_class.py
+++ b/docutils/test/test_transforms/test_class.py
@@ -30,7 +30,7 @@ paragraph
""",
"""\
<document source="test data">
- <paragraph class="one">
+ <paragraph classes="one">
paragraph
"""],
["""\
@@ -42,7 +42,7 @@ paragraph
"""\
<document source="test data">
<comment xml:space="preserve">
- <block_quote class="two">
+ <block_quote classes="two">
<paragraph>
Block quote
"""],
@@ -58,7 +58,7 @@ Paragraph
<block_quote>
<paragraph>
Block quote
- <paragraph class="three">
+ <paragraph classes="three">
Paragraph
"""],
["""\
@@ -71,7 +71,7 @@ Paragraph
""",
"""\
<document source="test data">
- <section class="four" id="section-title" name="section title">
+ <section classes="four" ids="section-title" names="section title">
<title>
Section Title
<paragraph>
@@ -104,7 +104,7 @@ multiple class values may be assigned to one element
""",
"""\
<document source="test data">
- <paragraph class="one two">
+ <paragraph classes="one two">
multiple class values may be assigned to one element
"""],
["""\
@@ -114,7 +114,7 @@ multiple class values may be assigned to one element
""",
"""\
<document source="test data">
- <paragraph class="one two">
+ <paragraph classes="one two">
multiple class values may be assigned to one element
"""],
["""\
@@ -125,7 +125,7 @@ multiple class values may be assigned to one element
""",
"""\
<document source="test data">
- <enumerated_list class="fancy" enumtype="arabic" prefix="" start="2" suffix=".">
+ <enumerated_list classes="fancy" enumtype="arabic" prefix="" start="2" suffix=".">
<list_item>
<paragraph>
List starts at 2.
@@ -156,7 +156,7 @@ A paragraph.
<system_message level="1" line="1" source="test data" type="INFO">
<paragraph>
Enumerated list start value not ordinal-1: "2" (ordinal 2)
- <paragraph class="fancy">
+ <paragraph classes="fancy">
A paragraph.
"""],
])
diff --git a/docutils/test/test_transforms/test_contents.py b/docutils/test/test_transforms/test_contents.py
index 4c9d515a8..95cc098a6 100755
--- a/docutils/test/test_transforms/test_contents.py
+++ b/docutils/test/test_transforms/test_contents.py
@@ -46,50 +46,50 @@ Paragraph 4.
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="title-1">
+ <reference ids="id1" refid="title-1">
Title 1
<bullet_list>
<list_item>
<paragraph>
- <reference id="id2" refid="title-2">
+ <reference ids="id2" refid="title-2">
Title
2
<bullet_list>
<list_item>
<paragraph>
- <reference id="id3" refid="title-3">
+ <reference ids="id3" refid="title-3">
Title
3
<list_item>
<paragraph>
- <reference id="id4" refid="title-4">
+ <reference ids="id4" refid="title-4">
Title 4
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
<reference name="Title" refname="title">
Title
2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title refid="id3">
- <target id="title" name="title">
+ <target ids="title" names="title">
Title
3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title refid="id4">
Title 4
<paragraph>
@@ -108,25 +108,25 @@ Paragraph 2.
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table of Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="title-1">
+ <reference ids="id1" refid="title-1">
Title 1
<bullet_list>
<list_item>
<paragraph>
- <reference id="id2" refid="title-2">
+ <reference ids="id2" refid="title-2">
Title 2
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title refid="id2">
Title 2
<paragraph>
@@ -147,29 +147,29 @@ Paragraph 2.
""",
"""\
<document source="test data">
- <topic class="contents" id="there-s-an-image-in-title-2" name="there's an image in title 2">
+ <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's an image in title 2">
<title>
There's an image in Title 2
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="title-1">
+ <reference ids="id1" refid="title-1">
Title 1
<list_item>
<paragraph>
- <reference id="id2" refid="title-2">
+ <reference ids="id2" refid="title-2">
Title 2
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title refid="id2">
<image alt="Title 2" uri="title2.png">
<paragraph>
Paragraph 2.
- <substitution_definition name="Title 2">
+ <substitution_definition names="Title 2">
<image alt="Title 2" uri="title2.png">
"""], # emacs cruft: "
["""\
@@ -194,39 +194,39 @@ Paragraph 4.
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="title-1">
+ <reference ids="id1" refid="title-1">
Title 1
<bullet_list>
<list_item>
<paragraph>
- <reference id="id2" refid="title-2">
+ <reference ids="id2" refid="title-2">
Title 2
<list_item>
<paragraph>
- <reference id="id3" refid="title-4">
+ <reference ids="id3" refid="title-4">
Title 4
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title refid="id1">
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title refid="id2">
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title refid="id3">
Title 4
<paragraph>
@@ -255,37 +255,37 @@ Paragraph 4.
""",
"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title>
Title 1
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="title-2">
+ <reference ids="id1" refid="title-2">
Title 2
<bullet_list>
<list_item>
<paragraph>
- <reference id="id2" refid="title-3">
+ <reference ids="id2" refid="title-3">
Title 3
<list_item>
<paragraph>
- <reference id="id3" refid="title-4">
+ <reference ids="id3" refid="title-4">
Title 4
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title refid="id1">
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title refid="id2">
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title refid="id3">
Title 4
<paragraph>
@@ -303,15 +303,15 @@ Paragraph.
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="section">
+ <reference ids="id1" refid="section">
Section
<paragraph>
Test duplicate name "Contents".
- <section id="section" name="section">
+ <section ids="section" names="section">
<title refid="id1">
Section
<paragraph>
@@ -327,15 +327,15 @@ Paragraph.
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="section">
+ <reference ids="id1" refid="section">
Section
- <section id="section" name="section">
+ <section ids="section" names="section">
<title refid="contents">
Section
<paragraph>
@@ -351,15 +351,15 @@ Paragraph.
""",
"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="section">
+ <reference ids="id1" refid="section">
Section
- <section id="section" name="section">
+ <section ids="section" names="section">
<title>
Section
<paragraph>
diff --git a/docutils/test/test_transforms/test_docinfo.py b/docutils/test/test_transforms/test_docinfo.py
index dcab14a3b..d14d2c48f 100755
--- a/docutils/test/test_transforms/test_docinfo.py
+++ b/docutils/test/test_transforms/test_docinfo.py
@@ -52,7 +52,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [
<field_body>
<paragraph>
integer
- <topic class="abstract">
+ <topic classes="abstract">
<title>
Abstract
<paragraph>
@@ -105,7 +105,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [
<field_body>
<paragraph>
integer
- <topic class="abstract">
+ <topic classes="abstract">
<title>
Abstract
<paragraph>
diff --git a/docutils/test/test_transforms/test_doctitle.py b/docutils/test/test_transforms/test_doctitle.py
index 1e6bc1ee0..c196c38ec 100755
--- a/docutils/test/test_transforms/test_doctitle.py
+++ b/docutils/test/test_transforms/test_doctitle.py
@@ -33,7 +33,7 @@ Title
Paragraph.
""",
"""\
-<document id="title" name="title" source="test data">
+<document ids="title" names="title" source="test data">
<title>
Title
<comment xml:space="preserve">
@@ -47,7 +47,7 @@ Title
Paragraph (no blank line).
""",
"""\
-<document id="title" name="title" source="test data">
+<document ids="title" names="title" source="test data">
<title>
Title
<paragraph>
@@ -65,7 +65,7 @@ Paragraph.
<document source="test data">
<paragraph>
Paragraph.
- <section id="title" name="title">
+ <section ids="title" names="title">
<title>
Title
<paragraph>
@@ -81,10 +81,10 @@ Subtitle
Test title & subtitle.
""",
"""\
-<document id="title" name="title" source="test data">
+<document ids="title" names="title" source="test data">
<title>
Title
- <subtitle id="subtitle" name="subtitle">
+ <subtitle ids="subtitle" names="subtitle">
Subtitle
<paragraph>
Test title & subtitle.
@@ -96,7 +96,7 @@ Title
Test short underline.
""",
"""\
-<document id="title" name="title" source="test data">
+<document ids="title" names="title" source="test data">
<title>
Title
<system_message level="2" line="2" source="test data" type="WARNING">
@@ -118,7 +118,7 @@ The system_message should move after the document title
(it was before the beginning of the section).
""",
"""\
-<document id="long-title" name="long title" source="test data">
+<document ids="long-title" names="long title" source="test data">
<title>
Long Title
<system_message level="2" line="1" source="test data" type="WARNING">
@@ -149,19 +149,19 @@ Title 3
Paragraph 3.
""",
"""\
-<document id="title-1" name="title 1" source="test data">
+<document ids="title-1" names="title 1" source="test data">
<title>
Title 1
<comment xml:space="preserve">
Test multiple second-level titles.
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title>
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
@@ -178,12 +178,12 @@ This title should be the document title despite the
substitution_definition.
""",
"""\
-<document id="title" name="title" source="test data">
+<document ids="title" names="title" source="test data">
<title>
Title
- <substitution_definition name="foo">
+ <substitution_definition names="foo">
bar
- <target id="invisible-target" name="invisible target">
+ <target ids="invisible-target" names="invisible target">
<paragraph>
This title should be the document title despite the
substitution_definition.
diff --git a/docutils/test/test_transforms/test_final_checks.py b/docutils/test/test_transforms/test_final_checks.py
index efc6df75a..4d8a4ef88 100755
--- a/docutils/test/test_transforms/test_final_checks.py
+++ b/docutils/test/test_transforms/test_final_checks.py
@@ -31,10 +31,10 @@ Unknown reference_.
<document source="test data">
<paragraph>
Unknown \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
reference_
.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Unknown target name: "reference".
"""],
@@ -49,15 +49,15 @@ Duplicate manual footnote labels, with reference ([1]_):
<document source="test data">
<paragraph>
Duplicate manual footnote labels, with reference (
- <problematic id="id5" refid="id4">
+ <problematic ids="id5" refid="id4">
[1]_
):
- <footnote dupname="1" id="id2">
+ <footnote dupnames="1" ids="id2">
<label>
1
<paragraph>
Footnote.
- <footnote dupname="1" id="id3">
+ <footnote dupnames="1" ids="id3">
<label>
1
<system_message backrefs="id3" level="2" line="5" source="test data" type="WARNING">
@@ -65,7 +65,7 @@ Duplicate manual footnote labels, with reference ([1]_):
Duplicate explicit target name: "1".
<paragraph>
Footnote.
- <system_message backrefs="id5" id="id4" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id5" ids="id4" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Duplicate target name, cannot be used as a unique reference: "1".
"""],
@@ -93,16 +93,16 @@ Some text.
""",
"""\
<document source="test data">
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
- <section id="subsection-1" name="subsection 1">
+ <section ids="subsection-1" names="subsection 1">
<title>
Subsection 1
<paragraph>
Some text.
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<paragraph>
@@ -123,7 +123,7 @@ Paragraph.
<paragraph>
A paragraph.
<transition>
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<paragraph>
@@ -197,7 +197,7 @@ Section 2
<document source="test data">
<paragraph>
Sections with transitions at beginning and end.
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<system_message level="3" line="6" source="test data" type="ERROR">
@@ -207,7 +207,7 @@ Section 2
<paragraph>
The next transition is legal:
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<system_message level="3" line="15" source="test data" type="ERROR">
@@ -290,7 +290,7 @@ Some text.
""",
"""\
<document source="test data">
- <section id="section-1" name="section 1">
+ <section ids="section-1" names="section 1">
<title>
Section 1
<system_message level="3" line="4" source="test data" type="ERROR">
@@ -305,7 +305,7 @@ Some text.
<paragraph>
At least one body element must separate transitions; adjacent transitions are not allowed.
<transition>
- <section id="section-2" name="section 2">
+ <section ids="section-2" names="section 2">
<title>
Section 2
<paragraph>
diff --git a/docutils/test/test_transforms/test_footnotes.py b/docutils/test/test_transforms/test_footnotes.py
index 033f8fed0..f0a1a2ed0 100755
--- a/docutils/test/test_transforms/test_footnotes.py
+++ b/docutils/test/test_transforms/test_footnotes.py
@@ -32,9 +32,9 @@ totest['footnotes'] = ((Footnotes,), [
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1" refid="autolabel">
+ <footnote_reference auto="1" ids="id1" refid="autolabel">
1
- <footnote auto="1" backrefs="id1" id="autolabel" name="autolabel">
+ <footnote auto="1" backrefs="id1" ids="autolabel" names="autolabel">
<label>
1
<paragraph>
@@ -49,9 +49,9 @@ autonumber: [#]_
<document source="test data">
<paragraph>
autonumber: \n\
- <footnote_reference auto="1" id="id1" refid="id2">
+ <footnote_reference auto="1" ids="id1" refid="id2">
1
- <footnote auto="1" backrefs="id1" id="id2" name="1">
+ <footnote auto="1" backrefs="id1" ids="id2" names="1">
<label>
1
<paragraph>
@@ -70,29 +70,29 @@ autonumber: [#]_
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1" refid="id3">
+ <footnote_reference auto="1" ids="id1" refid="id3">
1
is the first auto-numbered footnote reference.
- <footnote_reference auto="1" id="id2" refid="id4">
+ <footnote_reference auto="1" ids="id2" refid="id4">
2
is the second auto-numbered footnote reference.
- <footnote auto="1" backrefs="id1" id="id3" name="1">
+ <footnote auto="1" backrefs="id1" ids="id3" names="1">
<label>
1
<paragraph>
Auto-numbered footnote 1.
- <footnote auto="1" backrefs="id2" id="id4" name="2">
+ <footnote auto="1" backrefs="id2" ids="id4" names="2">
<label>
2
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id6" id="id5" name="3">
+ <footnote auto="1" backrefs="id6" ids="id5" names="3">
<label>
3
<paragraph>
Auto-numbered footnote 3.
<paragraph>
- <footnote_reference auto="1" id="id6" refid="id5">
+ <footnote_reference auto="1" ids="id6" refid="id5">
3
is the third auto-numbered footnote reference.
"""],
@@ -113,32 +113,32 @@ generated by the footnotes: first_, second_, third_.
"""\
<document source="test data">
<paragraph>
- <footnote_reference auto="1" id="id1" refid="third">
+ <footnote_reference auto="1" ids="id1" refid="third">
3
is a reference to the third auto-numbered footnote.
- <footnote auto="1" backrefs="id3" id="first" name="first">
+ <footnote auto="1" backrefs="id3" ids="first" names="first">
<label>
1
<paragraph>
First auto-numbered footnote.
- <footnote auto="1" backrefs="id2" id="second" name="second">
+ <footnote auto="1" backrefs="id2" ids="second" names="second">
<label>
2
<paragraph>
Second auto-numbered footnote.
- <footnote auto="1" backrefs="id1 id4" id="third" name="third">
+ <footnote auto="1" backrefs="id1 id4" ids="third" names="third">
<label>
3
<paragraph>
Third auto-numbered footnote.
<paragraph>
- <footnote_reference auto="1" id="id2" refid="second">
+ <footnote_reference auto="1" ids="id2" refid="second">
2
is a reference to the second auto-numbered footnote.
- <footnote_reference auto="1" id="id3" refid="first">
+ <footnote_reference auto="1" ids="id3" refid="first">
1
is a reference to the first auto-numbered footnote.
- <footnote_reference auto="1" id="id4" refid="third">
+ <footnote_reference auto="1" ids="id4" refid="third">
3
is another reference to the third auto-numbered footnote.
<paragraph>
@@ -173,49 +173,49 @@ Mixed anonymous and labelled auto-numbered footnotes:
<paragraph>
Mixed anonymous and labelled auto-numbered footnotes:
<paragraph>
- <footnote_reference auto="1" id="id1" refid="four">
+ <footnote_reference auto="1" ids="id1" refid="four">
4
should be 4, \n\
- <footnote_reference auto="1" id="id2" refid="id7">
+ <footnote_reference auto="1" ids="id2" refid="id7">
1
should be 1,
- <footnote_reference auto="1" id="id3" refid="id8">
+ <footnote_reference auto="1" ids="id3" refid="id8">
3
should be 3, \n\
- <problematic id="id11" refid="id10">
+ <problematic ids="id11" refid="id10">
[#]_
is one too many,
- <footnote_reference auto="1" id="id5" refid="two">
+ <footnote_reference auto="1" ids="id5" refid="two">
2
should be 2, and \n\
- <footnote_reference auto="1" id="id6" refname="six">
+ <footnote_reference auto="1" ids="id6" refname="six">
doesn't exist.
- <footnote auto="1" backrefs="id2" id="id7" name="1">
+ <footnote auto="1" backrefs="id2" ids="id7" names="1">
<label>
1
<paragraph>
Auto-numbered footnote 1.
- <footnote auto="1" backrefs="id5" id="two" name="two">
+ <footnote auto="1" backrefs="id5" ids="two" names="two">
<label>
2
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id3" id="id8" name="3">
+ <footnote auto="1" backrefs="id3" ids="id8" names="3">
<label>
3
<paragraph>
Auto-numbered footnote 3.
- <footnote auto="1" backrefs="id1" id="four" name="four">
+ <footnote auto="1" backrefs="id1" ids="four" names="four">
<label>
4
<paragraph>
Auto-numbered footnote 4.
- <footnote auto="1" dupname="five" id="five">
+ <footnote auto="1" dupnames="five" ids="five">
<label>
5
<paragraph>
Auto-numbered footnote 5.
- <footnote auto="1" dupname="five" id="id9">
+ <footnote auto="1" dupnames="five" ids="id9">
<label>
6
<system_message backrefs="id9" level="2" line="12" source="test data" type="WARNING">
@@ -223,7 +223,7 @@ Mixed anonymous and labelled auto-numbered footnotes:
Duplicate explicit target name: "five".
<paragraph>
Auto-numbered footnote 5 again (duplicate).
- <system_message backrefs="id11" id="id10" level="3" line="3" source="test data" type="ERROR">
+ <system_message backrefs="id11" ids="id10" level="3" line="3" source="test data" type="ERROR">
<paragraph>
Too many autonumbered footnote references: only 2 corresponding footnotes available.
"""],
@@ -238,17 +238,17 @@ Mixed auto-numbered and manual footnotes:
<document source="test data">
<paragraph>
Mixed auto-numbered and manual footnotes:
- <footnote id="id1" name="1">
+ <footnote ids="id1" names="1">
<label>
1
<paragraph>
manually numbered
- <footnote auto="1" id="id2" name="2">
+ <footnote auto="1" ids="id2" names="2">
<label>
2
<paragraph>
auto-numbered
- <footnote auto="1" id="label" name="label">
+ <footnote auto="1" ids="label" names="label">
<label>
3
<paragraph>
@@ -268,20 +268,20 @@ An unlabeled autonumbered footnote referece: [#]_.
<document source="test data">
<paragraph>
A labeled autonumbered footnote referece: \n\
- <footnote_reference auto="1" id="id1" refid="footnote">
+ <footnote_reference auto="1" ids="id1" refid="footnote">
2
.
<paragraph>
An unlabeled autonumbered footnote referece: \n\
- <footnote_reference auto="1" id="id2" refid="id3">
+ <footnote_reference auto="1" ids="id2" refid="id3">
1
.
- <footnote auto="1" backrefs="id2" id="id3" name="1">
+ <footnote auto="1" backrefs="id2" ids="id3" names="1">
<label>
1
<paragraph>
Unlabeled autonumbered footnote.
- <footnote auto="1" backrefs="id1" id="footnote" name="footnote">
+ <footnote auto="1" backrefs="id1" ids="footnote" names="footnote">
<label>
2
<paragraph>
@@ -312,59 +312,59 @@ and labelled auto-numbered footnotes:
Mixed manually-numbered, anonymous auto-numbered,
and labelled auto-numbered footnotes:
<paragraph>
- <footnote_reference auto="1" id="id1" refid="four">
+ <footnote_reference auto="1" ids="id1" refid="four">
4
should be 4, \n\
- <footnote_reference auto="1" id="id2" refid="id10">
+ <footnote_reference auto="1" ids="id2" refid="id10">
2
should be 2,
- <footnote_reference id="id3" refid="id9">
+ <footnote_reference ids="id3" refid="id9">
1
is 1, \n\
- <footnote_reference id="id4" refid="id11">
+ <footnote_reference ids="id4" refid="id11">
3
is 3,
- <footnote_reference auto="1" id="id5" refid="id12">
+ <footnote_reference auto="1" ids="id5" refid="id12">
6
should be 6, \n\
- <problematic id="id15" refid="id14">
+ <problematic ids="id15" refid="id14">
[#]_
is one too many,
- <footnote_reference auto="1" id="id7" refname="five">
+ <footnote_reference auto="1" ids="id7" refname="five">
should be 5, and \n\
- <footnote_reference auto="1" id="id8" refname="eight">
+ <footnote_reference auto="1" ids="id8" refname="eight">
doesn't exist.
- <footnote backrefs="id3" id="id9" name="1">
+ <footnote backrefs="id3" ids="id9" names="1">
<label>
1
<paragraph>
Manually-numbered footnote 1.
- <footnote auto="1" backrefs="id2" id="id10" name="2">
+ <footnote auto="1" backrefs="id2" ids="id10" names="2">
<label>
2
<paragraph>
Auto-numbered footnote 2.
- <footnote auto="1" backrefs="id1" id="four" name="four">
+ <footnote auto="1" backrefs="id1" ids="four" names="four">
<label>
4
<paragraph>
Auto-numbered footnote 4.
- <footnote backrefs="id4" id="id11" name="3">
+ <footnote backrefs="id4" ids="id11" names="3">
<label>
3
<paragraph>
Manually-numbered footnote 3
- <footnote auto="1" dupname="five" id="five">
+ <footnote auto="1" dupnames="five" ids="five">
<label>
5
<paragraph>
Auto-numbered footnote 5.
- <footnote auto="1" backrefs="id5" id="id12" name="6">
+ <footnote auto="1" backrefs="id5" ids="id12" names="6">
<label>
6
<paragraph>
Auto-numbered footnote 6.
- <footnote auto="1" dupname="five" id="id13">
+ <footnote auto="1" dupnames="five" ids="id13">
<label>
7
<system_message backrefs="id13" level="2" line="15" source="test data" type="WARNING">
@@ -372,7 +372,7 @@ and labelled auto-numbered footnotes:
Duplicate explicit target name: "five".
<paragraph>
Auto-numbered footnote 5 again (duplicate).
- <system_message backrefs="id15" id="id14" level="3" line="4" source="test data" type="ERROR">
+ <system_message backrefs="id15" ids="id14" level="3" line="4" source="test data" type="ERROR">
<paragraph>
Too many autonumbered footnote references: only 2 corresponding footnotes available.
"""],
@@ -385,10 +385,10 @@ Referencing a footnote by symbol [*]_.
<document source="test data">
<paragraph>
Referencing a footnote by symbol \n\
- <footnote_reference auto="*" id="id1" refid="id2">
+ <footnote_reference auto="*" ids="id1" refid="id2">
*
.
- <footnote auto="*" backrefs="id1" id="id2">
+ <footnote auto="*" backrefs="id1" ids="id2">
<label>
*
<paragraph>
@@ -415,98 +415,98 @@ u"""\
<document source="test data">
<paragraph>
A sequence of symbol footnote references:
- <footnote_reference auto="*" id="id1" refid="id13">
+ <footnote_reference auto="*" ids="id1" refid="id13">
*
\n\
- <footnote_reference auto="*" id="id2" refid="id14">
+ <footnote_reference auto="*" ids="id2" refid="id14">
\u2020
\n\
- <footnote_reference auto="*" id="id3" refid="id15">
+ <footnote_reference auto="*" ids="id3" refid="id15">
\u2021
\n\
- <footnote_reference auto="*" id="id4" refid="id16">
+ <footnote_reference auto="*" ids="id4" refid="id16">
\u00A7
\n\
- <footnote_reference auto="*" id="id5" refid="id17">
+ <footnote_reference auto="*" ids="id5" refid="id17">
\u00B6
\n\
- <footnote_reference auto="*" id="id6" refid="id18">
+ <footnote_reference auto="*" ids="id6" refid="id18">
#
\n\
- <footnote_reference auto="*" id="id7" refid="id19">
+ <footnote_reference auto="*" ids="id7" refid="id19">
\u2660
\n\
- <footnote_reference auto="*" id="id8" refid="id20">
+ <footnote_reference auto="*" ids="id8" refid="id20">
\u2665
\n\
- <footnote_reference auto="*" id="id9" refid="id21">
+ <footnote_reference auto="*" ids="id9" refid="id21">
\u2666
\n\
- <footnote_reference auto="*" id="id10" refid="id22">
+ <footnote_reference auto="*" ids="id10" refid="id22">
\u2663
\n\
- <footnote_reference auto="*" id="id11" refid="id23">
+ <footnote_reference auto="*" ids="id11" refid="id23">
**
\n\
- <footnote_reference auto="*" id="id12" refid="id24">
+ <footnote_reference auto="*" ids="id12" refid="id24">
\u2020\u2020
.
- <footnote auto="*" backrefs="id1" id="id13">
+ <footnote auto="*" backrefs="id1" ids="id13">
<label>
*
<paragraph>
Auto-symbol footnote 1.
- <footnote auto="*" backrefs="id2" id="id14">
+ <footnote auto="*" backrefs="id2" ids="id14">
<label>
\u2020
<paragraph>
Auto-symbol footnote 2.
- <footnote auto="*" backrefs="id3" id="id15">
+ <footnote auto="*" backrefs="id3" ids="id15">
<label>
\u2021
<paragraph>
Auto-symbol footnote 3.
- <footnote auto="*" backrefs="id4" id="id16">
+ <footnote auto="*" backrefs="id4" ids="id16">
<label>
\u00A7
<paragraph>
Auto-symbol footnote 4.
- <footnote auto="*" backrefs="id5" id="id17">
+ <footnote auto="*" backrefs="id5" ids="id17">
<label>
\u00B6
<paragraph>
Auto-symbol footnote 5.
- <footnote auto="*" backrefs="id6" id="id18">
+ <footnote auto="*" backrefs="id6" ids="id18">
<label>
#
<paragraph>
Auto-symbol footnote 6.
- <footnote auto="*" backrefs="id7" id="id19">
+ <footnote auto="*" backrefs="id7" ids="id19">
<label>
\u2660
<paragraph>
Auto-symbol footnote 7.
- <footnote auto="*" backrefs="id8" id="id20">
+ <footnote auto="*" backrefs="id8" ids="id20">
<label>
\u2665
<paragraph>
Auto-symbol footnote 8.
- <footnote auto="*" backrefs="id9" id="id21">
+ <footnote auto="*" backrefs="id9" ids="id21">
<label>
\u2666
<paragraph>
Auto-symbol footnote 9.
- <footnote auto="*" backrefs="id10" id="id22">
+ <footnote auto="*" backrefs="id10" ids="id22">
<label>
\u2663
<paragraph>
Auto-symbol footnote 10.
- <footnote auto="*" backrefs="id11" id="id23">
+ <footnote auto="*" backrefs="id11" ids="id23">
<label>
**
<paragraph>
Auto-symbol footnote 11.
- <footnote auto="*" backrefs="id12" id="id24">
+ <footnote auto="*" backrefs="id12" ids="id24">
<label>
\u2020\u2020
<paragraph>
@@ -523,12 +523,12 @@ Duplicate manual footnote labels:
<document source="test data">
<paragraph>
Duplicate manual footnote labels:
- <footnote dupname="1" id="id1">
+ <footnote dupnames="1" ids="id1">
<label>
1
<paragraph>
Footnote.
- <footnote dupname="1" id="id2">
+ <footnote dupnames="1" ids="id2">
<label>
1
<system_message backrefs="id2" level="2" line="5" source="test data" type="WARNING">
diff --git a/docutils/test/test_transforms/test_hyperlinks.py b/docutils/test/test_transforms/test_hyperlinks.py
index 40bf5a9e0..537ee1502 100755
--- a/docutils/test/test_transforms/test_hyperlinks.py
+++ b/docutils/test/test_transforms/test_hyperlinks.py
@@ -11,7 +11,7 @@ Tests for docutils.transforms.references.Hyperlinks.
"""
from __init__ import DocutilsTestSupport
-from docutils.transforms.references import SectionTargets, ChainedTargets, \
+from docutils.transforms.references import PropagateTargets, \
AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \
InternalTargets
@@ -30,8 +30,8 @@ totest = {}
# Exhaustive listing of hyperlink variations: every combination of
# target/reference, direct/indirect, internal/external, and named/anonymous,
# plus embedded URIs.
-totest['exhaustive_hyperlinks'] = ((SectionTargets, ChainedTargets,
- AnonymousHyperlinks, IndirectHyperlinks,
+totest['exhaustive_hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks,
+ IndirectHyperlinks,
ExternalTargets, InternalTargets,
FinalChecks), [
["""\
@@ -45,7 +45,7 @@ direct_ external
<reference name="direct" refuri="http://direct">
direct
external
- <target id="direct" name="direct" refuri="http://direct">
+ <target ids="direct" names="direct" refuri="http://direct">
"""],
["""\
indirect_ external
@@ -59,8 +59,8 @@ indirect_ external
<reference name="indirect" refuri="http://indirect">
indirect
external
- <target id="indirect" name="indirect" refuri="http://indirect">
- <target id="xtarget" name="xtarget" refuri="http://indirect">
+ <target ids="indirect" names="indirect" refuri="http://indirect">
+ <target ids="xtarget" names="xtarget" refuri="http://indirect">
"""],
["""\
.. _direct:
@@ -69,8 +69,8 @@ direct_ internal
""",
"""\
<document source="test data">
- <target id="direct" name="direct">
- <paragraph>
+ <target refid="direct">
+ <paragraph ids="direct" names="direct">
<reference name="direct" refid="direct">
direct
internal
@@ -85,13 +85,13 @@ indirect_ internal
""",
"""\
<document source="test data">
- <target id="ztarget" name="ztarget">
- <paragraph>
+ <target refid="ztarget">
+ <paragraph ids="ztarget" names="ztarget">
<reference name="indirect" refid="ztarget">
indirect
internal
- <target id="indirect2" name="indirect2" refid="ztarget">
- <target id="indirect" name="indirect" refid="ztarget">
+ <target ids="indirect2" names="indirect2" refid="ztarget">
+ <target ids="indirect" names="indirect" refid="ztarget">
"""],
["""\
Implicit
@@ -103,14 +103,14 @@ indirect_ internal
""",
"""\
<document source="test data">
- <section id="implicit" name="implicit">
+ <section ids="implicit" names="implicit">
<title>
Implicit
<paragraph>
<reference name="indirect" refid="implicit">
indirect
internal
- <target id="indirect" name="indirect" refid="implicit">
+ <target ids="indirect" names="indirect" refid="implicit">
"""],
["""\
Implicit
@@ -123,15 +123,15 @@ Implicit
""",
"""\
<document source="test data">
- <section id="implicit" name="implicit">
+ <section ids="implicit" names="implicit">
<title>
Implicit
<paragraph>
<reference name="multiply-indirect" refid="implicit">
multiply-indirect
internal
- <target id="multiply-indirect" name="multiply-indirect" refid="implicit">
- <target id="indirect" name="indirect" refid="implicit">
+ <target ids="multiply-indirect" names="multiply-indirect" refid="implicit">
+ <target ids="indirect" names="indirect" refid="implicit">
"""],
["""\
circular_ indirect reference
@@ -142,13 +142,13 @@ circular_ indirect reference
"""\
<document source="test data">
<paragraph>
- <problematic id="id2" refid="id1">
+ <problematic ids="id3" refid="id1">
circular_
indirect reference
- <target id="circular" name="circular" refid="circular">
- <problematic id="id3" refid="id1">
+ <target ids="circular" names="circular" refid="circular">
+ <problematic ids="id2" refid="id1">
.. _indirect: circular_
- <system_message backrefs="id2 id3" id="id1" level="3" line="3" source="test data" type="ERROR">
+ <system_message backrefs="id2 id3" ids="id1" level="3" line="3" source="test data" type="ERROR">
<paragraph>
Indirect hyperlink target "circular" (id="circular") refers to target "indirect", forming a circular reference.
"""],
@@ -169,30 +169,30 @@ Direct internal reference: Implicit_
""",
"""\
<document source="test data">
- <section dupname="implicit" id="implicit">
+ <section dupnames="implicit" ids="implicit">
<title>
Implicit
<paragraph>
Duplicate implicit targets.
- <section dupname="implicit" id="id1">
+ <section dupnames="implicit" ids="id1">
<title>
Implicit
<system_message backrefs="id1" level="1" line="7" source="test data" type="INFO">
<paragraph>
Duplicate implicit target name: "implicit".
<paragraph>
- <problematic id="id3" refid="id2">
+ <problematic ids="id3" refid="id2">
indirect_
internal
- <target id="indirect" name="indirect" refname="implicit">
+ <target ids="indirect" names="indirect" refname="implicit">
<paragraph>
Direct internal reference:
- <problematic id="id5" refid="id4">
+ <problematic ids="id5" refid="id4">
Implicit_
- <system_message backrefs="id3" id="id2" level="3" line="11" source="test data" type="ERROR">
+ <system_message backrefs="id3" ids="id2" level="3" line="11" source="test data" type="ERROR">
<paragraph>
Indirect hyperlink target "indirect" (id="indirect") refers to target "implicit", which is a duplicate, and cannot be used as a unique reference.
- <system_message backrefs="id5" id="id4" level="3" line="13" source="test data" type="ERROR">
+ <system_message backrefs="id5" ids="id4" level="3" line="13" source="test data" type="ERROR">
<paragraph>
Duplicate target name, cannot be used as a unique reference: "implicit".
"""],
@@ -206,7 +206,7 @@ __ http://direct
<paragraph>
<reference anonymous="1" name="direct external" refuri="http://direct">
direct external
- <target anonymous="1" id="id1" refuri="http://direct">
+ <target anonymous="1" ids="id1" refuri="http://direct">
"""],
["""\
`indirect external`__
@@ -219,8 +219,8 @@ __ xtarget_
<paragraph>
<reference anonymous="1" name="indirect external" refuri="http://indirect">
indirect external
- <target anonymous="1" id="id1" refuri="http://indirect">
- <target id="xtarget" name="xtarget" refuri="http://indirect">
+ <target anonymous="1" ids="id1" refuri="http://indirect">
+ <target ids="xtarget" names="xtarget" refuri="http://indirect">
"""],
["""\
__
@@ -229,8 +229,8 @@ __
""",
"""\
<document source="test data">
- <target anonymous="1" id="id1">
- <paragraph>
+ <target anonymous="1" refid="id1">
+ <paragraph ids="id1">
<reference anonymous="1" name="direct internal" refid="id1">
direct internal
"""],
@@ -243,11 +243,11 @@ __ ztarget_
""",
"""\
<document source="test data">
- <target id="ztarget" name="ztarget">
- <paragraph>
+ <target refid="ztarget">
+ <paragraph ids="ztarget" names="ztarget">
<reference anonymous="1" name="indirect internal" refid="ztarget">
indirect internal
- <target anonymous="1" id="id1" refid="ztarget">
+ <target anonymous="1" ids="id1" refid="ztarget">
"""],
["""\
.. _ztarget:
@@ -264,20 +264,20 @@ __ ztarget_
""",
"""\
<document source="test data">
- <target dupname="ztarget" id="ztarget">
- <paragraph>
+ <target dupnames="ztarget" refid="ztarget">
+ <paragraph ids="ztarget">
First
<system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "ztarget".
- <target dupname="ztarget" id="id1">
- <paragraph>
+ <target dupnames="ztarget" refid="id1">
+ <paragraph ids="id1">
Second
<paragraph>
- <problematic id="id4" refid="id3">
+ <problematic ids="id4" refid="id3">
`indirect internal`__
- <target anonymous="1" id="id2" refname="ztarget">
- <system_message backrefs="id4" id="id3" level="3" line="11" source="test data" type="ERROR">
+ <target anonymous="1" ids="id2" refname="ztarget">
+ <system_message backrefs="id4" ids="id3" level="3" line="11" source="test data" type="ERROR">
<paragraph>
Indirect hyperlink target (id="id2") refers to target "ztarget", which is a duplicate, and cannot be used as a unique reference.
"""],
@@ -292,7 +292,7 @@ Another reference to the same `embedded URI`_.
An \n\
<reference name="embedded uri" refuri="http://direct">
embedded uri
- <target id="embedded-uri" name="embedded uri" refuri="http://direct">
+ <target ids="embedded-uri" names="embedded uri" refuri="http://direct">
.
<paragraph>
Another reference to the same \n\
@@ -311,28 +311,60 @@ An `anonymous embedded uri <http://direct>`__.
anonymous embedded uri
.
"""],
+["""\
+.. _target:
+
+.. [1] Footnote; target_
+""",
+"""\
+<document source="test data">
+ <target ids="target" names="target">
+ <footnote ids="id1" names="1">
+ <label>
+ 1
+ <paragraph>
+ Footnote; \n\
+ <reference name="target" refid="target">
+ target
+"""],
+["""\
+.. _target:
+
+.. [cit] Citation; target_
+""",
+"""\
+<document source="test data">
+ <target ids="target" names="target">
+ <citation ids="cit" names="cit">
+ <label>
+ cit
+ <paragraph>
+ Citation; \n\
+ <reference name="target" refid="target">
+ target
+"""],
])
-totest['hyperlinks'] = ((SectionTargets, ChainedTargets, AnonymousHyperlinks,
+totest['hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks,
IndirectHyperlinks, ExternalTargets,
- InternalTargets,), [
+ InternalTargets, FinalChecks), [
["""\
.. _internal hyperlink:
This paragraph referenced.
-By this `internal hyperlink`_ referemce.
+By this `internal hyperlink`_ reference.
""",
"""\
<document source="test data">
- <target id="internal-hyperlink" name="internal hyperlink">
- <paragraph>
+ <target refid="internal-hyperlink">
+ <paragraph ids="internal-hyperlink" names="internal hyperlink">
This paragraph referenced.
<paragraph>
By this \n\
<reference name="internal hyperlink" refid="internal-hyperlink">
internal hyperlink
- referemce.
+ reference.
"""],
["""\
.. _chained:
@@ -340,22 +372,22 @@ By this `internal hyperlink`_ referemce.
This paragraph referenced.
-By this `internal hyperlink`_ referemce
+By this `internal hyperlink`_ reference
as well as by this chained_ reference.
The results of the transform are not visible at the XML level.
""",
"""\
<document source="test data">
- <target id="chained" name="chained">
- <target id="internal-hyperlink" name="internal hyperlink">
- <paragraph>
+ <target refid="chained">
+ <target refid="internal-hyperlink">
+ <paragraph ids="internal-hyperlink chained" names="internal hyperlink chained">
This paragraph referenced.
<paragraph>
By this \n\
<reference name="internal hyperlink" refid="internal-hyperlink">
internal hyperlink
- referemce
+ reference
as well as by this \n\
<reference name="chained" refid="chained">
chained
@@ -364,13 +396,82 @@ The results of the transform are not visible at the XML level.
The results of the transform are not visible at the XML level.
"""],
["""\
+.. _a:
+.. _b:
+
+x
+""",
+"""\
+<document source="test data">
+ <target refid="a">
+ <target refid="b">
+ <paragraph ids="b a" names="b a">
+ x
+ <system_message level="1" line="1" source="test data" type="INFO">
+ <paragraph>
+ Hyperlink target "a" is not referenced.
+ <system_message level="1" line="2" source="test data" type="INFO">
+ <paragraph>
+ Hyperlink target "b" is not referenced.
+"""],
+["""\
+.. _a:
+.. _b:
+
+a_
+""",
+"""\
+<document source="test data">
+ <target refid="a">
+ <target refid="b">
+ <paragraph ids="b a" names="b a">
+ <reference name="a" refid="a">
+ a
+ <system_message level="1" line="2" source="test data" type="INFO">
+ <paragraph>
+ Hyperlink target "b" is not referenced.
+"""],
+["""\
+.. _a:
+.. _b:
+
+b_
+""",
+"""\
+<document source="test data">
+ <target refid="a">
+ <target refid="b">
+ <paragraph ids="b a" names="b a">
+ <reference name="b" refid="b">
+ b
+ <system_message level="1" line="1" source="test data" type="INFO">
+ <paragraph>
+ Hyperlink target "a" is not referenced.
+"""],
+["""\
+.. _a:
+.. _b:
+
+a_\ b_
+""",
+"""\
+<document source="test data">
+ <target refid="a">
+ <target refid="b">
+ <paragraph ids="b a" names="b a">
+ <reference name="a" refid="a">
+ a
+ <reference name="b" refid="b">
+ b
+"""],
+["""\
.. _external hyperlink: http://uri
`External hyperlink`_ reference.
""",
"""\
<document source="test data">
- <target id="external-hyperlink" name="external hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
<paragraph>
<reference name="External hyperlink" refuri="http://uri">
External hyperlink
@@ -382,11 +483,11 @@ The results of the transform are not visible at the XML level.
""",
"""\
<document source="test data">
- <target id="external-hyperlink" name="external hyperlink" refuri="http://uri">
- <target id="indirect-target" name="indirect target" refuri="http://uri">
+ <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
+ <target ids="indirect-target" names="indirect target" refuri="http://uri">
<system_message level="1" line="2" source="test data" type="INFO">
<paragraph>
- Indirect hyperlink target "indirect target" is not referenced.
+ Hyperlink target "indirect target" is not referenced.
"""],
["""\
.. _chained:
@@ -397,8 +498,8 @@ and a chained_ reference too.
""",
"""\
<document source="test data">
- <target id="chained" name="chained" refuri="http://uri">
- <target id="external-hyperlink" name="external hyperlink" refuri="http://uri">
+ <target refid="chained">
+ <target ids="external-hyperlink chained" names="external hyperlink chained" refuri="http://uri">
<paragraph>
<reference name="External hyperlink" refuri="http://uri">
External hyperlink
@@ -416,8 +517,8 @@ and a chained_ reference too.
""",
"""\
<document source="test data">
- <target id="external-hyperlink" name="external hyperlink" refuri="http://uri">
- <target id="indirect-hyperlink" name="indirect hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
+ <target ids="indirect-hyperlink" names="indirect hyperlink" refuri="http://uri">
<paragraph>
<reference name="Indirect hyperlink" refuri="http://uri">
Indirect hyperlink
@@ -432,9 +533,9 @@ Chained_ `indirect hyperlink`_ reference.
""",
"""\
<document source="test data">
- <target id="external-hyperlink" name="external hyperlink" refuri="http://uri">
- <target id="chained" name="chained" refuri="http://uri">
- <target id="indirect-hyperlink" name="indirect hyperlink" refuri="http://uri">
+ <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri">
+ <target refuri="http://uri">
+ <target ids="indirect-hyperlink chained" names="indirect hyperlink chained" refuri="http://uri">
<paragraph>
<reference name="Chained" refuri="http://uri">
Chained
@@ -459,13 +560,13 @@ __
""",
"""\
<document source="test data">
- <target anonymous="1" id="id1" refuri="http://full">
- <target anonymous="1" id="id2" refuri="http://simplified">
- <target anonymous="1" id="id3" refuri="http://simplified">
- <target id="external" name="external" refuri="http://indirect.external">
- <target anonymous="1" id="id4" refuri="http://indirect.external">
- <target anonymous="1" id="id5">
- <paragraph>
+ <target anonymous="1" ids="id1" refuri="http://full">
+ <target anonymous="1" refid="id2">
+ <target anonymous="1" ids="id3 id2" refuri="http://simplified">
+ <target ids="external" names="external" refuri="http://indirect.external">
+ <target anonymous="1" ids="id4" refuri="http://indirect.external">
+ <target anonymous="1" refid="id5">
+ <paragraph ids="id5">
<reference anonymous="1" name="Full syntax anonymous external hyperlink reference" refuri="http://full">
Full syntax anonymous external hyperlink reference
,
@@ -493,14 +594,34 @@ Duplicate external target_'s (different URIs):
<document source="test data">
<paragraph>
Duplicate external \n\
- <reference name="target" refname="target">
- target
+ <problematic ids="id3" refid="id2">
+ target_
's (different URIs):
- <target dupname="target" id="target" refuri="first">
+ <target dupnames="target" ids="target" refuri="first">
<system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING">
<paragraph>
Duplicate explicit target name: "target".
- <target dupname="target" id="id1" refuri="second">
+ <target dupnames="target" ids="id1" refuri="second">
+ <system_message backrefs="id3" ids="id2" level="3" line="1" source="test data" type="ERROR">
+ <paragraph>
+ Duplicate target name, cannot be used as a unique reference: "target".
+"""],
+["""\
+Duplicate external targets (different URIs) without reference:
+
+.. _target: first
+
+.. _target: second
+""",
+"""\
+<document source="test data">
+ <paragraph>
+ Duplicate external targets (different URIs) without reference:
+ <target dupnames="target" ids="target" refuri="first">
+ <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING">
+ <paragraph>
+ Duplicate explicit target name: "target".
+ <target dupnames="target" ids="id1" refuri="second">
"""],
["""\
Several__ anonymous__ hyperlinks__, but not enough targets.
@@ -510,17 +631,17 @@ __ http://example.org
"""\
<document source="test data">
<paragraph>
- <problematic id="id3" refid="id2">
+ <problematic ids="id3" refid="id2">
Several__
\n\
- <problematic id="id4" refid="id2">
+ <problematic ids="id4" refid="id2">
anonymous__
\n\
- <problematic id="id5" refid="id2">
+ <problematic ids="id5" refid="id2">
hyperlinks__
, but not enough targets.
- <target anonymous="1" id="id1" refuri="http://example.org">
- <system_message backrefs="id3 id4 id5" id="id2" level="3" source="test data" type="ERROR">
+ <target anonymous="1" ids="id1" refuri="http://example.org">
+ <system_message backrefs="id3 id4 id5" ids="id2" level="3" source="test data" type="ERROR">
<paragraph>
Anonymous hyperlink mismatch: 3 references but 1 targets.
See "backrefs" attribute for IDs.
@@ -541,10 +662,10 @@ __ http://example.org
""",
"""\
<document source="test data">
- <target id="external" name="external" refuri="http://uri">
- <target id="indirect" name="indirect" refuri="http://uri">
- <target id="internal" name="internal">
- <reference name="external_" refuri="http://uri">
+ <target ids="external" names="external" refuri="http://uri">
+ <target ids="indirect" names="indirect" refuri="http://uri">
+ <target refid="internal">
+ <reference ids="internal" name="external_" names="internal" refuri="http://uri">
<image uri="picture.png">
<reference name="indirect_" refuri="http://uri">
<image uri="picture.png">
@@ -562,16 +683,16 @@ Testing an `indirect reference to the table of contents`_.
""",
"""\
<document source="test data">
- <topic class="contents" id="table-of-contents" name="table of contents">
+ <topic classes="contents" ids="table-of-contents" names="table of contents">
<title>
Table of Contents
<bullet_list>
<list_item>
<paragraph>
- <reference id="id1" refid="section">
+ <reference ids="id1" refid="section">
Section
- <target id="indirect-reference-to-the-table-of-contents" name="indirect reference to the table of contents" refid="table-of-contents">
- <section id="section" name="section">
+ <target ids="indirect-reference-to-the-table-of-contents" names="indirect reference to the table of contents" refid="table-of-contents">
+ <section ids="section" names="section">
<title refid="id1">
Section
<paragraph>
@@ -581,8 +702,6 @@ Testing an `indirect reference to the table of contents`_.
.
"""],
["""\
-Target should end up inside the section title, not before the section:
-
.. _explicit target:
Title
@@ -592,11 +711,9 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error.
""",
"""\
<document source="test data">
- <paragraph>
- Target should end up inside the section title, not before the section:
- <section id="title" name="title">
+ <target refid="explicit-target">
+ <section ids="title explicit-target" names="title explicit target">
<title>
- <target id="explicit-target" name="explicit target">
Title
<paragraph>
Let's reference it (
@@ -622,9 +739,9 @@ Title
<reference name="target2" refuri="URI">
target2
, not the Title.
- <target id="target1" name="target1" refuri="URI">
- <target id="target2" name="target2" refuri="URI">
- <section id="title" name="title">
+ <target refid="target1">
+ <target ids="target2 target1" names="target2 target1" refuri="URI">
+ <section ids="title" names="title">
<title>
Title
"""],
diff --git a/docutils/test/test_transforms/test_messages.py b/docutils/test/test_transforms/test_messages.py
index 75325bc96..6ff8c9987 100755
--- a/docutils/test/test_transforms/test_messages.py
+++ b/docutils/test/test_transforms/test_messages.py
@@ -37,7 +37,7 @@ document by the test framework.)
<document source="test data">
<paragraph>
This \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
|unknown substitution|
will generate a system message, thanks to
the \n\
@@ -51,10 +51,10 @@ document by the test framework.)
<paragraph>
(A second copy of the system message is tacked on to the end of the
document by the test framework.)
- <section class="system-messages">
+ <section classes="system-messages">
<title>
Docutils System Messages
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Undefined substitution referenced: "unknown substitution".
"""],
diff --git a/docutils/test/test_transforms/test_peps.py b/docutils/test/test_transforms/test_peps.py
index 5710f9ec7..5ab57be50 100755
--- a/docutils/test/test_transforms/test_peps.py
+++ b/docutils/test/test_transforms/test_peps.py
@@ -47,14 +47,14 @@ A "References" section should be generated.
<reference name="reference" refname="reference">
reference
\n\
- <footnote_reference auto="1" id="id3" refname="target_note: id2">
+ <footnote_reference auto="1" ids="id3" refname="TARGET_NOTE: id2">
.
A "References" section should be generated.
- <target id="reference" name="reference" refuri="http://www.example.org">
- <section id="id1">
+ <target ids="reference" names="reference" refuri="http://www.example.org">
+ <section ids="id1">
<title>
References
- <footnote auto="1" id="id2" name="target_note: id2">
+ <footnote auto="1" ids="id2" names="TARGET_NOTE: id2">
<paragraph>
<reference refuri="http://www.example.org">
http://www.example.org
diff --git a/docutils/test/test_transforms/test_sectnum.py b/docutils/test/test_transforms/test_sectnum.py
index 2ecb6b802..514ae419f 100755
--- a/docutils/test/test_transforms/test_sectnum.py
+++ b/docutils/test/test_transforms/test_sectnum.py
@@ -46,30 +46,30 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
Title 4
<paragraph>
@@ -84,9 +84,9 @@ Paragraph 1.
""",
u"""\
<document source="test data">
- <section id="bold-title" name="bold title">
+ <section ids="bold-title" names="bold title">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1\u00a0\u00a0\u00a0
<strong>
Bold Title
@@ -114,28 +114,28 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title>
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
Title 4
<paragraph>
@@ -163,56 +163,56 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <topic class="contents" id="contents" name="contents">
+ <topic classes="contents" ids="contents" names="contents">
<title>
Contents
- <bullet_list class="auto-toc">
+ <bullet_list classes="auto-toc">
<list_item>
<paragraph>
- <reference id="id1" refid="title-1">
- <generated class="sectnum">
+ <reference ids="id1" refid="title-1">
+ <generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
- <bullet_list class="auto-toc">
+ <bullet_list classes="auto-toc">
<list_item>
<paragraph>
- <reference id="id2" refid="title-2">
- <generated class="sectnum">
+ <reference ids="id2" refid="title-2">
+ <generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<bullet_list>
<list_item>
<paragraph>
- <reference id="id3" refid="title-3">
+ <reference ids="id3" refid="title-3">
Title 3
<list_item>
<paragraph>
- <reference id="id4" refid="title-4">
- <generated class="sectnum">
+ <reference ids="id4" refid="title-4">
+ <generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
Title 4
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1" refid="id1">
- <generated class="sectnum">
+ <generated classes="sectnum">
1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1" refid="id2">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title refid="id3">
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1" refid="id4">
- <generated class="sectnum">
+ <generated classes="sectnum">
1.2\u00a0\u00a0\u00a0
Title 4
<paragraph>
@@ -240,30 +240,30 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
Arbitrary-1\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
Arbitrary-1.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
Arbitrary-1.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
Arbitrary-1.2\u00a0\u00a0\u00a0
Title 4
<paragraph>
@@ -291,30 +291,30 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
3\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
3.1\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
3.1.1\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
3.2\u00a0\u00a0\u00a0
Title 4
<paragraph>
@@ -344,30 +344,30 @@ Paragraph 4.
""",
u"""\
<document source="test data">
- <section id="title-1" name="title 1">
+ <section ids="title-1" names="title 1">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
(5.9.3)\u00a0\u00a0\u00a0
Title 1
<paragraph>
Paragraph 1.
- <section id="title-2" name="title 2">
+ <section ids="title-2" names="title 2">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
(5.9.3.1)\u00a0\u00a0\u00a0
Title 2
<paragraph>
Paragraph 2.
- <section id="title-3" name="title 3">
+ <section ids="title-3" names="title 3">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
(5.9.3.1.1)\u00a0\u00a0\u00a0
Title 3
<paragraph>
Paragraph 3.
- <section id="title-4" name="title 4">
+ <section ids="title-4" names="title 4">
<title auto="1">
- <generated class="sectnum">
+ <generated classes="sectnum">
(5.9.3.2)\u00a0\u00a0\u00a0
Title 4
<paragraph>
diff --git a/docutils/test/test_transforms/test_substitutions.py b/docutils/test/test_transforms/test_substitutions.py
index 687a20ca5..33a33b754 100755
--- a/docutils/test/test_transforms/test_substitutions.py
+++ b/docutils/test/test_transforms/test_substitutions.py
@@ -35,7 +35,7 @@ The |biohazard| symbol is deservedly scary-looking.
The \n\
<image alt="biohazard" uri="biohazard.png">
symbol is deservedly scary-looking.
- <substitution_definition name="biohazard">
+ <substitution_definition names="biohazard">
<image alt="biohazard" uri="biohazard.png">
"""],
["""\
@@ -45,10 +45,10 @@ Here's an |unknown| substitution.
<document source="test data">
<paragraph>
Here's an \n\
- <problematic id="id2" refid="id1">
+ <problematic ids="id2" refid="id1">
|unknown|
substitution.
- <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR">
+ <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR">
<paragraph>
Undefined substitution referenced: "unknown".
"""],
@@ -64,9 +64,9 @@ u"""\
<document source="test data">
<paragraph>
Substitutions support case differences:
- <substitution_definition name="eacute">
+ <substitution_definition names="eacute">
\u00E9
- <substitution_definition name="Eacute">
+ <substitution_definition names="Eacute">
\u00C9
<paragraph>
\u00C9
@@ -105,16 +105,16 @@ u"""\
), and a captial omega (
\u03a9
).
- <substitution_definition name="mdash">
+ <substitution_definition names="mdash">
\u2014
- <substitution_definition name="copy">
+ <substitution_definition names="copy">
\u00a9
- <substitution_definition name="nbsp">
+ <substitution_definition names="nbsp">
\u00a0
- <substitution_definition name="bne">
+ <substitution_definition names="bne">
=
\u20e5
- <substitution_definition name="Omega">
+ <substitution_definition names="Omega">
\u03a9
"""],
["""
@@ -137,9 +137,9 @@ u"""\
BogusMegaCorp
\u2122
.
- <substitution_definition name="copy">
+ <substitution_definition names="copy">
\u00a9
- <substitution_definition name="BogusMegaCorp (TM)">
+ <substitution_definition names="BogusMegaCorp (TM)">
BogusMegaCorp
\u2122
"""],
@@ -161,9 +161,9 @@ u"""\
Some substitutions
\u2122
only need trimming on one side.
- <substitution_definition ltrim="1" name="---" rtrim="1">
+ <substitution_definition ltrim="1" names="---" rtrim="1">
\u2014
- <substitution_definition ltrim="1" name="TM">
+ <substitution_definition ltrim="1" names="TM">
\u2122
"""],
])
diff --git a/docutils/test/test_writers/test_docutils_xml.py b/docutils/test/test_writers/test_docutils_xml.py
index 08219dc05..26c842761 100755
--- a/docutils/test/test_writers/test_docutils_xml.py
+++ b/docutils/test/test_writers/test_docutils_xml.py
@@ -22,10 +22,10 @@ class DocutilsXMLTestCase(unittest.TestCase, docutils.SettingsSpec):
xmldecl = '<?xml version="1.0" encoding="iso-8859-1"?>\n'
doctypedecl = '<!DOCTYPE document PUBLIC "+//IDN docutils.sourceforge.net//DTD Docutils Generic//EN//XML" "http://docutils.sourceforge.net/docs/ref/docutils.dtd">\n'
generatedby = '<!-- Generated by Docutils %s -->\n' % docutils.__version__
- bodynormal = '<document id="test" name="test" source="&lt;string&gt;"><title>Test</title><subtitle id="subsection" name="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
- bodynormal = '<document id="test" name="test" source="&lt;string&gt;"><title>Test</title><subtitle id="subsection" name="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
- bodynewlines = '<document id="test" name="test" source="&lt;string&gt;">\n<title>\nTest\n</title>\n<subtitle id="subsection" name="subsection">\nSubsection\n</subtitle>\n<paragraph>\nTest\n</paragraph>\n<transition/>\n<paragraph>\nTest.\n</paragraph>\n</document>\n'
- bodyindents = '<document id="test" name="test" source="&lt;string&gt;">\n <title>\n Test\n </title>\n <subtitle id="subsection" name="subsection">\n Subsection\n </subtitle>\n <paragraph>\n Test\n </paragraph>\n <transition/>\n <paragraph>\n Test.\n </paragraph>\n</document>\n'
+ bodynormal = '<document ids="test" names="test" source="&lt;string&gt;"><title>Test</title><subtitle ids="subsection" names="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
+ bodynormal = '<document ids="test" names="test" source="&lt;string&gt;"><title>Test</title><subtitle ids="subsection" names="subsection">Subsection</subtitle><paragraph>Test</paragraph><transition/><paragraph>Test.</paragraph></document>'
+ bodynewlines = '<document ids="test" names="test" source="&lt;string&gt;">\n<title>\nTest\n</title>\n<subtitle ids="subsection" names="subsection">\nSubsection\n</subtitle>\n<paragraph>\nTest\n</paragraph>\n<transition/>\n<paragraph>\nTest.\n</paragraph>\n</document>\n'
+ bodyindents = '<document ids="test" names="test" source="&lt;string&gt;">\n <title>\n Test\n </title>\n <subtitle ids="subsection" names="subsection">\n Subsection\n </subtitle>\n <paragraph>\n Test\n </paragraph>\n <transition/>\n <paragraph>\n Test.\n </paragraph>\n</document>\n'
settings_default_overrides = {'_disable_config': 1}
diff --git a/docutils/test/test_writers/test_pseudoxml.py b/docutils/test/test_writers/test_pseudoxml.py
index c9679a1c6..66bfef480 100755
--- a/docutils/test/test_writers/test_pseudoxml.py
+++ b/docutils/test/test_writers/test_pseudoxml.py
@@ -38,7 +38,7 @@ Foo.
""",
# output
"""\
-<document id="this-is-the-title" name="this is the title" source="<string>">
+<document ids="this-is-the-title" names="this is the title" source="<string>">
<title>
This is the title
<paragraph>
@@ -46,7 +46,7 @@ Foo.
<transition>
<paragraph>
This is another paragraph.
- <section id="a-subsection" name="a subsection">
+ <section ids="a-subsection" names="a subsection">
<title>
A subsection
<paragraph>