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

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_targets.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.12 $
6
 
# Date: $Date: 2004/01/04 17:44:46 $
 
5
# Revision: $Revision: 3915 $
 
6
# Date: $Date: 2005-10-02 03:06:42 +0200 (Sun, 02 Oct 2005) $
7
7
# Copyright: This module has been placed in the public domain.
8
8
 
9
9
"""
27
27
""",
28
28
"""\
29
29
<document source="test data">
30
 
    <target id="target" name="target">
 
30
    <target ids="target" names="target">
31
31
    <paragraph>
32
32
        (Internal hyperlink target.)
33
33
"""],
36
36
""",
37
37
"""\
38
38
<document source="test data">
39
 
    <target id="optional-space-before-colon" name="optional space before colon">
 
39
    <target ids="optional-space-before-colon" names="optional\ space\ before\ colon">
40
40
"""],
41
41
["""\
42
42
External hyperlink targets:
57
57
<document source="test data">
58
58
    <paragraph>
59
59
        External hyperlink targets:
60
 
    <target id="one-liner" name="one-liner" refuri="http://structuredtext.sourceforge.net">
61
 
    <target id="starts-on-this-line" name="starts-on-this-line" refuri="http://structuredtext.sourceforge.net">
62
 
    <target id="entirely-below" name="entirely-below" refuri="http://structuredtext.sourceforge.net">
63
 
    <target id="not-indirect" name="not-indirect" refuri="uri_">
 
60
    <target ids="one-liner" names="one-liner" refuri="http://structuredtext.sourceforge.net">
 
61
    <target ids="starts-on-this-line" names="starts-on-this-line" refuri="http://structuredtext.sourceforge.net">
 
62
    <target ids="entirely-below" names="entirely-below" refuri="http://structuredtext.sourceforge.net">
 
63
    <target ids="not-indirect" names="not-indirect" refuri="uri_">
64
64
"""],
65
65
["""\
66
66
Indirect hyperlink targets:
73
73
<document source="test data">
74
74
    <paragraph>
75
75
        Indirect hyperlink targets:
76
 
    <target id="target1" name="target1" refname="reference">
77
 
    <target id="target2" name="target2" refname="phrase-link reference">
78
 
"""],
79
 
["""\
80
 
.. _target1: Not a proper hyperlink target
81
 
 
82
 
.. _target2: Although it ends with an underscore, this is not a phrase-link_
83
 
 
84
 
.. _target3: A multi-line verson of something
85
 
   ending with an underscore, but not a phrase-link_
86
 
""",
87
 
"""\
88
 
<document source="test data">
89
 
    <system_message level="2" line="1" source="test data" type="WARNING">
90
 
        <paragraph>
91
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
92
 
        <literal_block xml:space="preserve">
93
 
            .. _target1: Not a proper hyperlink target
94
 
    <system_message level="2" line="3" source="test data" type="WARNING">
95
 
        <paragraph>
96
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
97
 
        <literal_block xml:space="preserve">
98
 
            .. _target2: Although it ends with an underscore, this is not a phrase-link_
99
 
    <system_message level="2" line="5" source="test data" type="WARNING">
100
 
        <paragraph>
101
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
102
 
        <literal_block xml:space="preserve">
103
 
            .. _target3: A multi-line verson of something
104
 
               ending with an underscore, but not a phrase-link_
105
 
"""],
106
 
["""\
107
 
.. __: Not a proper hyperlink target
108
 
 
109
 
__ Although it ends with an underscore, this is not a phrase-link_
110
 
 
111
 
__ A multi-line verson of something
112
 
   ending with an underscore, but not a phrase-link_
113
 
""",
114
 
"""\
115
 
<document source="test data">
116
 
    <system_message level="2" line="1" source="test data" type="WARNING">
117
 
        <paragraph>
118
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
119
 
        <literal_block xml:space="preserve">
120
 
            .. __: Not a proper hyperlink target
121
 
    <system_message level="2" line="3" source="test data" type="WARNING">
122
 
        <paragraph>
123
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
124
 
        <literal_block xml:space="preserve">
125
 
            __ Although it ends with an underscore, this is not a phrase-link_
126
 
    <system_message level="2" line="5" source="test data" type="WARNING">
