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

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_inline_markup.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.20 $
6
 
# Date: $Date: 2004/03/25 23:01:10 $
 
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
"""
47
47
"""\
48
48
<document source="test data">
49
49
    <paragraph>
50
 
        <problematic id="id2" refid="id1">
 
50
        <problematic ids="id2" refid="id1">
51
51
            *
52
52
        emphasis without closing asterisk
53
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
53
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
54
54
        <paragraph>
55
55
            Inline emphasis start-string without end-string.
56
56
"""],
85
85
            the* *stars\* *inside
86
86
    <paragraph>
87
87
        (however, '
88
 
        <problematic id="id2" refid="id1">
 
88
        <problematic ids="id2" refid="id1">
89
89
            *
90
90
        args' will trigger a warning and may be problematic)
91
 
    <system_message backrefs="id2" id="id1" level="2" line="5" source="test data" type="WARNING">
 
91
    <system_message backrefs="id2" ids="id1" level="2" line="5" source="test data" type="WARNING">
92
92
        <paragraph>
93
93
            Inline emphasis start-string without end-string.
94
94
    <paragraph>
139
139
        ) but not (**) or '(** ' or x**2 or **kwargs or **
140
140
    <paragraph>
141
141
        (however, '
142
 
        <problematic id="id2" refid="id1">
 
142
        <problematic ids="id2" refid="id1">
143
143
            **
144
144
        kwargs' will trigger a warning and may be problematic)
145
 
    <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
 
145
    <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
146
146
        <paragraph>
147
147
            Inline strong start-string without end-string.
148
148
"""],
168
168
"""\
169
169
<document source="test data">
170
170
    <paragraph>
171
 
        <problematic id="id2" refid="id1">
 
171
        <problematic ids="id2" refid="id1">
172
172
            **
173
173
        strong without closing asterisks
174
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
174
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
175
175
        <paragraph>
176
176
            Inline strong start-string without end-string.
177
177
"""],
228
228
         but not "``" or ``
229
229
    <paragraph>
230
230
        (however, \n\
231
 
        <problematic id="id2" refid="id1">
 
231
        <problematic ids="id2" refid="id1">
232
232
            ``
233
233
        standalone TeX quotes'' will trigger a warning
234
234
        and may be problematic)
235
 
    <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
 
235
    <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
236
236
        <paragraph>
237
237
            Inline literal start-string without end-string.
238
238
"""],
253
253
"""\
254
254
<document source="test data">
255
255
    <paragraph>
256
 
        <problematic id="id2" refid="id1">
 
256
        <problematic ids="id2" refid="id1">
257
257
            ``
258
258
        literal without closing backquotes
259
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
259
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
260
260
        <paragraph>
261
261
            Inline literal start-string without end-string.
262
262
"""],
367
367
    <paragraph>
368
368
        Invalid phrase reference:
369
369
    <paragraph>
370
 
        <problematic id="id2" refid="id1">
 
370
        <problematic ids="id2" refid="id1">
371
371
            :role:`phrase reference`_
372
 
    <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
 
372
    <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
373
373
        <paragraph>
374
374
            Mismatch: both interpreted text role prefix and reference suffix.
375
375
"""],
383
383
    <paragraph>
384
384
        Invalid phrase reference:
385
385
    <paragraph>
386
 
        <problematic id="id2" refid="id1">
 
386
        <problematic ids="id2" refid="id1">
387
387
            `phrase reference`:role:_
388
 
    <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
 
388
    <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
389
389
        <paragraph>
390
390
            Mismatch: both interpreted text role suffix and reference suffix.
391
391
"""],
395
395
"""\
396
396
<document source="test data">
397
397
    <paragraph>
398
 
        <problematic id="id2" refid="id1">
 
398
        <problematic ids="id2" refid="id1">
399
399
            `
400
400
        phrase \n\
401
401
        <reference name="reference" refname="reference">
402
402
            reference
403
403
         without closing backquote
404
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
404
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
405
405
        <paragraph>
406
406
            Inline interpreted text or phrase reference start-string without end-string.
407
407
"""],
411
411
"""\
412
412
<document source="test data">
413
413
    <paragraph>
414
 
        <problematic id="id2" refid="id1">
 
414
        <problematic ids="id2" refid="id1">
415
415
            `
