From: <fwi...@us...> - 2006-01-22 17:22:43
|
Author: fwiemann Date: 2006-01-22 18:22:29 +0100 (Sun, 22 Jan 2006) New Revision: 4315 Modified: trunk/docutils/BUGS.txt trunk/docutils/HISTORY.txt trunk/docutils/docutils/parsers/rst/states.py trunk/docutils/test/test_parsers/test_rst/test_targets.py Log: fixed "target beginning with underscore" bug; added test for missing closing backquote in targets Modified: trunk/docutils/BUGS.txt =================================================================== --- trunk/docutils/BUGS.txt 2006-01-22 16:54:10 UTC (rev 4314) +++ trunk/docutils/BUGS.txt 2006-01-22 17:22:29 UTC (rev 4315) @@ -111,12 +111,6 @@ Also see the `SourceForge Bug Tracker`_. -* .. _target with underscore: - - The reStructuredText parser recognizes ``.. __foo: bar`` as a target - with the name ``_foo``. That's most probably not intended by the - user, so the parser should generate an error message instead. - * The "stylesheet" setting (a URL, to be used verbatim) should be allowed to be combined with "embed_stylesheet". The stylesheet data should be read in using urllib. There was an assumption that a Modified: trunk/docutils/HISTORY.txt =================================================================== --- trunk/docutils/HISTORY.txt 2006-01-22 16:54:10 UTC (rev 4314) +++ trunk/docutils/HISTORY.txt 2006-01-22 17:22:29 UTC (rev 4315) @@ -15,7 +15,12 @@ Changes Since 0.4 ================= +* docutils/parsers/rst/states.py: + - Unquoted targets beginning with an underscore (``.. __target: + URI``) are no longer accepted. + + Release 0.4 (2006-01-09) ======================== Modified: trunk/docutils/docutils/parsers/rst/states.py =================================================================== --- trunk/docutils/docutils/parsers/rst/states.py 2006-01-22 16:54:10 UTC (rev 4314) +++ trunk/docutils/docutils/parsers/rst/states.py 2006-01-22 17:22:29 UTC (rev 4315) @@ -1720,6 +1720,7 @@ ( _ # anonymous target | # *OR* + (?!_) # no underscore at the beginning (?P<quote>`?) # optional open quote (?![ `]) # first char. not space or # backquote Modified: trunk/docutils/test/test_parsers/test_rst/test_targets.py =================================================================== --- trunk/docutils/test/test_parsers/test_rst/test_targets.py 2006-01-22 16:54:10 UTC (rev 4314) +++ trunk/docutils/test/test_parsers/test_rst/test_targets.py 2006-01-22 17:22:29 UTC (rev 4315) @@ -90,6 +90,23 @@ <target ids="a-target-name-including-a-colon-escaped" names="a\ target\ name:\ including\ a\ colon\ (escaped)"> """], ["""\ +.. _`target: No matching backquote. +.. _`: No matching backquote either. +""", +"""\ +<document source="test data"> + <comment xml:space="preserve"> + _`target: No matching backquote. + <system_message level="2" line="1" source="test data" type="WARNING"> + <paragraph> + malformed hyperlink target. + <comment xml:space="preserve"> + _`: No matching backquote either. + <system_message level="2" line="2" source="test data" type="WARNING"> + <paragraph> + malformed hyperlink target. +"""], +["""\ .. _a very long target name, split across lines: .. _`and another, @@ -123,6 +140,28 @@ <target ids="multi-line-email" names="multi-line\ email" refuri="mailto:jd...@ex..."> """], ["""\ +Malformed target: + +.. __malformed: no good + +Target beginning with an underscore: + +.. _`_target`: OK +""", +"""\ +<document source="test data"> + <paragraph> + Malformed target: + <comment xml:space="preserve"> + __malformed: no good + <system_message level="2" line="3" source="test data" type="WARNING"> + <paragraph> + malformed hyperlink target. + <paragraph> + Target beginning with an underscore: + <target ids="target" names="_target" refuri="OK"> +"""], +["""\ Duplicate external targets (different URIs): .. _target: first |