127
 
        <paragraph>
128
 
            Hyperlink target contains whitespace. Perhaps a footnote was intended?
129
 
        <literal_block xml:space="preserve">
130
 
            __ A multi-line verson of something
131
 
            ending with an underscore, but not a phrase-link_
 
76
    <target ids="target1" names="target1" refname="reference">
 
77
    <target ids="target2" names="target2" refname="phrase-link reference">
132
78
"""],
133
79
["""\
134
80
.. _a long target name:
139
85
""",
140
86
"""\
141
87
<document source="test data">
142
 
    <target id="a-long-target-name" name="a long target name">
143
 
    <target id="a-target-name-including-a-colon-quoted" name="a target name: including a colon (quoted)">
144
 
    <target id="a-target-name-including-a-colon-escaped" name="a target name: including a colon (escaped)">
 
88
    <target ids="a-long-target-name" names="a\ long\ target\ name">
 
89
    <target ids="a-target-name-including-a-colon-quoted" names="a\ target\ name:\ including\ a\ colon\ (quoted)">
 
90
    <target ids="a-target-name-including-a-colon-escaped" names="a\ target\ name:\ including\ a\ colon\ (escaped)">
145
91
"""],
146
92
["""\
147
93
.. _a very long target name,
151
97
""",
152
98
"""\
153
99
<document source="test data">
154
 
    <target id="a-very-long-target-name-split-across-lines" name="a very long target name, split across lines">
155
 
    <target id="and-another-with-backquotes" name="and another, with backquotes">
 
100
    <target ids="a-very-long-target-name-split-across-lines" names="a\ very\ long\ target\ name,\ split\ across\ lines">
 
101
    <target ids="and-another-with-backquotes" names="and\ another,\ with\ backquotes">
156
102
"""],
157
103
["""\
158
104
External hyperlink:
163
109
<document source="test data">
164
110
    <paragraph>
165
111
        External hyperlink:
166
 
    <target id="target" name="target" refuri="http://www.python.org/">
 
112
    <target ids="target" names="target" refuri="http://www.python.org/">
167
113
"""],
168
114
["""\
169
115
.. _email: jdoe@example.com
173
119
""",
174
120
"""\
175
121
<document source="test data">
176
 
    <target id="email" name="email" refuri="mailto:jdoe@example.com">
177
 
    <target id="multi-line-email" name="multi-line email" refuri="mailto:jdoe@example.com">
 
122
    <target ids="email" names="email" refuri="mailto:jdoe@example.com">
 
123
    <target ids="multi-line-email" names="multi-line\ email" refuri="mailto:jdoe@example.com">
178
124
"""],
179
125
["""\
180
126
Duplicate external targets (different URIs):
187
133
<document source="test data">
188
134
    <paragraph>
189
135
        Duplicate external targets (different URIs):
190
 
    <target dupname="target" id="target" refuri="first">
 
136
    <target dupnames="target" ids="target" refuri="first">
191
137
    <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING">
192
138
        <paragraph>
193
139
            Duplicate explicit target name: "target".
194
 
    <target dupname="target" id="id1" refuri="second">
 
140
    <target dupnames="target" ids="id1" refuri="second">
195
141
"""],
196
142
["""\
197
143
Duplicate external targets (same URIs):
204
150
<document source="test data">
205
151
    <paragraph>
206
152
        Duplicate external targets (same URIs):
207
 
    <target id="target" name="target" refuri="first">
 
153
    <target ids="target" names="target" refuri="first">
208
154
    <system_message backrefs="id1" level="1" line="5" source="test data" type="INFO">
209
155
        <paragraph>
210
156
            Duplicate explicit target name: "target".
211
 
    <target dupname="target" id="id1" refuri="first">
 
157
    <target dupnames="target" ids="id1" refuri="first">
212
158
"""],
213
159
["""\
214
160
Duplicate implicit targets.
227
173
<document source="test data">
228
174
    <paragraph>
229
175
        Duplicate implicit targets.
230
 
    <section dupname="title" id="title">
 
176
    <section dupnames="title" ids="title">
231
177
        <title>
232
178
            Title
233
179
        <paragraph>
234
180
            Paragraph.
235
 
    <section dupname="title" id="id1">
 
181
    <section dupnames="title" ids="id1">