416
416
        anonymous phrase \n\
417
417
        <reference anonymous="1" name="reference">
418
418
            reference
419
419
         without closing backquote
420
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
420
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
421
421
        <paragraph>
422
422
            Inline interpreted text or phrase reference start-string without end-string.
423
423
"""],
432
432
    <paragraph>
433
433
        <reference name="phrase reference" refuri="http://example.com">
434
434
            phrase reference
435
 
        <target id="phrase-reference" name="phrase reference" refuri="http://example.com">
 
435
        <target ids="phrase-reference" names="phrase\ reference" refuri="http://example.com">
436
436
"""],
437
437
["""\
438
438
`anonymous reference <http://example.com>`__
537
537
    <paragraph>
538
538
        <reference name="reference" refuri="reference">
539
539
            reference
540
 
        <target id="reference" name="reference" refuri="reference">
 
540
        <target ids="reference" names="reference" refuri="reference">
541
541
    <paragraph>
542
542
        <reference name="anonymous" refuri="anonymous">
543
543
            anonymous
556
556
"""\
557
557
<document source="test data">
558
558
    <paragraph>
559
 
        <target id="target" name="target">
 
559
        <target ids="target" names="target">
560
560
            target
561
561
    <paragraph>
562
562
        Here is \n\
563
 
        <target id="another-target" name="another target">
 
563
        <target ids="another-target" names="another\ target">
564
564
            another target
565
565
         in some text. And \n\
566
 
        <target id="yet-another-target" name="yet another target">
 
566
        <target ids="yet-another-target" names="yet\ another\ target">
567
567
            yet
568
568
            another target
569
569
        , spanning lines.
570
570
    <paragraph>
571
 
        <target id="here-is-a-target" name="here is a target">
 
571
        <target ids="here-is-a-target" names="here\ is\ a\ target">
572
572
            Here is  a    TaRgeT
573
573
         with case and spacial difficulties.
574
574
"""],
583
583
        But this isn't a _target; targets require backquotes.
584
584
    <paragraph>
585
585
        And \n\
586
 
        <problematic id="id2" refid="id1">
 
586
        <problematic ids="id2" refid="id1">
587
587
            _`
588
588
        this`_ is just plain confusing.
589
 
    <system_message backrefs="id2" id="id1" level="2" line="3" source="test data" type="WARNING">
 
589
    <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
590
590
        <paragraph>
591
591
            Inline target start-string without end-string.
592
592
"""],
596
596
"""\
597
597
<document source="test data">
598
598
    <paragraph>
599
 
        <problematic id="id2" refid="id1">
 
599
        <problematic ids="id2" refid="id1">
600
600
            _`
601
601
        inline target without closing backquote
602
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
602
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
603
603
        <paragraph>
604
604
            Inline target start-string without end-string.
605
605
"""],
612
612
"""\
613
613
<document source="test data">
614
614
    <paragraph>
615
 
        <footnote_reference id="id1" refname="1">
 
615
        <footnote_reference ids="id1" refname="1">
616
616
            1
617
617
"""],
618
618
["""\
621
621
"""\
622
622
<document source="test data">
623
623
    <paragraph>
624
 
        <footnote_reference auto="1" id="id1">
 
624
        <footnote_reference auto="1" ids="id1">
625
625
"""],
626
626
["""\
627
627
[#label]_
629
629
"""\
630
630
<document source="test data">
631
631
    <paragraph>
632
 
        <footnote_reference auto="1" id="id1" refname="label">
 
632
        <footnote_reference auto="1" ids="id1" refname="label">
633
633
"""],
634
634
["""\
635
635
[*]_
637
637
"""\
638
638
<document source="test data">
639
639
    <paragraph>
640
 
        <footnote_reference auto="*" id="id1">
 
640
        <footnote_reference auto="*" ids="id1">
641
641
"""],
642
642
]
643
643
 
648
648
"""\
649
649
<document source="test data">
650
650
    <paragraph>
651
 
        <citation_reference id="id1" refname="citation">
 
651
        <citation_reference ids="id1" refname="citation">
652
652
            citation
653
653
"""],
654
654
["""\
657
657
"""\
658
658
<document source="test data">
659
659
    <paragraph>
660
 
        <citation_reference id="id1" refname="citation">
 
660
        <citation_reference ids="id1" refname="citation">
661
661
            citation
662
662
         and \n\
663
 
        <citation_reference id="id2" refname="cit-ation">
 
663
        <citation_reference ids="id2" refname="cit-ation">
664
664
            cit-ation
665
665
         and \n\
666
 
        <citation_reference id="id3" refname="cit.ation">
 
666
        <citation_reference ids="id3" refname="cit.ation">
667
667
            cit.ation
668
668
         and \n\
669
 
        <citation_reference id="id4" refname="cit1">
 
669
        <citation_reference ids="id4" refname="cit1">
670
670
            CIT1
671
671
         but not [CIT 1]_
672
672
"""],
722
722
"""\
723
723
<document source="test data">
724
724
    <paragraph>
725
 
        <problematic id="id2" refid="id1">
 
725
        <problematic ids="id2" refid="id1">
726
726
            |
727
727
        substitution reference without closing verbar
728
 
    <system_message backrefs="id2" id="id1" level="2" line="1" source="test data" type="WARNING">
 
728
    <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
729
729
        <paragraph>
730
730
            Inline substitution_reference start-string without end-string.
731
731
"""],
732
732
["""\
733
 
| and || and |||
 
733
first | then || and finally |||
734
734
""",
735
735
"""\
736
736
<document source="test data">
737
737
    <paragraph>
738
 
        | and || and |||
 
738
        first | then || and finally |||
739
739
"""],
740
740
]
741
741
 
