diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-03-26 16:21:28 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2005-03-26 16:21:28 +0000 |
| commit | 9dbc2adead008935245a396eab10bb7bcb11b226 (patch) | |
| tree | bd50e907b4e88e09d6c63e02d7172720d5576b52 /test/test_transforms | |
| parent | 4df9fad485c1e12e850f9d7ff225d51c538af3dc (diff) | |
| download | docutils-9dbc2adead008935245a396eab10bb7bcb11b226.tar.gz | |
merged rev. 3094:3101 and 3102:HEAD from branches/multiple-ids to trunk
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@3129 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'test/test_transforms')
| -rwxr-xr-x | test/test_transforms/test_class.py | 16 | ||||
| -rwxr-xr-x | test/test_transforms/test_contents.py | 92 | ||||
| -rwxr-xr-x | test/test_transforms/test_docinfo.py | 4 | ||||
| -rwxr-xr-x | test/test_transforms/test_doctitle.py | 26 | ||||
| -rwxr-xr-x | test/test_transforms/test_final_checks.py | 28 | ||||
| -rwxr-xr-x | test/test_transforms/test_footnotes.py | 162 | ||||
| -rwxr-xr-x | test/test_transforms/test_hyperlinks.py | 315 | ||||
| -rwxr-xr-x | test/test_transforms/test_messages.py | 6 | ||||
| -rwxr-xr-x | test/test_transforms/test_peps.py | 8 | ||||
| -rwxr-xr-x | test/test_transforms/test_sectnum.py | 116 | ||||
| -rwxr-xr-x | test/test_transforms/test_substitutions.py | 28 |
11 files changed, 459 insertions, 342 deletions
diff --git a/test/test_transforms/test_class.py b/test/test_transforms/test_class.py index 2825cdf28..6fc2b33a5 100755 --- a/test/test_transforms/test_class.py +++ b/test/test_transforms/test_class.py @@ -30,7 +30,7 @@ paragraph """, """\ <document source="test data"> - <paragraph class="one"> + <paragraph classes="one"> paragraph """], ["""\ @@ -42,7 +42,7 @@ paragraph """\ <document source="test data"> <comment xml:space="preserve"> - <block_quote class="two"> + <block_quote classes="two"> <paragraph> Block quote """], @@ -58,7 +58,7 @@ Paragraph <block_quote> <paragraph> Block quote - <paragraph class="three"> + <paragraph classes="three"> Paragraph """], ["""\ @@ -71,7 +71,7 @@ Paragraph """, """\ <document source="test data"> - <section class="four" id="section-title" name="section title"> + <section classes="four" ids="section-title" names="section title"> <title> Section Title <paragraph> @@ -104,7 +104,7 @@ multiple class values may be assigned to one element """, """\ <document source="test data"> - <paragraph class="one two"> + <paragraph classes="one two"> multiple class values may be assigned to one element """], ["""\ @@ -114,7 +114,7 @@ multiple class values may be assigned to one element """, """\ <document source="test data"> - <paragraph class="one two"> + <paragraph classes="one two"> multiple class values may be assigned to one element """], ["""\ @@ -125,7 +125,7 @@ multiple class values may be assigned to one element """, """\ <document source="test data"> - <enumerated_list class="fancy" enumtype="arabic" prefix="" start="2" suffix="."> + <enumerated_list classes="fancy" enumtype="arabic" prefix="" start="2" suffix="."> <list_item> <paragraph> List starts at 2. @@ -156,7 +156,7 @@ A paragraph. <system_message level="1" line="1" source="test data" type="INFO"> <paragraph> Enumerated list start value not ordinal-1: "2" (ordinal 2) - <paragraph class="fancy"> + <paragraph classes="fancy"> A paragraph. """], ]) diff --git a/test/test_transforms/test_contents.py b/test/test_transforms/test_contents.py index 4c9d515a8..95cc098a6 100755 --- a/test/test_transforms/test_contents.py +++ b/test/test_transforms/test_contents.py @@ -46,50 +46,50 @@ Paragraph 4. """, """\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <title> Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="title-1"> + <reference ids="id1" refid="title-1"> Title 1 <bullet_list> <list_item> <paragraph> - <reference id="id2" refid="title-2"> + <reference ids="id2" refid="title-2"> Title 2 <bullet_list> <list_item> <paragraph> - <reference id="id3" refid="title-3"> + <reference ids="id3" refid="title-3"> Title 3 <list_item> <paragraph> - <reference id="id4" refid="title-4"> + <reference ids="id4" refid="title-4"> Title 4 - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title> <reference name="Title" refname="title"> Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title refid="id3"> - <target id="title" name="title"> + <target ids="title" names="title"> Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title refid="id4"> Title 4 <paragraph> @@ -108,25 +108,25 @@ Paragraph 2. """, """\ <document source="test data"> - <topic class="contents" id="table-of-contents" name="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table of contents"> <title> Table of Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="title-1"> + <reference ids="id1" refid="title-1"> Title 1 <bullet_list> <list_item> <paragraph> - <reference id="id2" refid="title-2"> + <reference ids="id2" refid="title-2"> Title 2 - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title refid="id2"> Title 2 <paragraph> @@ -147,29 +147,29 @@ Paragraph 2. """, """\ <document source="test data"> - <topic class="contents" id="there-s-an-image-in-title-2" name="there's an image in title 2"> + <topic classes="contents" ids="there-s-an-image-in-title-2" names="there's an image in title 2"> <title> There's an image in Title 2 <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="title-1"> + <reference ids="id1" refid="title-1"> Title 1 <list_item> <paragraph> - <reference id="id2" refid="title-2"> + <reference ids="id2" refid="title-2"> Title 2 - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title refid="id2"> <image alt="Title 2" uri="title2.png"> <paragraph> Paragraph 2. - <substitution_definition name="Title 2"> + <substitution_definition names="Title 2"> <image alt="Title 2" uri="title2.png"> """], # emacs cruft: " ["""\ @@ -194,39 +194,39 @@ Paragraph 4. """, """\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <title> Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="title-1"> + <reference ids="id1" refid="title-1"> Title 1 <bullet_list> <list_item> <paragraph> - <reference id="id2" refid="title-2"> + <reference ids="id2" refid="title-2"> Title 2 <list_item> <paragraph> - <reference id="id3" refid="title-4"> + <reference ids="id3" refid="title-4"> Title 4 - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title refid="id1"> Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title refid="id2"> Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title> Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title refid="id3"> Title 4 <paragraph> @@ -255,37 +255,37 @@ Paragraph 4. """, """\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title> Title 1 - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="title-2"> + <reference ids="id1" refid="title-2"> Title 2 <bullet_list> <list_item> <paragraph> - <reference id="id2" refid="title-3"> + <reference ids="id2" refid="title-3"> Title 3 <list_item> <paragraph> - <reference id="id3" refid="title-4"> + <reference ids="id3" refid="title-4"> Title 4 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title refid="id1"> Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title refid="id2"> Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title refid="id3"> Title 4 <paragraph> @@ -303,15 +303,15 @@ Paragraph. """, """\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="section"> + <reference ids="id1" refid="section"> Section <paragraph> Test duplicate name "Contents". - <section id="section" name="section"> + <section ids="section" names="section"> <title refid="id1"> Section <paragraph> @@ -327,15 +327,15 @@ Paragraph. """, """\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <title> Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="section"> + <reference ids="id1" refid="section"> Section - <section id="section" name="section"> + <section ids="section" names="section"> <title refid="contents"> Section <paragraph> @@ -351,15 +351,15 @@ Paragraph. """, """\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <title> Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="section"> + <reference ids="id1" refid="section"> Section - <section id="section" name="section"> + <section ids="section" names="section"> <title> Section <paragraph> diff --git a/test/test_transforms/test_docinfo.py b/test/test_transforms/test_docinfo.py index dcab14a3b..d14d2c48f 100755 --- a/test/test_transforms/test_docinfo.py +++ b/test/test_transforms/test_docinfo.py @@ -52,7 +52,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <field_body> <paragraph> integer - <topic class="abstract"> + <topic classes="abstract"> <title> Abstract <paragraph> @@ -105,7 +105,7 @@ totest['bibliographic_field_lists'] = ((DocInfo,), [ <field_body> <paragraph> integer - <topic class="abstract"> + <topic classes="abstract"> <title> Abstract <paragraph> diff --git a/test/test_transforms/test_doctitle.py b/test/test_transforms/test_doctitle.py index 1e6bc1ee0..c196c38ec 100755 --- a/test/test_transforms/test_doctitle.py +++ b/test/test_transforms/test_doctitle.py @@ -33,7 +33,7 @@ Title Paragraph. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <comment xml:space="preserve"> @@ -47,7 +47,7 @@ Title Paragraph (no blank line). """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <paragraph> @@ -65,7 +65,7 @@ Paragraph. <document source="test data"> <paragraph> Paragraph. - <section id="title" name="title"> + <section ids="title" names="title"> <title> Title <paragraph> @@ -81,10 +81,10 @@ Subtitle Test title & subtitle. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title - <subtitle id="subtitle" name="subtitle"> + <subtitle ids="subtitle" names="subtitle"> Subtitle <paragraph> Test title & subtitle. @@ -96,7 +96,7 @@ Title Test short underline. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title <system_message level="2" line="2" source="test data" type="WARNING"> @@ -118,7 +118,7 @@ The system_message should move after the document title (it was before the beginning of the section). """, """\ -<document id="long-title" name="long title" source="test data"> +<document ids="long-title" names="long title" source="test data"> <title> Long Title <system_message level="2" line="1" source="test data" type="WARNING"> @@ -149,19 +149,19 @@ Title 3 Paragraph 3. """, """\ -<document id="title-1" name="title 1" source="test data"> +<document ids="title-1" names="title 1" source="test data"> <title> Title 1 <comment xml:space="preserve"> Test multiple second-level titles. <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title> Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title> Title 3 <paragraph> @@ -178,12 +178,12 @@ This title should be the document title despite the substitution_definition. """, """\ -<document id="title" name="title" source="test data"> +<document ids="title" names="title" source="test data"> <title> Title - <substitution_definition name="foo"> + <substitution_definition names="foo"> bar - <target id="invisible-target" name="invisible target"> + <target ids="invisible-target" names="invisible target"> <paragraph> This title should be the document title despite the substitution_definition. diff --git a/test/test_transforms/test_final_checks.py b/test/test_transforms/test_final_checks.py index efc6df75a..4d8a4ef88 100755 --- a/test/test_transforms/test_final_checks.py +++ b/test/test_transforms/test_final_checks.py @@ -31,10 +31,10 @@ Unknown reference_. <document source="test data"> <paragraph> Unknown \n\ - <problematic id="id2" refid="id1"> + <problematic ids="id2" refid="id1"> reference_ . - <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR"> + <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Unknown target name: "reference". """], @@ -49,15 +49,15 @@ Duplicate manual footnote labels, with reference ([1]_): <document source="test data"> <paragraph> Duplicate manual footnote labels, with reference ( - <problematic id="id5" refid="id4"> + <problematic ids="id5" refid="id4"> [1]_ ): - <footnote dupname="1" id="id2"> + <footnote dupnames="1" ids="id2"> <label> 1 <paragraph> Footnote. - <footnote dupname="1" id="id3"> + <footnote dupnames="1" ids="id3"> <label> 1 <system_message backrefs="id3" level="2" line="5" source="test data" type="WARNING"> @@ -65,7 +65,7 @@ Duplicate manual footnote labels, with reference ([1]_): Duplicate explicit target name: "1". <paragraph> Footnote. - <system_message backrefs="id5" id="id4" level="3" line="1" source="test data" type="ERROR"> + <system_message backrefs="id5" ids="id4" level="3" line="1" source="test data" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "1". """], @@ -93,16 +93,16 @@ Some text. """, """\ <document source="test data"> - <section id="section-1" name="section 1"> + <section ids="section-1" names="section 1"> <title> Section 1 - <section id="subsection-1" name="subsection 1"> + <section ids="subsection-1" names="subsection 1"> <title> Subsection 1 <paragraph> Some text. <transition> - <section id="section-2" name="section 2"> + <section ids="section-2" names="section 2"> <title> Section 2 <paragraph> @@ -123,7 +123,7 @@ Paragraph. <paragraph> A paragraph. <transition> - <section id="section-1" name="section 1"> + <section ids="section-1" names="section 1"> <title> Section 1 <paragraph> @@ -197,7 +197,7 @@ Section 2 <document source="test data"> <paragraph> Sections with transitions at beginning and end. - <section id="section-1" name="section 1"> + <section ids="section-1" names="section 1"> <title> Section 1 <system_message level="3" line="6" source="test data" type="ERROR"> @@ -207,7 +207,7 @@ Section 2 <paragraph> The next transition is legal: <transition> - <section id="section-2" name="section 2"> + <section ids="section-2" names="section 2"> <title> Section 2 <system_message level="3" line="15" source="test data" type="ERROR"> @@ -290,7 +290,7 @@ Some text. """, """\ <document source="test data"> - <section id="section-1" name="section 1"> + <section ids="section-1" names="section 1"> <title> Section 1 <system_message level="3" line="4" source="test data" type="ERROR"> @@ -305,7 +305,7 @@ Some text. <paragraph> At least one body element must separate transitions; adjacent transitions are not allowed. <transition> - <section id="section-2" name="section 2"> + <section ids="section-2" names="section 2"> <title> Section 2 <paragraph> diff --git a/test/test_transforms/test_footnotes.py b/test/test_transforms/test_footnotes.py index 033f8fed0..f0a1a2ed0 100755 --- a/test/test_transforms/test_footnotes.py +++ b/test/test_transforms/test_footnotes.py @@ -32,9 +32,9 @@ totest['footnotes'] = ((Footnotes,), [ """\ <document source="test data"> <paragraph> - <footnote_reference auto="1" id="id1" refid="autolabel"> + <footnote_reference auto="1" ids="id1" refid="autolabel"> 1 - <footnote auto="1" backrefs="id1" id="autolabel" name="autolabel"> + <footnote auto="1" backrefs="id1" ids="autolabel" names="autolabel"> <label> 1 <paragraph> @@ -49,9 +49,9 @@ autonumber: [#]_ <document source="test data"> <paragraph> autonumber: \n\ - <footnote_reference auto="1" id="id1" refid="id2"> + <footnote_reference auto="1" ids="id1" refid="id2"> 1 - <footnote auto="1" backrefs="id1" id="id2" name="1"> + <footnote auto="1" backrefs="id1" ids="id2" names="1"> <label> 1 <paragraph> @@ -70,29 +70,29 @@ autonumber: [#]_ """\ <document source="test data"> <paragraph> - <footnote_reference auto="1" id="id1" refid="id3"> + <footnote_reference auto="1" ids="id1" refid="id3"> 1 is the first auto-numbered footnote reference. - <footnote_reference auto="1" id="id2" refid="id4"> + <footnote_reference auto="1" ids="id2" refid="id4"> 2 is the second auto-numbered footnote reference. - <footnote auto="1" backrefs="id1" id="id3" name="1"> + <footnote auto="1" backrefs="id1" ids="id3" names="1"> <label> 1 <paragraph> Auto-numbered footnote 1. - <footnote auto="1" backrefs="id2" id="id4" name="2"> + <footnote auto="1" backrefs="id2" ids="id4" names="2"> <label> 2 <paragraph> Auto-numbered footnote 2. - <footnote auto="1" backrefs="id6" id="id5" name="3"> + <footnote auto="1" backrefs="id6" ids="id5" names="3"> <label> 3 <paragraph> Auto-numbered footnote 3. <paragraph> - <footnote_reference auto="1" id="id6" refid="id5"> + <footnote_reference auto="1" ids="id6" refid="id5"> 3 is the third auto-numbered footnote reference. """], @@ -113,32 +113,32 @@ generated by the footnotes: first_, second_, third_. """\ <document source="test data"> <paragraph> - <footnote_reference auto="1" id="id1" refid="third"> + <footnote_reference auto="1" ids="id1" refid="third"> 3 is a reference to the third auto-numbered footnote. - <footnote auto="1" backrefs="id3" id="first" name="first"> + <footnote auto="1" backrefs="id3" ids="first" names="first"> <label> 1 <paragraph> First auto-numbered footnote. - <footnote auto="1" backrefs="id2" id="second" name="second"> + <footnote auto="1" backrefs="id2" ids="second" names="second"> <label> 2 <paragraph> Second auto-numbered footnote. - <footnote auto="1" backrefs="id1 id4" id="third" name="third"> + <footnote auto="1" backrefs="id1 id4" ids="third" names="third"> <label> 3 <paragraph> Third auto-numbered footnote. <paragraph> - <footnote_reference auto="1" id="id2" refid="second"> + <footnote_reference auto="1" ids="id2" refid="second"> 2 is a reference to the second auto-numbered footnote. - <footnote_reference auto="1" id="id3" refid="first"> + <footnote_reference auto="1" ids="id3" refid="first"> 1 is a reference to the first auto-numbered footnote. - <footnote_reference auto="1" id="id4" refid="third"> + <footnote_reference auto="1" ids="id4" refid="third"> 3 is another reference to the third auto-numbered footnote. <paragraph> @@ -173,49 +173,49 @@ Mixed anonymous and labelled auto-numbered footnotes: <paragraph> Mixed anonymous and labelled auto-numbered footnotes: <paragraph> - <footnote_reference auto="1" id="id1" refid="four"> + <footnote_reference auto="1" ids="id1" refid="four"> 4 should be 4, \n\ - <footnote_reference auto="1" id="id2" refid="id7"> + <footnote_reference auto="1" ids="id2" refid="id7"> 1 should be 1, - <footnote_reference auto="1" id="id3" refid="id8"> + <footnote_reference auto="1" ids="id3" refid="id8"> 3 should be 3, \n\ - <problematic id="id11" refid="id10"> + <problematic ids="id11" refid="id10"> [#]_ is one too many, - <footnote_reference auto="1" id="id5" refid="two"> + <footnote_reference auto="1" ids="id5" refid="two"> 2 should be 2, and \n\ - <footnote_reference auto="1" id="id6" refname="six"> + <footnote_reference auto="1" ids="id6" refname="six"> doesn't exist. - <footnote auto="1" backrefs="id2" id="id7" name="1"> + <footnote auto="1" backrefs="id2" ids="id7" names="1"> <label> 1 <paragraph> Auto-numbered footnote 1. - <footnote auto="1" backrefs="id5" id="two" name="two"> + <footnote auto="1" backrefs="id5" ids="two" names="two"> <label> 2 <paragraph> Auto-numbered footnote 2. - <footnote auto="1" backrefs="id3" id="id8" name="3"> + <footnote auto="1" backrefs="id3" ids="id8" names="3"> <label> 3 <paragraph> Auto-numbered footnote 3. - <footnote auto="1" backrefs="id1" id="four" name="four"> + <footnote auto="1" backrefs="id1" ids="four" names="four"> <label> 4 <paragraph> Auto-numbered footnote 4. - <footnote auto="1" dupname="five" id="five"> + <footnote auto="1" dupnames="five" ids="five"> <label> 5 <paragraph> Auto-numbered footnote 5. - <footnote auto="1" dupname="five" id="id9"> + <footnote auto="1" dupnames="five" ids="id9"> <label> 6 <system_message backrefs="id9" level="2" line="12" source="test data" type="WARNING"> @@ -223,7 +223,7 @@ Mixed anonymous and labelled auto-numbered footnotes: Duplicate explicit target name: "five". <paragraph> Auto-numbered footnote 5 again (duplicate). - <system_message backrefs="id11" id="id10" level="3" line="3" source="test data" type="ERROR"> + <system_message backrefs="id11" ids="id10" level="3" line="3" source="test data" type="ERROR"> <paragraph> Too many autonumbered footnote references: only 2 corresponding footnotes available. """], @@ -238,17 +238,17 @@ Mixed auto-numbered and manual footnotes: <document source="test data"> <paragraph> Mixed auto-numbered and manual footnotes: - <footnote id="id1" name="1"> + <footnote ids="id1" names="1"> <label> 1 <paragraph> manually numbered - <footnote auto="1" id="id2" name="2"> + <footnote auto="1" ids="id2" names="2"> <label> 2 <paragraph> auto-numbered - <footnote auto="1" id="label" name="label"> + <footnote auto="1" ids="label" names="label"> <label> 3 <paragraph> @@ -268,20 +268,20 @@ An unlabeled autonumbered footnote referece: [#]_. <document source="test data"> <paragraph> A labeled autonumbered footnote referece: \n\ - <footnote_reference auto="1" id="id1" refid="footnote"> + <footnote_reference auto="1" ids="id1" refid="footnote"> 2 . <paragraph> An unlabeled autonumbered footnote referece: \n\ - <footnote_reference auto="1" id="id2" refid="id3"> + <footnote_reference auto="1" ids="id2" refid="id3"> 1 . - <footnote auto="1" backrefs="id2" id="id3" name="1"> + <footnote auto="1" backrefs="id2" ids="id3" names="1"> <label> 1 <paragraph> Unlabeled autonumbered footnote. - <footnote auto="1" backrefs="id1" id="footnote" name="footnote"> + <footnote auto="1" backrefs="id1" ids="footnote" names="footnote"> <label> 2 <paragraph> @@ -312,59 +312,59 @@ and labelled auto-numbered footnotes: Mixed manually-numbered, anonymous auto-numbered, and labelled auto-numbered footnotes: <paragraph> - <footnote_reference auto="1" id="id1" refid="four"> + <footnote_reference auto="1" ids="id1" refid="four"> 4 should be 4, \n\ - <footnote_reference auto="1" id="id2" refid="id10"> + <footnote_reference auto="1" ids="id2" refid="id10"> 2 should be 2, - <footnote_reference id="id3" refid="id9"> + <footnote_reference ids="id3" refid="id9"> 1 is 1, \n\ - <footnote_reference id="id4" refid="id11"> + <footnote_reference ids="id4" refid="id11"> 3 is 3, - <footnote_reference auto="1" id="id5" refid="id12"> + <footnote_reference auto="1" ids="id5" refid="id12"> 6 should be 6, \n\ - <problematic id="id15" refid="id14"> + <problematic ids="id15" refid="id14"> [#]_ is one too many, - <footnote_reference auto="1" id="id7" refname="five"> + <footnote_reference auto="1" ids="id7" refname="five"> should be 5, and \n\ - <footnote_reference auto="1" id="id8" refname="eight"> + <footnote_reference auto="1" ids="id8" refname="eight"> doesn't exist. - <footnote backrefs="id3" id="id9" name="1"> + <footnote backrefs="id3" ids="id9" names="1"> <label> 1 <paragraph> Manually-numbered footnote 1. - <footnote auto="1" backrefs="id2" id="id10" name="2"> + <footnote auto="1" backrefs="id2" ids="id10" names="2"> <label> 2 <paragraph> Auto-numbered footnote 2. - <footnote auto="1" backrefs="id1" id="four" name="four"> + <footnote auto="1" backrefs="id1" ids="four" names="four"> <label> 4 <paragraph> Auto-numbered footnote 4. - <footnote backrefs="id4" id="id11" name="3"> + <footnote backrefs="id4" ids="id11" names="3"> <label> 3 <paragraph> Manually-numbered footnote 3 - <footnote auto="1" dupname="five" id="five"> + <footnote auto="1" dupnames="five" ids="five"> <label> 5 <paragraph> Auto-numbered footnote 5. - <footnote auto="1" backrefs="id5" id="id12" name="6"> + <footnote auto="1" backrefs="id5" ids="id12" names="6"> <label> 6 <paragraph> Auto-numbered footnote 6. - <footnote auto="1" dupname="five" id="id13"> + <footnote auto="1" dupnames="five" ids="id13"> <label> 7 <system_message backrefs="id13" level="2" line="15" source="test data" type="WARNING"> @@ -372,7 +372,7 @@ and labelled auto-numbered footnotes: Duplicate explicit target name: "five". <paragraph> Auto-numbered footnote 5 again (duplicate). - <system_message backrefs="id15" id="id14" level="3" line="4" source="test data" type="ERROR"> + <system_message backrefs="id15" ids="id14" level="3" line="4" source="test data" type="ERROR"> <paragraph> Too many autonumbered footnote references: only 2 corresponding footnotes available. """], @@ -385,10 +385,10 @@ Referencing a footnote by symbol [*]_. <document source="test data"> <paragraph> Referencing a footnote by symbol \n\ - <footnote_reference auto="*" id="id1" refid="id2"> + <footnote_reference auto="*" ids="id1" refid="id2"> * . - <footnote auto="*" backrefs="id1" id="id2"> + <footnote auto="*" backrefs="id1" ids="id2"> <label> * <paragraph> @@ -415,98 +415,98 @@ u"""\ <document source="test data"> <paragraph> A sequence of symbol footnote references: - <footnote_reference auto="*" id="id1" refid="id13"> + <footnote_reference auto="*" ids="id1" refid="id13"> * \n\ - <footnote_reference auto="*" id="id2" refid="id14"> + <footnote_reference auto="*" ids="id2" refid="id14"> \u2020 \n\ - <footnote_reference auto="*" id="id3" refid="id15"> + <footnote_reference auto="*" ids="id3" refid="id15"> \u2021 \n\ - <footnote_reference auto="*" id="id4" refid="id16"> + <footnote_reference auto="*" ids="id4" refid="id16"> \u00A7 \n\ - <footnote_reference auto="*" id="id5" refid="id17"> + <footnote_reference auto="*" ids="id5" refid="id17"> \u00B6 \n\ - <footnote_reference auto="*" id="id6" refid="id18"> + <footnote_reference auto="*" ids="id6" refid="id18"> # \n\ - <footnote_reference auto="*" id="id7" refid="id19"> + <footnote_reference auto="*" ids="id7" refid="id19"> \u2660 \n\ - <footnote_reference auto="*" id="id8" refid="id20"> + <footnote_reference auto="*" ids="id8" refid="id20"> \u2665 \n\ - <footnote_reference auto="*" id="id9" refid="id21"> + <footnote_reference auto="*" ids="id9" refid="id21"> \u2666 \n\ - <footnote_reference auto="*" id="id10" refid="id22"> + <footnote_reference auto="*" ids="id10" refid="id22"> \u2663 \n\ - <footnote_reference auto="*" id="id11" refid="id23"> + <footnote_reference auto="*" ids="id11" refid="id23"> ** \n\ - <footnote_reference auto="*" id="id12" refid="id24"> + <footnote_reference auto="*" ids="id12" refid="id24"> \u2020\u2020 . - <footnote auto="*" backrefs="id1" id="id13"> + <footnote auto="*" backrefs="id1" ids="id13"> <label> * <paragraph> Auto-symbol footnote 1. - <footnote auto="*" backrefs="id2" id="id14"> + <footnote auto="*" backrefs="id2" ids="id14"> <label> \u2020 <paragraph> Auto-symbol footnote 2. - <footnote auto="*" backrefs="id3" id="id15"> + <footnote auto="*" backrefs="id3" ids="id15"> <label> \u2021 <paragraph> Auto-symbol footnote 3. - <footnote auto="*" backrefs="id4" id="id16"> + <footnote auto="*" backrefs="id4" ids="id16"> <label> \u00A7 <paragraph> Auto-symbol footnote 4. - <footnote auto="*" backrefs="id5" id="id17"> + <footnote auto="*" backrefs="id5" ids="id17"> <label> \u00B6 <paragraph> Auto-symbol footnote 5. - <footnote auto="*" backrefs="id6" id="id18"> + <footnote auto="*" backrefs="id6" ids="id18"> <label> # <paragraph> Auto-symbol footnote 6. - <footnote auto="*" backrefs="id7" id="id19"> + <footnote auto="*" backrefs="id7" ids="id19"> <label> \u2660 <paragraph> Auto-symbol footnote 7. - <footnote auto="*" backrefs="id8" id="id20"> + <footnote auto="*" backrefs="id8" ids="id20"> <label> \u2665 <paragraph> Auto-symbol footnote 8. - <footnote auto="*" backrefs="id9" id="id21"> + <footnote auto="*" backrefs="id9" ids="id21"> <label> \u2666 <paragraph> Auto-symbol footnote 9. - <footnote auto="*" backrefs="id10" id="id22"> + <footnote auto="*" backrefs="id10" ids="id22"> <label> \u2663 <paragraph> Auto-symbol footnote 10. - <footnote auto="*" backrefs="id11" id="id23"> + <footnote auto="*" backrefs="id11" ids="id23"> <label> ** <paragraph> Auto-symbol footnote 11. - <footnote auto="*" backrefs="id12" id="id24"> + <footnote auto="*" backrefs="id12" ids="id24"> <label> \u2020\u2020 <paragraph> @@ -523,12 +523,12 @@ Duplicate manual footnote labels: <document source="test data"> <paragraph> Duplicate manual footnote labels: - <footnote dupname="1" id="id1"> + <footnote dupnames="1" ids="id1"> <label> 1 <paragraph> Footnote. - <footnote dupname="1" id="id2"> + <footnote dupnames="1" ids="id2"> <label> 1 <system_message backrefs="id2" level="2" line="5" source="test data" type="WARNING"> diff --git a/test/test_transforms/test_hyperlinks.py b/test/test_transforms/test_hyperlinks.py index 40bf5a9e0..537ee1502 100755 --- a/test/test_transforms/test_hyperlinks.py +++ b/test/test_transforms/test_hyperlinks.py @@ -11,7 +11,7 @@ Tests for docutils.transforms.references.Hyperlinks. """ from __init__ import DocutilsTestSupport -from docutils.transforms.references import SectionTargets, ChainedTargets, \ +from docutils.transforms.references import PropagateTargets, \ AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, \ InternalTargets @@ -30,8 +30,8 @@ totest = {} # Exhaustive listing of hyperlink variations: every combination of # target/reference, direct/indirect, internal/external, and named/anonymous, # plus embedded URIs. -totest['exhaustive_hyperlinks'] = ((SectionTargets, ChainedTargets, - AnonymousHyperlinks, IndirectHyperlinks, +totest['exhaustive_hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, + IndirectHyperlinks, ExternalTargets, InternalTargets, FinalChecks), [ ["""\ @@ -45,7 +45,7 @@ direct_ external <reference name="direct" refuri="http://direct"> direct external - <target id="direct" name="direct" refuri="http://direct"> + <target ids="direct" names="direct" refuri="http://direct"> """], ["""\ indirect_ external @@ -59,8 +59,8 @@ indirect_ external <reference name="indirect" refuri="http://indirect"> indirect external - <target id="indirect" name="indirect" refuri="http://indirect"> - <target id="xtarget" name="xtarget" refuri="http://indirect"> + <target ids="indirect" names="indirect" refuri="http://indirect"> + <target ids="xtarget" names="xtarget" refuri="http://indirect"> """], ["""\ .. _direct: @@ -69,8 +69,8 @@ direct_ internal """, """\ <document source="test data"> - <target id="direct" name="direct"> - <paragraph> + <target refid="direct"> + <paragraph ids="direct" names="direct"> <reference name="direct" refid="direct"> direct internal @@ -85,13 +85,13 @@ indirect_ internal """, """\ <document source="test data"> - <target id="ztarget" name="ztarget"> - <paragraph> + <target refid="ztarget"> + <paragraph ids="ztarget" names="ztarget"> <reference name="indirect" refid="ztarget"> indirect internal - <target id="indirect2" name="indirect2" refid="ztarget"> - <target id="indirect" name="indirect" refid="ztarget"> + <target ids="indirect2" names="indirect2" refid="ztarget"> + <target ids="indirect" names="indirect" refid="ztarget"> """], ["""\ Implicit @@ -103,14 +103,14 @@ indirect_ internal """, """\ <document source="test data"> - <section id="implicit" name="implicit"> + <section ids="implicit" names="implicit"> <title> Implicit <paragraph> <reference name="indirect" refid="implicit"> indirect internal - <target id="indirect" name="indirect" refid="implicit"> + <target ids="indirect" names="indirect" refid="implicit"> """], ["""\ Implicit @@ -123,15 +123,15 @@ Implicit """, """\ <document source="test data"> - <section id="implicit" name="implicit"> + <section ids="implicit" names="implicit"> <title> Implicit <paragraph> <reference name="multiply-indirect" refid="implicit"> multiply-indirect internal - <target id="multiply-indirect" name="multiply-indirect" refid="implicit"> - <target id="indirect" name="indirect" refid="implicit"> + <target ids="multiply-indirect" names="multiply-indirect" refid="implicit"> + <target ids="indirect" names="indirect" refid="implicit"> """], ["""\ circular_ indirect reference @@ -142,13 +142,13 @@ circular_ indirect reference """\ <document source="test data"> <paragraph> - <problematic id="id2" refid="id1"> + <problematic ids="id3" refid="id1"> circular_ indirect reference - <target id="circular" name="circular" refid="circular"> - <problematic id="id3" refid="id1"> + <target ids="circular" names="circular" refid="circular"> + <problematic ids="id2" refid="id1"> .. _indirect: circular_ - <system_message backrefs="id2 id3" id="id1" level="3" line="3" source="test data" type="ERROR"> + <system_message backrefs="id2 id3" ids="id1" level="3" line="3" source="test data" type="ERROR"> <paragraph> Indirect hyperlink target "circular" (id="circular") refers to target "indirect", forming a circular reference. """], @@ -169,30 +169,30 @@ Direct internal reference: Implicit_ """, """\ <document source="test data"> - <section dupname="implicit" id="implicit"> + <section dupnames="implicit" ids="implicit"> <title> Implicit <paragraph> Duplicate implicit targets. - <section dupname="implicit" id="id1"> + <section dupnames="implicit" ids="id1"> <title> Implicit <system_message backrefs="id1" level="1" line="7" source="test data" type="INFO"> <paragraph> Duplicate implicit target name: "implicit". <paragraph> - <problematic id="id3" refid="id2"> + <problematic ids="id3" refid="id2"> indirect_ internal - <target id="indirect" name="indirect" refname="implicit"> + <target ids="indirect" names="indirect" refname="implicit"> <paragraph> Direct internal reference: - <problematic id="id5" refid="id4"> + <problematic ids="id5" refid="id4"> Implicit_ - <system_message backrefs="id3" id="id2" level="3" line="11" source="test data" type="ERROR"> + <system_message backrefs="id3" ids="id2" level="3" line="11" source="test data" type="ERROR"> <paragraph> Indirect hyperlink target "indirect" (id="indirect") refers to target "implicit", which is a duplicate, and cannot be used as a unique reference. - <system_message backrefs="id5" id="id4" level="3" line="13" source="test data" type="ERROR"> + <system_message backrefs="id5" ids="id4" level="3" line="13" source="test data" type="ERROR"> <paragraph> Duplicate target name, cannot be used as a unique reference: "implicit". """], @@ -206,7 +206,7 @@ __ http://direct <paragraph> <reference anonymous="1" name="direct external" refuri="http://direct"> direct external - <target anonymous="1" id="id1" refuri="http://direct"> + <target anonymous="1" ids="id1" refuri="http://direct"> """], ["""\ `indirect external`__ @@ -219,8 +219,8 @@ __ xtarget_ <paragraph> <reference anonymous="1" name="indirect external" refuri="http://indirect"> indirect external - <target anonymous="1" id="id1" refuri="http://indirect"> - <target id="xtarget" name="xtarget" refuri="http://indirect"> + <target anonymous="1" ids="id1" refuri="http://indirect"> + <target ids="xtarget" names="xtarget" refuri="http://indirect"> """], ["""\ __ @@ -229,8 +229,8 @@ __ """, """\ <document source="test data"> - <target anonymous="1" id="id1"> - <paragraph> + <target anonymous="1" refid="id1"> + <paragraph ids="id1"> <reference anonymous="1" name="direct internal" refid="id1"> direct internal """], @@ -243,11 +243,11 @@ __ ztarget_ """, """\ <document source="test data"> - <target id="ztarget" name="ztarget"> - <paragraph> + <target refid="ztarget"> + <paragraph ids="ztarget" names="ztarget"> <reference anonymous="1" name="indirect internal" refid="ztarget"> indirect internal - <target anonymous="1" id="id1" refid="ztarget"> + <target anonymous="1" ids="id1" refid="ztarget"> """], ["""\ .. _ztarget: @@ -264,20 +264,20 @@ __ ztarget_ """, """\ <document source="test data"> - <target dupname="ztarget" id="ztarget"> - <paragraph> + <target dupnames="ztarget" refid="ztarget"> + <paragraph ids="ztarget"> First <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "ztarget". - <target dupname="ztarget" id="id1"> - <paragraph> + <target dupnames="ztarget" refid="id1"> + <paragraph ids="id1"> Second <paragraph> - <problematic id="id4" refid="id3"> + <problematic ids="id4" refid="id3"> `indirect internal`__ - <target anonymous="1" id="id2" refname="ztarget"> - <system_message backrefs="id4" id="id3" level="3" line="11" source="test data" type="ERROR"> + <target anonymous="1" ids="id2" refname="ztarget"> + <system_message backrefs="id4" ids="id3" level="3" line="11" source="test data" type="ERROR"> <paragraph> Indirect hyperlink target (id="id2") refers to target "ztarget", which is a duplicate, and cannot be used as a unique reference. """], @@ -292,7 +292,7 @@ Another reference to the same `embedded URI`_. An \n\ <reference name="embedded uri" refuri="http://direct"> embedded uri - <target id="embedded-uri" name="embedded uri" refuri="http://direct"> + <target ids="embedded-uri" names="embedded uri" refuri="http://direct"> . <paragraph> Another reference to the same \n\ @@ -311,28 +311,60 @@ An `anonymous embedded uri <http://direct>`__. anonymous embedded uri . """], +["""\ +.. _target: + +.. [1] Footnote; target_ +""", +"""\ +<document source="test data"> + <target ids="target" names="target"> + <footnote ids="id1" names="1"> + <label> + 1 + <paragraph> + Footnote; \n\ + <reference name="target" refid="target"> + target +"""], +["""\ +.. _target: + +.. [cit] Citation; target_ +""", +"""\ +<document source="test data"> + <target ids="target" names="target"> + <citation ids="cit" names="cit"> + <label> + cit + <paragraph> + Citation; \n\ + <reference name="target" refid="target"> + target +"""], ]) -totest['hyperlinks'] = ((SectionTargets, ChainedTargets, AnonymousHyperlinks, +totest['hyperlinks'] = ((PropagateTargets, AnonymousHyperlinks, IndirectHyperlinks, ExternalTargets, - InternalTargets,), [ + InternalTargets, FinalChecks), [ ["""\ .. _internal hyperlink: This paragraph referenced. -By this `internal hyperlink`_ referemce. +By this `internal hyperlink`_ reference. """, """\ <document source="test data"> - <target id="internal-hyperlink" name="internal hyperlink"> - <paragraph> + <target refid="internal-hyperlink"> + <paragraph ids="internal-hyperlink" names="internal hyperlink"> This paragraph referenced. <paragraph> By this \n\ <reference name="internal hyperlink" refid="internal-hyperlink"> internal hyperlink - referemce. + reference. """], ["""\ .. _chained: @@ -340,22 +372,22 @@ By this `internal hyperlink`_ referemce. This paragraph referenced. -By this `internal hyperlink`_ referemce +By this `internal hyperlink`_ reference as well as by this chained_ reference. The results of the transform are not visible at the XML level. """, """\ <document source="test data"> - <target id="chained" name="chained"> - <target id="internal-hyperlink" name="internal hyperlink"> - <paragraph> + <target refid="chained"> + <target refid="internal-hyperlink"> + <paragraph ids="internal-hyperlink chained" names="internal hyperlink chained"> This paragraph referenced. <paragraph> By this \n\ <reference name="internal hyperlink" refid="internal-hyperlink"> internal hyperlink - referemce + reference as well as by this \n\ <reference name="chained" refid="chained"> chained @@ -364,13 +396,82 @@ The results of the transform are not visible at the XML level. The results of the transform are not visible at the XML level. """], ["""\ +.. _a: +.. _b: + +x +""", +"""\ +<document source="test data"> + <target refid="a"> + <target refid="b"> + <paragraph ids="b a" names="b a"> + x + <system_message level="1" line="1" source="test data" type="INFO"> + <paragraph> + Hyperlink target "a" is not referenced. + <system_message level="1" line="2" source="test data" type="INFO"> + <paragraph> + Hyperlink target "b" is not referenced. +"""], +["""\ +.. _a: +.. _b: + +a_ +""", +"""\ +<document source="test data"> + <target refid="a"> + <target refid="b"> + <paragraph ids="b a" names="b a"> + <reference name="a" refid="a"> + a + <system_message level="1" line="2" source="test data" type="INFO"> + <paragraph> + Hyperlink target "b" is not referenced. +"""], +["""\ +.. _a: +.. _b: + +b_ +""", +"""\ +<document source="test data"> + <target refid="a"> + <target refid="b"> + <paragraph ids="b a" names="b a"> + <reference name="b" refid="b"> + b + <system_message level="1" line="1" source="test data" type="INFO"> + <paragraph> + Hyperlink target "a" is not referenced. +"""], +["""\ +.. _a: +.. _b: + +a_\ b_ +""", +"""\ +<document source="test data"> + <target refid="a"> + <target refid="b"> + <paragraph ids="b a" names="b a"> + <reference name="a" refid="a"> + a + <reference name="b" refid="b"> + b +"""], +["""\ .. _external hyperlink: http://uri `External hyperlink`_ reference. """, """\ <document source="test data"> - <target id="external-hyperlink" name="external hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> <paragraph> <reference name="External hyperlink" refuri="http://uri"> External hyperlink @@ -382,11 +483,11 @@ The results of the transform are not visible at the XML level. """, """\ <document source="test data"> - <target id="external-hyperlink" name="external hyperlink" refuri="http://uri"> - <target id="indirect-target" name="indirect target" refuri="http://uri"> + <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> + <target ids="indirect-target" names="indirect target" refuri="http://uri"> <system_message level="1" line="2" source="test data" type="INFO"> <paragraph> - Indirect hyperlink target "indirect target" is not referenced. + Hyperlink target "indirect target" is not referenced. """], ["""\ .. _chained: @@ -397,8 +498,8 @@ and a chained_ reference too. """, """\ <document source="test data"> - <target id="chained" name="chained" refuri="http://uri"> - <target id="external-hyperlink" name="external hyperlink" refuri="http://uri"> + <target refid="chained"> + <target ids="external-hyperlink chained" names="external hyperlink chained" refuri="http://uri"> <paragraph> <reference name="External hyperlink" refuri="http://uri"> External hyperlink @@ -416,8 +517,8 @@ and a chained_ reference too. """, """\ <document source="test data"> - <target id="external-hyperlink" name="external hyperlink" refuri="http://uri"> - <target id="indirect-hyperlink" name="indirect hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> + <target ids="indirect-hyperlink" names="indirect hyperlink" refuri="http://uri"> <paragraph> <reference name="Indirect hyperlink" refuri="http://uri"> Indirect hyperlink @@ -432,9 +533,9 @@ Chained_ `indirect hyperlink`_ reference. """, """\ <document source="test data"> - <target id="external-hyperlink" name="external hyperlink" refuri="http://uri"> - <target id="chained" name="chained" refuri="http://uri"> - <target id="indirect-hyperlink" name="indirect hyperlink" refuri="http://uri"> + <target ids="external-hyperlink" names="external hyperlink" refuri="http://uri"> + <target refuri="http://uri"> + <target ids="indirect-hyperlink chained" names="indirect hyperlink chained" refuri="http://uri"> <paragraph> <reference name="Chained" refuri="http://uri"> Chained @@ -459,13 +560,13 @@ __ """, """\ <document source="test data"> - <target anonymous="1" id="id1" refuri="http://full"> - <target anonymous="1" id="id2" refuri="http://simplified"> - <target anonymous="1" id="id3" refuri="http://simplified"> - <target id="external" name="external" refuri="http://indirect.external"> - <target anonymous="1" id="id4" refuri="http://indirect.external"> - <target anonymous="1" id="id5"> - <paragraph> + <target anonymous="1" ids="id1" refuri="http://full"> + <target anonymous="1" refid="id2"> + <target anonymous="1" ids="id3 id2" refuri="http://simplified"> + <target ids="external" names="external" refuri="http://indirect.external"> + <target anonymous="1" ids="id4" refuri="http://indirect.external"> + <target anonymous="1" refid="id5"> + <paragraph ids="id5"> <reference anonymous="1" name="Full syntax anonymous external hyperlink reference" refuri="http://full"> Full syntax anonymous external hyperlink reference , @@ -493,14 +594,34 @@ Duplicate external target_'s (different URIs): <document source="test data"> <paragraph> Duplicate external \n\ - <reference name="target" refname="target"> - target + <problematic ids="id3" refid="id2"> + target_ 's (different URIs): - <target dupname="target" id="target" refuri="first"> + <target dupnames="target" ids="target" refuri="first"> <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> <paragraph> Duplicate explicit target name: "target". - <target dupname="target" id="id1" refuri="second"> + <target dupnames="target" ids="id1" refuri="second"> + <system_message backrefs="id3" ids="id2" level="3" line="1" source="test data" type="ERROR"> + <paragraph> + Duplicate target name, cannot be used as a unique reference: "target". +"""], +["""\ +Duplicate external targets (different URIs) without reference: + +.. _target: first + +.. _target: second +""", +"""\ +<document source="test data"> + <paragraph> + Duplicate external targets (different URIs) without reference: + <target dupnames="target" ids="target" refuri="first"> + <system_message backrefs="id1" level="2" line="5" source="test data" type="WARNING"> + <paragraph> + Duplicate explicit target name: "target". + <target dupnames="target" ids="id1" refuri="second"> """], ["""\ Several__ anonymous__ hyperlinks__, but not enough targets. @@ -510,17 +631,17 @@ __ http://example.org """\ <document source="test data"> <paragraph> - <problematic id="id3" refid="id2"> + <problematic ids="id3" refid="id2"> Several__ \n\ - <problematic id="id4" refid="id2"> + <problematic ids="id4" refid="id2"> anonymous__ \n\ - <problematic id="id5" refid="id2"> + <problematic ids="id5" refid="id2"> hyperlinks__ , but not enough targets. - <target anonymous="1" id="id1" refuri="http://example.org"> - <system_message backrefs="id3 id4 id5" id="id2" level="3" source="test data" type="ERROR"> + <target anonymous="1" ids="id1" refuri="http://example.org"> + <system_message backrefs="id3 id4 id5" ids="id2" level="3" source="test data" type="ERROR"> <paragraph> Anonymous hyperlink mismatch: 3 references but 1 targets. See "backrefs" attribute for IDs. @@ -541,10 +662,10 @@ __ http://example.org """, """\ <document source="test data"> - <target id="external" name="external" refuri="http://uri"> - <target id="indirect" name="indirect" refuri="http://uri"> - <target id="internal" name="internal"> - <reference name="external_" refuri="http://uri"> + <target ids="external" names="external" refuri="http://uri"> + <target ids="indirect" names="indirect" refuri="http://uri"> + <target refid="internal"> + <reference ids="internal" name="external_" names="internal" refuri="http://uri"> <image uri="picture.png"> <reference name="indirect_" refuri="http://uri"> <image uri="picture.png"> @@ -562,16 +683,16 @@ Testing an `indirect reference to the table of contents`_. """, """\ <document source="test data"> - <topic class="contents" id="table-of-contents" name="table of contents"> + <topic classes="contents" ids="table-of-contents" names="table of contents"> <title> Table of Contents <bullet_list> <list_item> <paragraph> - <reference id="id1" refid="section"> + <reference ids="id1" refid="section"> Section - <target id="indirect-reference-to-the-table-of-contents" name="indirect reference to the table of contents" refid="table-of-contents"> - <section id="section" name="section"> + <target ids="indirect-reference-to-the-table-of-contents" names="indirect reference to the table of contents" refid="table-of-contents"> + <section ids="section" names="section"> <title refid="id1"> Section <paragraph> @@ -581,8 +702,6 @@ Testing an `indirect reference to the table of contents`_. . """], ["""\ -Target should end up inside the section title, not before the section: - .. _explicit target: Title @@ -592,11 +711,9 @@ Let's reference it (`explicit target`_) to avoid an irrelevant error. """, """\ <document source="test data"> - <paragraph> - Target should end up inside the section title, not before the section: - <section id="title" name="title"> + <target refid="explicit-target"> + <section ids="title explicit-target" names="title explicit target"> <title> - <target id="explicit-target" name="explicit target"> Title <paragraph> Let's reference it ( @@ -622,9 +739,9 @@ Title <reference name="target2" refuri="URI"> target2 , not the Title. - <target id="target1" name="target1" refuri="URI"> - <target id="target2" name="target2" refuri="URI"> - <section id="title" name="title"> + <target refid="target1"> + <target ids="target2 target1" names="target2 target1" refuri="URI"> + <section ids="title" names="title"> <title> Title """], diff --git a/test/test_transforms/test_messages.py b/test/test_transforms/test_messages.py index 75325bc96..6ff8c9987 100755 --- a/test/test_transforms/test_messages.py +++ b/test/test_transforms/test_messages.py @@ -37,7 +37,7 @@ document by the test framework.) <document source="test data"> <paragraph> This \n\ - <problematic id="id2" refid="id1"> + <problematic ids="id2" refid="id1"> |unknown substitution| will generate a system message, thanks to the \n\ @@ -51,10 +51,10 @@ document by the test framework.) <paragraph> (A second copy of the system message is tacked on to the end of the document by the test framework.) - <section class="system-messages"> + <section classes="system-messages"> <title> Docutils System Messages - <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR"> + <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Undefined substitution referenced: "unknown substitution". """], diff --git a/test/test_transforms/test_peps.py b/test/test_transforms/test_peps.py index 5710f9ec7..5ab57be50 100755 --- a/test/test_transforms/test_peps.py +++ b/test/test_transforms/test_peps.py @@ -47,14 +47,14 @@ A "References" section should be generated. <reference name="reference" refname="reference"> reference \n\ - <footnote_reference auto="1" id="id3" refname="target_note: id2"> + <footnote_reference auto="1" ids="id3" refname="TARGET_NOTE: id2"> . A "References" section should be generated. - <target id="reference" name="reference" refuri="http://www.example.org"> - <section id="id1"> + <target ids="reference" names="reference" refuri="http://www.example.org"> + <section ids="id1"> <title> References - <footnote auto="1" id="id2" name="target_note: id2"> + <footnote auto="1" ids="id2" names="TARGET_NOTE: id2"> <paragraph> <reference refuri="http://www.example.org"> http://www.example.org diff --git a/test/test_transforms/test_sectnum.py b/test/test_transforms/test_sectnum.py index 2ecb6b802..514ae419f 100755 --- a/test/test_transforms/test_sectnum.py +++ b/test/test_transforms/test_sectnum.py @@ -46,30 +46,30 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 Title 4 <paragraph> @@ -84,9 +84,9 @@ Paragraph 1. """, u"""\ <document source="test data"> - <section id="bold-title" name="bold title"> + <section ids="bold-title" names="bold title"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 <strong> Bold Title @@ -114,28 +114,28 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title> Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 Title 4 <paragraph> @@ -163,56 +163,56 @@ Paragraph 4. """, u"""\ <document source="test data"> - <topic class="contents" id="contents" name="contents"> + <topic classes="contents" ids="contents" names="contents"> <title> Contents - <bullet_list class="auto-toc"> + <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference id="id1" refid="title-1"> - <generated class="sectnum"> + <reference ids="id1" refid="title-1"> + <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 - <bullet_list class="auto-toc"> + <bullet_list classes="auto-toc"> <list_item> <paragraph> - <reference id="id2" refid="title-2"> - <generated class="sectnum"> + <reference ids="id2" refid="title-2"> + <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <bullet_list> <list_item> <paragraph> - <reference id="id3" refid="title-3"> + <reference ids="id3" refid="title-3"> Title 3 <list_item> <paragraph> - <reference id="id4" refid="title-4"> - <generated class="sectnum"> + <reference ids="id4" refid="title-4"> + <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 Title 4 - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1" refid="id1"> - <generated class="sectnum"> + <generated classes="sectnum"> 1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1" refid="id2"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title refid="id3"> Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1" refid="id4"> - <generated class="sectnum"> + <generated classes="sectnum"> 1.2\u00a0\u00a0\u00a0 Title 4 <paragraph> @@ -240,30 +240,30 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> Arbitrary-1\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> Arbitrary-1.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> Arbitrary-1.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> Arbitrary-1.2\u00a0\u00a0\u00a0 Title 4 <paragraph> @@ -291,30 +291,30 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 3\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 3.1\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 3.1.1\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> 3.2\u00a0\u00a0\u00a0 Title 4 <paragraph> @@ -344,30 +344,30 @@ Paragraph 4. """, u"""\ <document source="test data"> - <section id="title-1" name="title 1"> + <section ids="title-1" names="title 1"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> (5.9.3)\u00a0\u00a0\u00a0 Title 1 <paragraph> Paragraph 1. - <section id="title-2" name="title 2"> + <section ids="title-2" names="title 2"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> (5.9.3.1)\u00a0\u00a0\u00a0 Title 2 <paragraph> Paragraph 2. - <section id="title-3" name="title 3"> + <section ids="title-3" names="title 3"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> (5.9.3.1.1)\u00a0\u00a0\u00a0 Title 3 <paragraph> Paragraph 3. - <section id="title-4" name="title 4"> + <section ids="title-4" names="title 4"> <title auto="1"> - <generated class="sectnum"> + <generated classes="sectnum"> (5.9.3.2)\u00a0\u00a0\u00a0 Title 4 <paragraph> diff --git a/test/test_transforms/test_substitutions.py b/test/test_transforms/test_substitutions.py index 687a20ca5..33a33b754 100755 --- a/test/test_transforms/test_substitutions.py +++ b/test/test_transforms/test_substitutions.py @@ -35,7 +35,7 @@ The |biohazard| symbol is deservedly scary-looking. The \n\ <image alt="biohazard" uri="biohazard.png"> symbol is deservedly scary-looking. - <substitution_definition name="biohazard"> + <substitution_definition names="biohazard"> <image alt="biohazard" uri="biohazard.png"> """], ["""\ @@ -45,10 +45,10 @@ Here's an |unknown| substitution. <document source="test data"> <paragraph> Here's an \n\ - <problematic id="id2" refid="id1"> + <problematic ids="id2" refid="id1"> |unknown| substitution. - <system_message backrefs="id2" id="id1" level="3" line="1" source="test data" type="ERROR"> + <system_message backrefs="id2" ids="id1" level="3" line="1" source="test data" type="ERROR"> <paragraph> Undefined substitution referenced: "unknown". """], @@ -64,9 +64,9 @@ u"""\ <document source="test data"> <paragraph> Substitutions support case differences: - <substitution_definition name="eacute"> + <substitution_definition names="eacute"> \u00E9 - <substitution_definition name="Eacute"> + <substitution_definition names="Eacute"> \u00C9 <paragraph> \u00C9 @@ -105,16 +105,16 @@ u"""\ ), and a captial omega ( \u03a9 ). - <substitution_definition name="mdash"> + <substitution_definition names="mdash"> \u2014 - <substitution_definition name="copy"> + <substitution_definition names="copy"> \u00a9 - <substitution_definition name="nbsp"> + <substitution_definition names="nbsp"> \u00a0 - <substitution_definition name="bne"> + <substitution_definition names="bne"> = \u20e5 - <substitution_definition name="Omega"> + <substitution_definition names="Omega"> \u03a9 """], [""" @@ -137,9 +137,9 @@ u"""\ BogusMegaCorp \u2122 . - <substitution_definition name="copy"> + <substitution_definition names="copy"> \u00a9 - <substitution_definition name="BogusMegaCorp (TM)"> + <substitution_definition names="BogusMegaCorp (TM)"> BogusMegaCorp \u2122 """], @@ -161,9 +161,9 @@ u"""\ Some substitutions \u2122 only need trimming on one side. - <substitution_definition ltrim="1" name="---" rtrim="1"> + <substitution_definition ltrim="1" names="---" rtrim="1"> \u2014 - <substitution_definition ltrim="1" name="TM"> + <substitution_definition ltrim="1" names="TM"> \u2122 """], ]) |