236
182
        <title>
237
183
            Title
238
184
        <system_message backrefs="id1" level="1" line="9" source="test data" type="INFO">
255
201
<document source="test data">
256
202
    <paragraph>
257
203
        Duplicate implicit/explicit targets.
258
 
    <section dupname="title" id="title">
 
204
    <section dupnames="title" ids="title">
259
205
        <title>
260
206
            Title
261
207
        <system_message backrefs="id1" level="1" line="6" source="test data" type="INFO">
262
208
            <paragraph>
263
209
                Duplicate implicit target name: "title".
264
 
        <target id="id1" name="title">
 
210
        <target ids="id1" names="title">
265
211
        <paragraph>
266
212
            Paragraph.
267
213
"""],
284
230
<document source="test data">
285
231
    <paragraph>
286
232
        Duplicate explicit targets.
287
 
    <target dupname="title" id="title">
 
233
    <target dupnames="title" ids="title">
288
234
    <paragraph>
289
235
        First.
290
236
    <system_message backrefs="id1" level="2" line="7" source="test data" type="WARNING">
291
237
        <paragraph>
292
238
            Duplicate explicit target name: "title".
293
 
    <target dupname="title" id="id1">
 
239
    <target dupnames="title" ids="id1">
294
240
    <paragraph>
295
241
        Second.
296
242
    <system_message backrefs="id2" level="2" line="11" source="test data" type="WARNING">
297
243
        <paragraph>
298
244
            Duplicate explicit target name: "title".
299
 
    <target dupname="title" id="id2">
 
245
    <target dupnames="title" ids="id2">
300
246
    <paragraph>
301
247
        Third.
302
248
"""],
322
268
<document source="test data">
323
269
    <paragraph>
324
270
        Duplicate targets:
325
 
    <section dupname="target" id="target">
 
271
    <section dupnames="target" ids="target">
326
272
        <title>
327
273
            Target
328
274
        <paragraph>
329
275
            Implicit section header target.
330
 
        <citation dupname="target" id="id1">
 
276
        <citation dupnames="target" ids="id1">
331
277
            <label>
332
278
                target
333
279
            <system_message backrefs="id1" level="1" line="8" source="test data" type="INFO">
335
281
                    Duplicate implicit target name: "target".
336
282
            <paragraph>
337
283
                Citation target.
338
 
        <footnote auto="1" dupname="target" id="id2">
 
284
        <footnote auto="1" dupnames="target" ids="id2">
339
285
            <system_message backrefs="id2" level="2" line="10" source="test data" type="WARNING">
340
286
                <paragraph>
341
287
                    Duplicate explicit target name: "target".
344
290
        <system_message backrefs="id3" level="2" line="12" source="test data" type="WARNING">
345
291
            <paragraph>
346
292
                Duplicate explicit target name: "target".
347
 
        <target dupname="target" id="id3">
 
293
        <target dupnames="target" ids="id3">
348
294
        <paragraph>
349
295
            Explicit internal target.
350
296
        <system_message backrefs="id4" level="2" line="16" source="test data" type="WARNING">
351
297
            <paragraph>
352
298
                Duplicate explicit target name: "target".
353
 
        <target dupname="target" id="id4" refuri="Explicit_external_target">
 
299
        <target dupnames="target" ids="id4" refuri="Explicit_external_target">
 
300
"""],
 
301
["""\
 
302
.. _unescaped colon at end:: no good
 
303
 
 
304
.. _:: no good either
 
305
 
 
306
.. _escaped colon\:: OK
 
307
 
 
308
.. _`unescaped colon, quoted:`: OK
 
309
""",
 
310
"""\
 
311
<document source="test data">
 
312
    <comment xml:space="preserve">
 
313
        _unescaped colon at end:: no good
 
314
    <system_message level="2" line="1" source="test data" type="WARNING">
 
315
        <paragraph>
 
316
            malformed hyperlink target.
 
317
    <comment xml:space="preserve">
 
318
        _:: no good either
 
319
    <system_message level="2" line="3" source="test data" type="WARNING">
 
320
        <paragraph>
 
321
            malformed hyperlink target.
 
322
    <target ids="escaped-colon" names="escaped\ colon:" refuri="OK">
 
