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

« back to all changes in this revision

Viewing changes to test/test_writers/test_html4css1_template.py

  • Committer: Bazaar Package Importer
  • Author(s): Simon McVittie
  • Date: 2008-07-24 10:39:53 UTC
  • mfrom: (1.1.4 upstream) (3.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080724103953-8gh4uezg17g9ysgy
Tags: 0.5-2
* Upload docutils 0.5 to unstable
* Update rst.el to upstream Subversion r5596, which apparently fixes
  all its performance problems (17_speed_up_rst_el.dpatch, closes: #474941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# $Id: test_html4css1_template.py 4883 2007-01-16 01:51:28Z wiemann $
 
4
# Author: David Goodger <goodger@python.org>
 
5
# Copyright: This module has been placed in the public domain.
 
6
 
 
7
"""
 
8
Tests for the HTML writer.
 
9
"""
 
10
 
 
11
import os
 
12
from __init__ import DocutilsTestSupport
 
13
 
 
14
 
 
15
def suite():
 
16
    settings = {'template': os.path.join(DocutilsTestSupport.testroot,
 
17
                                         'data', 'full-template.txt'),
 
18
                'embed_stylesheet': 0,}
 
19
    s = DocutilsTestSupport.PublishTestSuite('html', suite_settings=settings)
 
20
    s.generateTests(totest)
 
21
    return s
 
22
 
 
23
totest = {}
 
24
 
 
25
totest['template'] = [
 
26
["""\
 
27
================
 
28
 Document Title
 
29
================
 
30
----------
 
31
 Subtitle
 
32
----------
 
33
 
 
34
:Author: Me
 
35
 
 
36
.. footer:: footer text
 
37
 
 
38
Section
 
39
=======
 
40
 
 
41
Some text.
 
42
""",
 
43
r'''head_prefix = """\
 
44
<?xml version="1.0" encoding="utf-8" ?>
 
45
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
46
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
47
<head>"""
 
48
 
 
49
 
 
50
head = """\
 
51
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
52
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
 
53
<title>Document Title</title>
 
54
<meta name="author" content="Me" />"""
 
55
 
 
56
 
 
57
stylesheet = """\
 
58
<link rel="stylesheet" href="../docutils/writers/html4css1/html4css1.css" type="text/css" />"""
 
59
 
 
60
 
 
61
body_prefix = """\
 
62
</head>
 
63
<body>
 
64
<div class="document" id="document-title">"""
 
65
 
 
66
 
 
67
body_pre_docinfo = """\
 
68
<h1 class="title">Document Title</h1>
 
69
<h2 class="subtitle" id="subtitle">Subtitle</h2>"""
 
70
 
 
71
 
 
72
docinfo = """\
 
73
<table class="docinfo" frame="void" rules="none">
 
74
<col class="docinfo-name" />
 
75
<col class="docinfo-content" />
 
76
<tbody valign="top">
 
77
<tr><th class="docinfo-name">Author:</th>
 
78
<td>Me</td></tr>
 
79
</tbody>
 
80
</table>"""
 
81
 
 
82
 
 
83
body = """\
 
84
<div class="section" id="section">
 
85
<h1>Section</h1>
 
86
<p>Some text.</p>
 
87
</div>"""
 
88
 
 
89
 
 
90
body_suffix = """\
 
91
</div>
 
92
<div class="footer">
 
93
<hr class="footer" />
 
94
footer text
 
95
</div>
 
96
</body>
 
97
</html>"""
 
98
 
 
99
 
 
100
head_prefix = """\
 
101
<?xml version="1.0" encoding="utf-8" ?>
 
102
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
103
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
104
<head>"""
 
105
 
 
106
 
 
107
head = """\
 
108
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
109
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
 
110
<title>Document Title</title>
 
111
<meta name="author" content="Me" />"""
 
112
 
 
113
 
 
114
stylesheet = """\
 
115
<link rel="stylesheet" href="../docutils/writers/html4css1/html4css1.css" type="text/css" />"""
 
116
 
 
117
 
 
118
body_prefix = """\
 
119
</head>
 
120
<body>
 
121
<div class="document" id="document-title">"""
 
122
 
 
123
 
 
124
body_pre_docinfo = """\
 
125
<h1 class="title">Document Title</h1>
 
126
<h2 class="subtitle" id="subtitle">Subtitle</h2>"""
 
127
 
 
128
 
 
129
docinfo = """\
 
130
<table class="docinfo" frame="void" rules="none">
 
131
<col class="docinfo-name" />
 
132
<col class="docinfo-content" />
 
133
<tbody valign="top">
 
134
<tr><th class="docinfo-name">Author:</th>
 
135
<td>Me</td></tr>
 
136
</tbody>
 
137
</table>"""
 
138
 
 
139
 
 
140
body = """\
 
141
<div class="section" id="section">
 
142
<h1>Section</h1>
 
143
<p>Some text.</p>
 
144
</div>"""
 
145
 
 
146
 
 
147
body_suffix = """\
 
148
</div>
 
149
<div class="footer">
 
150
<hr class="footer" />
 
151
footer text
 
152
</div>
 
153
</body>
 
154
</html>"""
 
155
 
 
156
 
 
157
title = """\
 
158
Document Title"""
 
159
 
 
160
 
 
161
subtitle = """\
 
162
Subtitle"""
 
163
 
 
164
 
 
165
header = """\
 
166
"""
 
167
 
 
168
 
 
169
footer = """\
 
170
<div class="footer">
 
171
<hr class="footer" />
 
172
footer text
 
173
</div>"""
 
174
 
 
175
 
 
176
meta = """\
 
177
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
178
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
 
179
<meta name="author" content="Me" />"""
 
180
 
 
181
 
 
182
fragment = """\
 
183
<div class="section" id="section">
 
184
<h1>Section</h1>
 
185
<p>Some text.</p>
 
186
</div>"""
 
187
 
 
188
 
 
189
html_prolog = """\
 
190
<?xml version="1.0" encoding="%s" ?>
 
191
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"""
 
192
 
 
193
 
 
194
html_head = """\
 
195
<meta http-equiv="Content-Type" content="text/html; charset=%s" />
 
196
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
 
197
<title>Document Title</title>
 
198
<meta name="author" content="Me" />"""
 
199
 
 
200
 
 
201
html_title = """\
 
202
<h1 class="title">Document Title</h1>"""
 
203
 
 
204
 
 
205
html_subtitle = """\
 
206
<h2 class="subtitle" id="subtitle">Subtitle</h2>"""
 
207
 
 
208
 
 
209
html_body = """\
 
210
<div class="document" id="document-title">
 
211
<h1 class="title">Document Title</h1>
 
212
<h2 class="subtitle" id="subtitle">Subtitle</h2>
 
213
<table class="docinfo" frame="void" rules="none">
 
214
<col class="docinfo-name" />
 
215
<col class="docinfo-content" />
 
216
<tbody valign="top">
 
217
<tr><th class="docinfo-name">Author:</th>
 
218
<td>Me</td></tr>
 
219
</tbody>
 
220
</table>
 
221
<div class="section" id="section">
 
222
<h1>Section</h1>
 
223
<p>Some text.</p>
 
224
</div>
 
225
</div>
 
226
<div class="footer">
 
227
<hr class="footer" />
 
228
footer text
 
229
</div>"""
 
230
''']
 
231
]
 
232
 
 
233
if __name__ == '__main__':
 
234
    import unittest
 
235
    unittest.main(defaultTest='suite')