~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_substitutions.py

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# Author: David Goodger
4
4
# Contact: goodger@users.sourceforge.net
5
 
# Revision: $Revision: 1.18 $
6
 
# Date: $Date: 2003/12/21 02:32:02 $
 
5
# Revision: $Revision: 3937 $
 
6
# Date: $Date: 2005-10-11 22:40:41 +0200 (Tue, 11 Oct 2005) $
7
7
# Copyright: This module has been placed in the public domain.
8
8
 
9
9
"""
29
29
<document source="test data">
30
30
    <paragraph>
31
31
        Here's an image substitution definition:
32
 
    <substitution_definition name="symbol">
 
32
    <substitution_definition names="symbol">
33
33
        <image alt="symbol" uri="symbol.png">
34
34
"""],
35
35
["""\
42
42
<document source="test data">
43
43
    <paragraph>
44
44
        Embedded directive starts on the next line:
45
 
    <substitution_definition name="symbol">
 
45
    <substitution_definition names="symbol">
46
46
        <image alt="symbol" uri="symbol.png">
47
47
"""],
48
48
["""\
55
55
<document source="test data">
56
56
    <paragraph>
57
57
        Trailing spaces should not be significant:
58
 
    <substitution_definition name="symbol">
 
58
    <substitution_definition names="symbol">
59
59
        <image alt="symbol" uri="symbol.png">
60
60
"""],
61
61
["""\
71
71
<document source="test data">
72
72
    <paragraph>
73
73
        Here's a series of substitution definitions:
74
 
    <substitution_definition name="symbol 1">
 
74
    <substitution_definition names="symbol\ 1">
75
75
        <image alt="symbol 1" uri="symbol1.png">
76
 
    <substitution_definition name="SYMBOL 2">
 
76
    <substitution_definition names="SYMBOL\ 2">
77
77
        <image alt="SYMBOL 2" height="50" uri="symbol2.png" width="100">
78
 
    <substitution_definition name="symbol 3">
 
78
    <substitution_definition names="symbol\ 3">
79
79
        <image alt="symbol 3" uri="symbol3.png">
80
80
"""],
81
81
["""\
84
84
""",
85
85
"""\
86
86
<document source="test data">
87
 
    <substitution_definition name="very long substitution text, split across lines">
 
87
    <substitution_definition names="very\ long\ substitution\ text,\ split\ across\ lines">
88
88
        <image alt="very long substitution text, split across lines" uri="symbol.png">
89
89
"""],
90
90
["""\
123
123
""",
124
124
"""\
125
125
<document source="test data">
126
 
    <substitution_definition name="symbol 1">
 
126
    <substitution_definition names="symbol\ 1">
127
127
        <image alt="symbol 1" uri="symbol.png">
128
128
    <paragraph>
129
129
        Followed by a paragraph.
130
 
    <substitution_definition name="symbol 2">
 
130
    <substitution_definition names="symbol\ 2">
131
131
        <image alt="symbol 2" uri="symbol.png">
132
132
    <comment xml:space="preserve">
133
133
    <block_quote>
144
144
<document source="test data">
145
145
    <paragraph>
146
146
        Substitutions support case differences:
147
 
    <substitution_definition name="eacute">
 
147
    <substitution_definition names="eacute">
148
148
        \u00E9
149
 
    <substitution_definition name="Eacute">
 
149
    <substitution_definition names="Eacute">
150
150
        \u00C9
151
151
"""],
152
152
["""\
160
160
<document source="test data">
161
161
    <paragraph>
162
162
        Raw substitution, backslashes should be preserved:
163
 
    <substitution_definition name="alpha">
 
163
    <substitution_definition names="alpha">
164
164
        <raw format="latex" xml:space="preserve">
165
165
            $\\\\alpha$
166
166
"""],
174
174
<document source="test data">
175
175
    <paragraph>
176
176
        Here are some duplicate substitution definitions:
177
 
    <substitution_definition dupname="symbol">
 
177
    <substitution_definition dupnames="symbol">
178
178
        <image alt="symbol" uri="symbol.png">
179
179
    <system_message level="3" line="4" source="test data" type="ERROR">
180
180
        <paragraph>
181
181
            Duplicate substitution definition name: "symbol".
182
 
    <substitution_definition name="symbol">
 
182
    <substitution_definition names="symbol">
183
183
        <image alt="symbol" uri="symbol.png">
184
184
"""],
185
185
["""\
200
200
.. |invalid 3| there's no directive here
201
201
 
202
202
.. | bad name | bad data
 
203
 
 
204
.. |
203
205
""",
204
206
"""\
205
207
<document source="test data">
206
208
    <paragraph>
207
209
        Here are some bad cases:
208
 
    <substitution_definition name="symbol">
 
210
    <substitution_definition names="symbol">
209
211
        <image alt="symbol" uri="symbol.png">
210
212
    <system_message level="2" line="4" source="test data" type="WARNING">
211
213
        <paragraph>
223
225
            Trying "directive" as canonical directive name.
224
226
    <system_message level="3" line="8" source="test data" type="ERROR">
225
227
        <paragraph>
226
 
            Directive "directive" not registered (canonical name "directive").
227
 
    <system_message level="3" line="8" source="test data" type="ERROR">
228
 
        <paragraph>
229
228
            Unknown directive type "directive".
230
229
        <literal_block xml:space="preserve">
231
230
            directive:: symbol.png
253
252
            .. |invalid 3| there's no directive here
254
253
    <comment xml:space="preserve">
255
254
        | bad name | bad data
 
255
    <comment xml:space="preserve">
 
256
        |
 
257
"""],
 
258
["""\
 
259
Elements that are prohibited inside of substitution definitions:
 
260
 
 
261
.. |target| replace:: _`target`
 
262
.. |reference| replace:: anonymous__
 
263
.. |auto-numbered footnote| replace:: [#]_
 
264
""",
 
265
"""\
 
266
<document source="test data">
 
267
    <paragraph>
 
268
        Elements that are prohibited inside of substitution definitions:
 
269
    <system_message level="3" line="3" source="test data" type="ERROR">
 
270
        <paragraph>
 
271
            Substitution definition contains illegal element:
 
272
        <literal_block xml:space="preserve">
 
273
            <target ids="target" names="target">
 
274
                target
 
275
        <literal_block xml:space="preserve">
 
276
            .. |target| replace:: _`target`
 
277
    <system_message level="3" line="4" source="test data" type="ERROR">
 
278
        <paragraph>
 
279
            Substitution definition contains illegal element:
 
280
        <literal_block xml:space="preserve">
 
281
            <reference anonymous="1" name="anonymous">
 
282
                anonymous
 
283
        <literal_block xml:space="preserve">
 
284
            .. |reference| replace:: anonymous__
 
285
    <system_message level="3" line="5" source="test data" type="ERROR">
 
286
        <paragraph>
 
287
            Substitution definition contains illegal element:
 
288
        <literal_block xml:space="preserve">
 
289
            <footnote_reference auto="1" ids="id1">
 
290
        <literal_block xml:space="preserve">
 
291
            .. |auto-numbered footnote| replace:: [#]_
256
292
"""],
257
293
]
258
294