323
    <target ids="unescaped-colon-quoted" names="unescaped\ colon,\ quoted:" refuri="OK">
354
324
"""],
355
325
]
356
326
 
364
334
<document source="test data">
365
335
    <paragraph>
366
336
        Anonymous external hyperlink target:
367
 
    <target anonymous="1" id="id1" refuri="http://w3c.org/">
 
337
    <target anonymous="1" ids="id1" refuri="http://w3c.org/">
368
338
"""],
369
339
["""\
370
340
Anonymous external hyperlink target:
375
345
<document source="test data">
376
346
    <paragraph>
377
347
        Anonymous external hyperlink target:
378
 
    <target anonymous="1" id="id1" refuri="http://w3c.org/">
 
348
    <target anonymous="1" ids="id1" refuri="http://w3c.org/">
379
349
"""],
380
350
["""\
381
351
Anonymous indirect hyperlink target:
386
356
<document source="test data">
387
357
    <paragraph>
388
358
        Anonymous indirect hyperlink target:
389
 
    <target anonymous="1" id="id1" refname="reference">
 
359
    <target anonymous="1" ids="id1" refname="reference">
390
360
"""],
391
361
["""\
392
362
Anonymous external hyperlink target, not indirect:
393
363
 
394
364
__ uri\\_
 
365
 
 
366
__ this URI ends with an underscore_
395
367
""",
396
368
"""\
397
369
<document source="test data">
398
370
    <paragraph>
399
371
        Anonymous external hyperlink target, not indirect:
400
 
    <target anonymous="1" id="id1" refuri="uri_">
 
372
    <target anonymous="1" ids="id1" refuri="uri_">
 
373
    <target anonymous="1" ids="id2" refuri="thisURIendswithanunderscore_">
401
374
"""],
402
375
["""\
403
376
Anonymous indirect hyperlink targets:
410
383
<document source="test data">
411
384
    <paragraph>
412
385
        Anonymous indirect hyperlink targets:
413
 
    <target anonymous="1" id="id1" refname="reference">
414
 
    <target anonymous="1" id="id2" refname="a very long reference">
 
386
    <target anonymous="1" ids="id1" refname="reference">
 
387
    <target anonymous="1" ids="id2" refname="a very long reference">
415
388
"""],
416
389
["""\
417
390
Mixed anonymous & named indirect hyperlink targets:
432
405
<document source="test data">
433
406
    <paragraph>
434
407
        Mixed anonymous & named indirect hyperlink targets:
435
 
    <target anonymous="1" id="id1" refname="reference">
436
 
    <target anonymous="1" id="id2" refname="reference">
437
 
    <target anonymous="1" id="id3" refname="reference">
438
 
    <target id="target1" name="target1" refname="reference">
 
408
    <target anonymous="1" ids="id1" refname="reference">
 
409
    <target anonymous="1" ids="id2" refname="reference">
 
410
    <target anonymous="1" ids="id3" refname="reference">
 
411
    <target ids="target1" names="target1" refname="reference">
439
412
    <system_message level="2" line="7" source="test data" type="WARNING">
440
413
        <paragraph>
441
414
            Explicit markup ends without a blank line; unexpected unindent.
442
415
    <paragraph>
443
416
        no blank line
444
 
    <target id="target2" name="target2" refname="reference">
445
 
    <target anonymous="1" id="id4" refname="reference">
446
 
    <target anonymous="1" id="id5" refname="reference">
447
 
    <target anonymous="1" id="id6" refname="reference">
 
417
    <target ids="target2" names="target2" refname="reference">
 
418
    <target anonymous="1" ids="id4" refname="reference">
 
419
    <target anonymous="1" ids="id5" refname="reference">
 
420
    <target anonymous="1" ids="id6" refname="reference">
448
421
    <system_message level="2" line="13" source="test data" type="WARNING">
449
422
        <paragraph>
450
423
            Explicit markup ends without a blank line; unexpected unindent.
451
424
    <paragraph>
452
425
        no blank line
453
426
"""],
 
427
["""\
 
428
.. _
 
429
""",
 
430
"""\
 
431
<document source="test data">
 
432
    <comment xml:space="preserve">
 
433
        _
 
434
"""],
454
435
]
455
436
 
456
437