822
822
        ?)
823
823
"""],
824
824
["""\
825
 
Valid URL with escaped markup characters:
 
825
Valid URLs with escaped markup characters:
826
826
 
827
827
http://example.com/\\*content\\*/whatever
828
 
""",
829
 
"""\
830
 
<document source="test data">
831
 
    <paragraph>
832
 
        Valid URL with escaped markup characters:
833
 
    <paragraph>
834
 
        <reference refuri="http://example.com/*content*/whatever">
835
 
            http://example.com/*content*/whatever
 
828
 
 
829
http://example.com/\\*content*/whatever
 
830
""",
 
831
"""\
 
832
<document source="test data">
 
833
    <paragraph>
 
834
        Valid URLs with escaped markup characters:
 
835
    <paragraph>
 
836
        <reference refuri="http://example.com/*content*/whatever">
 
837
            http://example.com/*content*/whatever
 
838
    <paragraph>
 
839
        <reference refuri="http://example.com/*content*/whatever">
 
840
            http://example.com/*content*/whatever
 
841
"""],
 
842
["""\
 
843
Valid URLs may end with punctuation inside "<>":
 
844
 
 
845
<http://example.org/ends-with-dot.>
 
846
""",
 
847
"""\
 
848
<document source="test data">
 
849
    <paragraph>
 
850
        Valid URLs may end with punctuation inside "<>":
 
851
    <paragraph>
 
852
        <
 
853
        <reference refuri="http://example.org/ends-with-dot.">
 
854
            http://example.org/ends-with-dot.
 
855
        >
 
856
"""],
 
857
["""\
 
858
Valid URLs with interesting endings:
 
859
 
 
860
http://example.org/ends-with-pluses++
 
861
""",
 
862
"""\
 
863
<document source="test data">
 
864
    <paragraph>
 
865
        Valid URLs with interesting endings:
 
866
    <paragraph>
 
867
        <reference refuri="http://example.org/ends-with-pluses++">
 
868
            http://example.org/ends-with-pluses++
836
869
"""],
837
870
["""\
838
871
None of these are standalone hyperlinks (their "schemes"
844
877
        None of these are standalone hyperlinks (their "schemes"
845
878
        are not recognized): signal:noise, a:b.
846
879
"""],
 
880
["""\
 
881
Escaped email addresses are not recognized: test\@example.org
 
882
""",
 
883
"""\
 
884
<document source="test data">
 
885
    <paragraph>
 
886
        Escaped email addresses are not recognized: test@example.org
 
887
"""],
847
888
]
848
889
 
849
890
totest['miscellaneous'] = [