~ubuntu-branches/ubuntu/karmic/python-docutils/karmic

« back to all changes in this revision

Viewing changes to test/test_transforms/test_doctitle.py

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-07-10 11:45:05 UTC
  • mfrom: (2.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060710114505-otkhqcslevewxmz5
Tags: 0.4-3
Added build dependency on python-central (closes: #377580).

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
# Author: David Goodger
4
4
# Contact: goodger@users.sourceforge.net
5
 
# Revision: $Revision: 1.7 $
6
 
# Date: $Date: 2002/10/08 01:34:29 $
 
5
# Revision: $Revision: 3915 $
 
6
# Date: $Date: 2005-10-02 03:06:42 +0200 (Sun, 02 Oct 2005) $
7
7
# Copyright: This module has been placed in the public domain.
8
8
 
9
9
"""
11
11
"""
12
12
 
13
13
from __init__ import DocutilsTestSupport
14
 
from docutils.transforms.frontmatter import DocTitle
 
14
from docutils.transforms.frontmatter import DocTitle, SectionSubTitle
15
15
from docutils.parsers.rst import Parser
16
16
 
17
17
 
23
23
 
24
24
totest = {}
25
25
 
26
 
totest['section_headers'] = ((DocTitle,), [
 
26
totest['section_headers'] = ((DocTitle, SectionSubTitle), [
27
27
["""\
28
28
.. test title promotion
29
29
 
33
33
Paragraph.
34
34
""",
35
35
"""\
36
 
<document id="title" name="title" source="test data">
 
36
<document ids="title" names="title" source="test data" title="Title">
37
37
    <title>
38
38
        Title
39
39
    <comment xml:space="preserve">
47
47
Paragraph (no blank line).
48
48
""",
49
49
"""\
50
 
<document id="title" name="title" source="test data">
 
50
<document ids="title" names="title" source="test data" title="Title">
51
51
    <title>
52
52
        Title
53
53
    <paragraph>
65
65
<document source="test data">
66
66
    <paragraph>
67
67
        Paragraph.
68
 
    <section id="title" name="title">
 
68
    <section ids="title" names="title">
69
69
        <title>
70
70
            Title
71
71
        <paragraph>
78
78
Subtitle
79
79
--------
80
80
 
81
 
Test title & subtitle.
 
81
.. title:: Another Title
 
82
 
 
83
Test title, subtitle, and title metadata.
82
84
""",
83
85
"""\
84
 
<document id="title" name="title" source="test data">
 
86
<document ids="title" names="title" source="test data" title="Another Title">
85
87
    <title>
86
88
        Title
87
 
    <subtitle id="subtitle" name="subtitle">
 
89
    <subtitle ids="subtitle" names="subtitle">
88
90
        Subtitle
89
91
    <paragraph>
90
 
        Test title & subtitle.
 
92
        Test title, subtitle, and title metadata.
91
93
"""],
92
94
["""\
93
95
Title
96
98
Test short underline.
97
99
""",
98
100
"""\
99
 
<document id="title" name="title" source="test data">
 
101
<document ids="title" names="title" source="test data" title="Title">
100
102
    <title>
101
103
        Title
102
104
    <system_message level="2" line="2" source="test data" type="WARNING">
118
120
(it was before the beginning of the section).
119
121
""",
120
122
"""\
121
 
<document id="long-title" name="long title" source="test data">
 
123
<document ids="long-title" names="long\ title" source="test data" title="Long    Title">
122
124
    <title>
123
125
        Long    Title
124
126
    <system_message level="2" line="1" source="test data" type="WARNING">
149
151
Paragraph 3.
150
152
""",
151
153
"""\
152
 
<document id="title-1" name="title 1" source="test data">
 
154
<document ids="title-1" names="title\ 1" source="test data" title="Title 1">
153
155
    <title>
154
156
        Title 1
155
157
    <comment xml:space="preserve">
156
158
        Test multiple second-level titles.
157
159
    <paragraph>
158
160
        Paragraph 1.
159
 
    <section id="title-2" name="title 2">
 
161
    <section ids="title-2" names="title\ 2">
160
162
        <title>
161
163
            Title 2
162
164
        <paragraph>
163
165
            Paragraph 2.
164
 
    <section id="title-3" name="title 3">
 
166
    <section ids="title-3" names="title\ 3">
165
167
        <title>
166
168
            Title 3
167
169
        <paragraph>
168
170
            Paragraph 3.
169
171
"""],
 
172
["""\
 
173
.. |foo| replace:: bar
 
174
 
 
175
.. _invisible target:
 
176
 
 
177
Title
 
178
=====
 
179
This title should be the document title despite the
 
180
substitution_definition.
 
181
""",
 
182
"""\
 
183
<document ids="title" names="title" source="test data" title="Title">
 
184
    <title>
 
185
        Title
 
186
    <substitution_definition names="foo">
 
187
        bar
 
188
    <target ids="invisible-target" names="invisible\ target">
 
189
    <paragraph>
 
190
        This title should be the document title despite the
 
191
        substitution_definition.
 
192
"""],
 
193
["""\
 
194
(Because of this paragraph, the following is not a doc title.)
 
195
 
 
196
===============
 
197
 Section Title
 
198
===============
 
199
 
 
200
Subtitle
 
201
========
 
202
 
 
203
-----------------
 
204
 Another Section
 
205
-----------------
 
206
 
 
207
Another Subtitle
 
208
----------------
 
209
 
 
210
""",
 
211
"""\
 
212
<document source="test data">
 
213
    <paragraph>
 
214
        (Because of this paragraph, the following is not a doc title.)
 
215
    <section ids="section-title" names="section\ title">
 
216
        <title>
 
217
            Section Title
 
218
        <subtitle ids="subtitle" names="subtitle">
 
219
            Subtitle
 
220
        <section ids="another-section" names="another\ section">
 
221
            <title>
 
222
                Another Section
 
223
            <subtitle ids="another-subtitle" names="another\ subtitle">
 
224
                Another Subtitle
 
225
"""],
170
226
])
171
227
 
172
228