2 # -*- coding: utf-8 -*-
5 # Author: David Goodger <goodger@python.org>
6 # Copyright: This module has been placed in the public domain.
9 Tests for inline markup in docutils/parsers/rst/states.py.
10 Interpreted text tests are in a separate module, test_interpreted.py.
13 from __init__
import DocutilsTestSupport
16 s
= DocutilsTestSupport
.ParserTestSuite()
17 s
.generateTests(totest
)
22 totest
['emphasis'] = [
27 <document source="test data">
33 l'*emphasis* with the *emphasis*' apostrophe.
34 l\u2019*emphasis* with the *emphasis*\u2019 apostrophe.
37 <document source="test data">
59 <document source="test data">
66 *emphasis without closing asterisk
69 <document source="test data">
71 <problematic ids="id2" refid="id1">
73 emphasis without closing asterisk
74 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
76 Inline emphasis start-string without end-string.
78 [r
"""some punctuation is allowed around inline markup, e.g.
79 /*emphasis*/, -*emphasis*-, and :*emphasis*: (delimiters),
80 (*emphasis*), [*emphasis*], <*emphasis*>, {*emphasis*} (open/close pairs)
81 *emphasis*., *emphasis*,, *emphasis*!, and *emphasis*\ (closing delimiters),
84 )*emphasis*(, ]*emphasis*[, >*emphasis*>, }*emphasis*{ (close/open pairs),
85 (*), [*], '*' or '"*"' ("quoted" start-string),
86 x*2* or 2*x* (alphanumeric char before),
87 \*args or * (escaped, whitespace behind start-string),
88 or *the\* *stars\* *inside* (escaped, whitespace before end-string).
90 However, '*args' will trigger a warning and may be problematic.
95 <document source="test data">
97 some punctuation is allowed around inline markup, e.g.
132 (closing delimiters),
135 )*emphasis*(, ]*emphasis*[, >*emphasis*>, }*emphasis*{ (close/open pairs),
136 (*), [*], '*' or '"*"' ("quoted" start-string),
137 x*2* or 2*x* (alphanumeric char before),
138 *args or * (escaped, whitespace behind start-string),
142 (escaped, whitespace before end-string).
145 <problematic ids="id2" refid="id1">
147 args' will trigger a warning and may be problematic.
148 <system_message backrefs="id2" ids="id1" level="2" line="13" source="test data" type="WARNING">
150 Inline emphasis start-string without end-string.
158 Quotes around inline markup:
160 '*emphasis*' "*emphasis*" Straight,
161 ‘*emphasis*’ “*emphasis*” English, ...,
162 « *emphasis* » ‹ *emphasis* › « *emphasis* » ‹ *emphasis* ›
163 « *emphasis* » ‹ *emphasis* › French,
164 „*emphasis*“ ‚*emphasis*‘ »*emphasis*« ›*emphasis*‹ German, Czech, ...,
165 „*emphasis*” «*emphasis*» Romanian,
166 “*emphasis*„ ‘*emphasis*‚ Greek,
167 「*emphasis*」 『*emphasis*』traditional Chinese,
168 ”*emphasis*” ’*emphasis*’ »*emphasis*» ›*emphasis*› Swedish, Finnish,
169 „*emphasis*” ‚*emphasis*’ Polish,
170 „*emphasis*” »*emphasis*« ’*emphasis*’ Hungarian,
173 <document source="test data">
175 Quotes around inline markup:
194 \u202f\xbb \u2039\u202f
197 \u202f\u203a \xab\xa0
207 \u2005\xbb \u2039\u2005
223 \u2039 German, Czech, ...,
244 \u300ftraditional Chinese,
257 \u203a Swedish, Finnish,
277 Emphasized asterisk: *\**
279 Emphasized double asterisk: *\***
282 <document source="test data">
284 Emphasized asterisk: \n\
288 Emphasized double asterisk: \n\
299 <document source="test data">
305 l'**strong** and l\u2019**strong** with apostrophe
308 <document source="test data">
319 quoted '**strong**', quoted "**strong**",
320 quoted \u2018**strong**\u2019, quoted \u201c**strong**\u201d,
321 quoted \xab**strong**\xbb
324 <document source="test data">
336 \u2019, quoted \u201c
346 (**strong**) but not (**) or '(** ' or x**2 or \**kwargs or **
348 (however, '**kwargs' will trigger a warning and may be problematic)
351 <document source="test data">
356 ) but not (**) or '(** ' or x**2 or **kwargs or **
359 <problematic ids="id2" refid="id1">
361 kwargs' will trigger a warning and may be problematic)
362 <system_message backrefs="id2" ids="id1" level="2" line="4" source="test data" type="WARNING">
364 Inline strong start-string without end-string.
367 Strong asterisk: *****
369 Strong double asterisk: ******
372 <document source="test data">
378 Strong double asterisk: \n\
383 **strong without closing asterisks
386 <document source="test data">
388 <problematic ids="id2" refid="id1">
390 strong without closing asterisks
391 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
393 Inline strong start-string without end-string.
397 totest
['literal'] = [
402 <document source="test data">
411 <document source="test data">
420 <document source="test data">
429 <document source="test data">
435 l'``literal`` and l\u2019``literal`` with apostrophe
438 <document source="test data">
449 quoted '``literal``', quoted "``literal``",
450 quoted \u2018``literal``\u2019, quoted \u201c``literal``\u201d,
451 quoted \xab``literal``\xbb
454 <document source="test data">
466 \u2019, quoted \u201c
476 ``'literal'`` with quotes, ``"literal"`` with quotes,
477 ``\u2018literal\u2019`` with quotes, ``\u201cliteral\u201d`` with quotes,
478 ``\xabliteral\xbb`` with quotes
481 <document source="test data">
500 ``literal ``TeX quotes'' & \backslash`` but not "``" or ``
502 (however, ``standalone TeX quotes'' will trigger a warning
503 and may be problematic)
506 <document source="test data">
509 literal ``TeX quotes'' & \\backslash
513 <problematic ids="id2" refid="id1">
515 standalone TeX quotes'' will trigger a warning
516 and may be problematic)
517 <system_message backrefs="id2" ids="id1" level="2" line="4" source="test data" type="WARNING">
519 Inline literal start-string without end-string.
522 Find the ```interpreted text``` in this paragraph!
525 <document source="test data">
533 ``literal without closing backquotes
536 <document source="test data">
538 <problematic ids="id2" refid="id1">
540 literal without closing backquotes
541 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
543 Inline literal start-string without end-string.
546 Python ``list``\s use square bracket syntax.
549 <document source="test data">
554 s use square bracket syntax.
558 totest
['references'] = [
563 <document source="test data">
565 <reference name="ref" refname="ref">
569 l'ref_ and l\u2019ref_ with apostrophe
572 <document source="test data">
575 <reference name="ref" refname="ref">
578 <reference name="ref" refname="ref">
583 quoted 'ref_', quoted "ref_",
584 quoted \u2018ref_\u2019, quoted \u201cref_\u201d,
586 but not 'ref ref'_, "ref ref"_, \u2018ref ref\u2019_,
587 \u201cref ref\u201d_, or \xabref ref\xbb_
590 <document source="test data">
593 <reference name="ref" refname="ref">
596 <reference name="ref" refname="ref">
600 <reference name="ref" refname="ref">
602 \u2019, quoted \u201c
603 <reference name="ref" refname="ref">
607 <reference name="ref" refname="ref">
610 but not 'ref ref'_, "ref ref"_, \u2018ref ref\u2019_,
611 \u201cref ref\u201d_, or \xabref ref\xbb_
617 <document source="test data">
619 <reference anonymous="1" name="ref">
623 l'ref__ and l\u2019ref__ with apostrophe
626 <document source="test data">
629 <reference anonymous="1" name="ref">
632 <reference anonymous="1" name="ref">
637 quoted 'ref__', quoted "ref__",
638 quoted \u2018ref__\u2019, quoted \u201cref__\u201d,
639 quoted \xabref__\xbb,
640 but not 'ref ref'__, "ref ref"__, \u2018ref ref\u2019__,
641 \u201cref ref\u201d__, or \xabref ref\xbb__
644 <document source="test data">
647 <reference anonymous="1" name="ref">
650 <reference anonymous="1" name="ref">
654 <reference anonymous="1" name="ref">
656 \u2019, quoted \u201c
657 <reference anonymous="1" name="ref">
661 <reference anonymous="1" name="ref">
664 but not 'ref ref'__, "ref ref"__, \u2018ref ref\u2019__,
665 \u201cref ref\u201d__, or \xabref ref\xbb__
668 ref_, r_, r_e-f_, -ref_, and anonymousref__,
669 but not _ref_ or __attr__ or object.__attr__
672 <document source="test data">
674 <reference name="ref" refname="ref">
677 <reference name="r" refname="r">
680 <reference name="r_e-f" refname="r_e-f">
683 <reference name="ref" refname="ref">
686 <reference anonymous="1" name="anonymousref">
689 but not _ref_ or __attr__ or object.__attr__
693 totest
['phrase_references'] = [
698 <document source="test data">
700 <reference name="phrase reference" refname="phrase reference">
704 l'`phrase reference`_ and l\u2019`phrase reference`_ with apostrophe
707 <document source="test data">
710 <reference name="phrase reference" refname="phrase reference">
713 <reference name="phrase reference" refname="phrase reference">
718 quoted '`phrase reference`_', quoted "`phrase reference`_",
719 quoted \u2018`phrase reference`_\u2019,
720 quoted \u201c`phrase reference`_\u201d,
721 quoted \xab`phrase reference`_\xbb
724 <document source="test data">
727 <reference name="phrase reference" refname="phrase reference">
730 <reference name="phrase reference" refname="phrase reference">
734 <reference name="phrase reference" refname="phrase reference">
738 <reference name="phrase reference" refname="phrase reference">
742 <reference name="phrase reference" refname="phrase reference">
747 `'phrase reference'`_ with quotes, `"phrase reference"`_ with quotes,
748 `\u2018phrase reference\u2019`_ with quotes,
749 `\u201cphrase reference\u201d`_ with quotes,
750 `\xabphrase reference\xbb`_ with quotes
753 <document source="test data">
755 <reference name="'phrase reference'" refname="'phrase reference'">
758 <reference name=""phrase reference"" refname=""phrase reference"">
761 <reference name="\u2018phrase reference\u2019" refname="\u2018phrase reference\u2019">
762 \u2018phrase reference\u2019
764 <reference name="\u201cphrase reference\u201d" refname="\u201cphrase reference\u201d">
765 \u201cphrase reference\u201d
767 <reference name="\xabphrase reference\xbb" refname="\xabphrase reference\xbb">
768 \xabphrase reference\xbb
772 `anonymous reference`__
775 <document source="test data">
777 <reference anonymous="1" name="anonymous reference">
781 l'`anonymous reference`__ and l\u2019`anonymous reference`__ with apostrophe
784 <document source="test data">
787 <reference anonymous="1" name="anonymous reference">
790 <reference anonymous="1" name="anonymous reference">
795 quoted '`anonymous reference`__', quoted "`anonymous reference`__",
796 quoted \u2018`anonymous reference`__\u2019,
797 quoted \u201c`anonymous reference`__\u201d,
798 quoted \xab`anonymous reference`__\xbb
801 <document source="test data">
804 <reference anonymous="1" name="anonymous reference">
807 <reference anonymous="1" name="anonymous reference">
811 <reference anonymous="1" name="anonymous reference">
815 <reference anonymous="1" name="anonymous reference">
819 <reference anonymous="1" name="anonymous reference">
824 `'anonymous reference'`__ with quotes, `"anonymous reference"`__ with quotes,
825 `\u2018anonymous reference\u2019`__ with quotes,
826 `\u201canonymous reference\u201d`__ with quotes,
827 `\xabanonymous reference\xbb`__ with quotes
830 <document source="test data">
832 <reference anonymous="1" name="'anonymous reference'">
833 'anonymous reference'
835 <reference anonymous="1" name=""anonymous reference"">
836 "anonymous reference"
838 <reference anonymous="1" name="\u2018anonymous reference\u2019">
839 \u2018anonymous reference\u2019
841 <reference anonymous="1" name="\u201canonymous reference\u201d">
842 \u201canonymous reference\u201d
844 <reference anonymous="1" name="\xabanonymous reference\xbb">
845 \xabanonymous reference\xbb
853 <document source="test data">
855 <reference name="phrase reference across lines" refname="phrase reference across lines">
860 `phrase\`_ reference`_
863 <document source="test data">
865 <reference name="phrase`_ reference" refname="phrase`_ reference">
869 Invalid phrase reference:
871 :role:`phrase reference`_
874 <document source="test data">
876 Invalid phrase reference:
878 <problematic ids="id2" refid="id1">
879 :role:`phrase reference`_
880 <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
882 Mismatch: both interpreted text role prefix and reference suffix.
885 Invalid phrase reference:
887 `phrase reference`:role:_
890 <document source="test data">
892 Invalid phrase reference:
894 <problematic ids="id2" refid="id1">
895 `phrase reference`:role:_
896 <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
898 Mismatch: both interpreted text role suffix and reference suffix.
901 `phrase reference_ without closing backquote
904 <document source="test data">
906 <problematic ids="id2" refid="id1">
909 <reference name="reference" refname="reference">
911 without closing backquote
912 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
914 Inline interpreted text or phrase reference start-string without end-string.
917 `anonymous phrase reference__ without closing backquote
920 <document source="test data">
922 <problematic ids="id2" refid="id1">
925 <reference anonymous="1" name="reference">
927 without closing backquote
928 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
930 Inline interpreted text or phrase reference start-string without end-string.
934 totest
['embedded_URIs'] = [
936 `phrase reference <http://example.com>`_
939 <document source="test data">
941 <reference name="phrase reference" refuri="http://example.com">
943 <target ids="phrase-reference" names="phrase\ reference" refuri="http://example.com">
946 `anonymous reference <http://example.com>`__
949 <document source="test data">
951 <reference name="anonymous reference" refuri="http://example.com">
955 `embedded URI on next line
956 <http://example.com>`__
959 <document source="test data">
961 <reference name="embedded URI on next line" refuri="http://example.com">
962 embedded URI on next line
965 `embedded URI across lines <http://example.com/
969 <document source="test data">
971 <reference name="embedded URI across lines" refuri="http://example.com/long/path">
972 embedded URI across lines
975 `embedded URI with whitespace <http://example.com/
976 long/path /and /whitespace>`__
979 <document source="test data">
981 <reference name="embedded URI with whitespace" refuri="http://example.com/long/path/and/whitespace">
982 embedded URI with whitespace
985 `embedded email address <jdoe@example.com>`__
987 `embedded email address broken across lines <jdoe
991 <document source="test data">
993 <reference name="embedded email address" refuri="mailto:jdoe@example.com">
994 embedded email address
996 <reference name="embedded email address broken across lines" refuri="mailto:jdoe@example.com">
997 embedded email address broken across lines
1000 `embedded URI with too much whitespace < http://example.com/
1001 long/path /and /whitespace >`__
1003 `embedded URI with too much whitespace at end <http://example.com/
1004 long/path /and /whitespace >`__
1006 `embedded URI with no preceding whitespace<http://example.com>`__
1008 `escaped URI \<http://example.com>`__
1010 See `HTML Anchors: \<a>`_.
1013 <document source="test data">
1015 <reference anonymous="1" name="embedded URI with too much whitespace < http://example.com/ long/path /and /whitespace >">
1016 embedded URI with too much whitespace < http://example.com/
1017 long/path /and /whitespace >
1019 <reference anonymous="1" name="embedded URI with too much whitespace at end <http://example.com/ long/path /and /whitespace >">
1020 embedded URI with too much whitespace at end <http://example.com/
1021 long/path /and /whitespace >
1023 <reference anonymous="1" name="embedded URI with no preceding whitespace<http://example.com>">
1024 embedded URI with no preceding whitespace<http://example.com>
1026 <reference anonymous="1" name="escaped URI <http://example.com>">
1027 escaped URI <http://example.com>
1030 <reference name="HTML Anchors: <a>" refname="html anchors: <a>">
1035 Relative URIs' reference text can be omitted:
1042 <document source="test data">
1044 Relative URIs' reference text can be omitted:
1046 <reference name="reference" refuri="reference">
1048 <target ids="reference" names="reference" refuri="reference">
1050 <reference name="anonymous" refuri="anonymous">
1054 Escape trailing low-line char in URIs:
1061 <document source="test data">
1063 Escape trailing low-line char in URIs:
1065 <reference name="reference_" refuri="reference_">
1067 <target ids="reference" names="reference_" refuri="reference_">
1069 <reference name="anonymous_" refuri="anonymous_">
1074 totest
['embedded_aliases'] = [
1076 `phrase reference <alias_>`_
1079 <document source="test data">
1081 <reference name="phrase reference" refname="alias">
1083 <target names="phrase\ reference" refname="alias">
1086 `anonymous reference <alias_>`__
1089 <document source="test data">
1091 <reference name="anonymous reference" refname="alias">
1095 `embedded alias on next line
1099 <document source="test data">
1101 <reference name="embedded alias on next line" refname="alias">
1102 embedded alias on next line
1105 `embedded alias across lines <alias
1109 <document source="test data">
1111 <reference name="embedded alias across lines" refname="alias phrase">
1112 embedded alias across lines
1115 `embedded alias with whitespace <alias
1119 <document source="test data">
1121 <reference name="embedded alias with whitespace" refname="alias long phrase">
1122 embedded alias with whitespace
1125 `embedded alias with too much whitespace < alias_ >`__
1127 `embedded alias with no preceding whitespace<alias_>`__
1130 <document source="test data">
1132 <reference anonymous="1" name="embedded alias with too much whitespace < alias_ >">
1133 embedded alias with too much whitespace < alias_ >
1135 <reference anonymous="1" name="embedded alias with no preceding whitespace<alias_>">
1136 embedded alias with no preceding whitespace<alias_>
1140 totest
['inline_targets'] = [
1144 Here is _`another target` in some text. And _`yet
1145 another target`, spanning lines.
1147 _`Here is a TaRgeT` with case and spacial difficulties.
1150 <document source="test data">
1152 <target ids="target" names="target">
1156 <target ids="another-target" names="another\ target">
1158 in some text. And \n\
1159 <target ids="yet-another-target" names="yet\ another\ target">
1164 <target ids="here-is-a-target" names="here\ is\ a\ target">
1166 with case and spacial difficulties.
1169 l'_`target1` and l\u2019_`target2` with apostrophe
1172 <document source="test data">
1175 <target ids="target1" names="target1">
1178 <target ids="target2" names="target2">
1183 quoted '_`target1`', quoted "_`target2`",
1184 quoted \u2018_`target3`\u2019, quoted \u201c_`target4`\u201d,
1185 quoted \xab_`target5`\xbb
1188 <document source="test data">
1191 <target ids="target1" names="target1">
1194 <target ids="target2" names="target2">
1198 <target ids="target3" names="target3">
1200 \u2019, quoted \u201c
1201 <target ids="target4" names="target4">
1205 <target ids="target5" names="target5">
1210 _`'target1'` with quotes, _`"target2"` with quotes,
1211 _`\u2018target3\u2019` with quotes, _`\u201ctarget4\u201d` with quotes,
1212 _`\xabtarget5\xbb` with quotes
1215 <document source="test data">
1217 <target ids="target1" names="'target1'">
1220 <target ids="target2" names=""target2"">
1223 <target ids="target3" names="\u2018target3\u2019">
1226 <target ids="target4" names="\u201ctarget4\u201d">
1229 <target ids="target5" names="\xabtarget5\xbb">
1234 But this isn't a _target; targets require backquotes.
1236 And _`this`_ is just plain confusing.
1239 <document source="test data">
1241 But this isn't a _target; targets require backquotes.
1244 <problematic ids="id2" refid="id1">
1246 this`_ is just plain confusing.
1247 <system_message backrefs="id2" ids="id1" level="2" line="3" source="test data" type="WARNING">
1249 Inline target start-string without end-string.
1252 _`inline target without closing backquote
1255 <document source="test data">
1257 <problematic ids="id2" refid="id1">
1259 inline target without closing backquote
1260 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
1262 Inline target start-string without end-string.
1266 totest
['footnote_reference'] = [
1271 <document source="test data">
1273 <footnote_reference ids="id1" refname="1">
1280 <document source="test data">
1282 <footnote_reference auto="1" ids="id1">
1288 <document source="test data">
1290 <footnote_reference auto="1" ids="id1" refname="label">
1296 <document source="test data">
1298 <footnote_reference auto="*" ids="id1">
1301 Adjacent footnote refs are not possible: [*]_[#label]_ [#]_[2]_ [1]_[*]_
1304 <document source="test data">
1306 Adjacent footnote refs are not possible: [*]_[#label]_ [#]_[2]_ [1]_[*]_
1310 totest
['citation_reference'] = [
1315 <document source="test data">
1317 <citation_reference ids="id1" refname="citation">
1321 [citation]_ and [cit-ation]_ and [cit.ation]_ and [CIT1]_ but not [CIT 1]_
1324 <document source="test data">
1326 <citation_reference ids="id1" refname="citation">
1329 <citation_reference ids="id2" refname="cit-ation">
1332 <citation_reference ids="id3" refname="cit.ation">
1335 <citation_reference ids="id4" refname="cit1">
1340 Adjacent citation refs are not possible: [citation]_[CIT1]_
1343 <document source="test data">
1345 Adjacent citation refs are not possible: [citation]_[CIT1]_
1349 totest
['substitution_references'] = [
1354 <document source="test data">
1356 <substitution_reference refname="subref">
1360 |subref|_ and |subref|__
1363 <document source="test data">
1365 <reference refname="subref">
1366 <substitution_reference refname="subref">
1369 <reference anonymous="1">
1370 <substitution_reference refname="subref">
1374 |substitution reference|
1377 <document source="test data">
1379 <substitution_reference refname="substitution reference">
1380 substitution reference
1387 <document source="test data">
1389 <substitution_reference refname="substitution reference">
1394 |substitution reference without closing verbar
1397 <document source="test data">
1399 <problematic ids="id2" refid="id1">
1401 substitution reference without closing verbar
1402 <system_message backrefs="id2" ids="id1" level="2" line="1" source="test data" type="WARNING">
1404 Inline substitution_reference start-string without end-string.
1407 first | then || and finally |||
1410 <document source="test data">
1412 first | then || and finally |||
1416 totest
['standalone_hyperlink'] = [
1418 http://www.standalone.hyperlink.com
1420 http:/one-slash-only.absolute.path
1422 [http://example.com]
1424 (http://example.com)
1426 <http://example.com>
1428 http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html
1430 http://[3ffe:2a00:100:7031::1] (the final "]" is ambiguous in text)
1432 http://[3ffe:2a00:100:7031::1]/
1434 mailto:someone@somewhere.com
1436 news:comp.lang.python
1438 An email address in a sentence: someone@somewhere.com.
1440 ftp://ends.with.a.period.
1442 (a.question.mark@end?)
1445 <document source="test data">
1447 <reference refuri="http://www.standalone.hyperlink.com">
1448 http://www.standalone.hyperlink.com
1450 <reference refuri="http:/one-slash-only.absolute.path">
1451 http:/one-slash-only.absolute.path
1454 <reference refuri="http://example.com">
1459 <reference refuri="http://example.com">
1464 <reference refuri="http://example.com">
1468 <reference refuri="http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html">
1469 http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html
1471 <reference refuri="http://[3ffe:2a00:100:7031::1">
1472 http://[3ffe:2a00:100:7031::1
1473 ] (the final "]" is ambiguous in text)
1475 <reference refuri="http://[3ffe:2a00:100:7031::1]/">
1476 http://[3ffe:2a00:100:7031::1]/
1478 <reference refuri="mailto:someone@somewhere.com">
1479 mailto:someone@somewhere.com
1481 <reference refuri="news:comp.lang.python">
1482 news:comp.lang.python
1484 An email address in a sentence: \n\
1485 <reference refuri="mailto:someone@somewhere.com">
1486 someone@somewhere.com
1489 <reference refuri="ftp://ends.with.a.period">
1490 ftp://ends.with.a.period
1494 <reference refuri="mailto:a.question.mark@end">
1499 Valid URLs with escaped markup characters:
1501 http://example.com/\*content\*/whatever
1503 http://example.com/\*content*/whatever
1506 <document source="test data">
1508 Valid URLs with escaped markup characters:
1510 <reference refuri="http://example.com/*content*/whatever">
1511 http://example.com/*content*/whatever
1513 <reference refuri="http://example.com/*content*/whatever">
1514 http://example.com/*content*/whatever
1517 Valid URLs may end with punctuation inside "<>":
1519 <http://example.org/ends-with-dot.>
1522 <document source="test data">
1524 Valid URLs may end with punctuation inside "<>":
1527 <reference refuri="http://example.org/ends-with-dot.">
1528 http://example.org/ends-with-dot.
1532 Valid URLs with interesting endings:
1534 http://example.org/ends-with-pluses++
1537 <document source="test data">
1539 Valid URLs with interesting endings:
1541 <reference refuri="http://example.org/ends-with-pluses++">
1542 http://example.org/ends-with-pluses++
1545 None of these are standalone hyperlinks (their "schemes"
1546 are not recognized): signal:noise, a:b.
1549 <document source="test data">
1551 None of these are standalone hyperlinks (their "schemes"
1552 are not recognized): signal:noise, a:b.
1555 Escaped email addresses are not recognized: test\@example.org
1558 <document source="test data">
1560 Escaped email addresses are not recognized: test@example.org
1564 totest
['markup recognition rules'] = [
1566 __This__ should be left alone.
1569 <document source="test data">
1571 __This__ should be left alone.
1574 Character-level m\ *a*\ **r**\ ``k``\ `u`:title:\p
1575 with backslash-escaped whitespace, including new\
1579 <document source="test data">
1591 with backslash-escaped whitespace, including newlines.
1594 text-*separated*\u2010*by*\u2011*various*\u2012*dashes*\u2013*and*\u2014*hyphens*.
1595 \u00bf*punctuation*? \u00a1*examples*!\u00a0*\u00a0no-break-space\u00a0*.
1598 <document source="test data">
1627 \u00a0no-break-space\u00a0
1630 # Whitespace characters:
1631 # \u180e*MONGOLIAN VOWEL SEPARATOR*\u180e, fails in Python 2.4
1635 or *space* or one of
1636 \xa0*NO-BREAK SPACE*\xa0,
1637 \u1680*OGHAM SPACE MARK*\u1680,
1638 \u2000*EN QUAD*\u2000,
1639 \u2001*EM QUAD*\u2001,
1640 \u2002*EN SPACE*\u2002,
1641 \u2003*EM SPACE*\u2003,
1642 \u2004*THREE-PER-EM SPACE*\u2004,
1643 \u2005*FOUR-PER-EM SPACE*\u2005,
1644 \u2006*SIX-PER-EM SPACE*\u2006,
1645 \u2007*FIGURE SPACE*\u2007,
1646 \u2008*PUNCTUATION SPACE*\u2008,
1647 \u2009*THIN SPACE*\u2009,
1648 \u200a*HAIR SPACE*\u200a,
1649 \u202f*NARROW NO-BREAK SPACE*\u202f,
1650 \u205f*MEDIUM MATHEMATICAL SPACE*\u205f,
1651 \u3000*IDEOGRAPHIC SPACE*\u3000,
1652 \u2028*LINE SEPARATOR*\u2028
1655 <document source="test data">
1719 NARROW NO-BREAK SPACE
1723 MEDIUM MATHEMATICAL SPACE
1733 # « * » ‹ * › « * » ‹ * › « * » ‹ * › French,
1735 "Quoted" markup start-string (matched openers & closers) -> no markup:
1737 '*' "*" (*) <*> [*] {*}
1740 Some international quoting styles:
1741 ‘*’ “*” English, ...,
1742 „*“ ‚*‘ »*« ›*‹ German, Czech, ...,
1745 「*」 『*』traditional Chinese,
1746 ”*” ’*’ »*» ›*› Swedish, Finnish,
1748 „*” »*« ’*’ Hungarian,
1750 But this is „*’ emphasized »*‹.
1753 <document source="test data">
1755 "Quoted" markup start-string (matched openers & closers) -> no markup:
1757 '*' "*" (*) <*> [*] {*}
1760 Some international quoting styles:
1761 ‘*’ “*” English, ...,
1762 „*“ ‚*‘ »*« ›*‹ German, Czech, ...,
1765 「*」 『*』traditional Chinese,
1766 ”*” ’*’ »*» ›*› Swedish, Finnish,
1768 „*” »*« ’*’ Hungarian,
1778 if __name__
== '__main__':
1780 unittest
.main(defaultTest
='suite')