FIX the test! styleshhet path with drive letter
[docutils.git] / test / test_writers / test_html4css1_template.py
blob8fef347e4c406c1267c4a671f92eed819941c205
1 #!/usr/bin/env python
3 # $Id$
4 # Author: David Goodger <goodger@python.org>
5 # Copyright: This module has been placed in the public domain.
7 """
8 Tests for the HTML writer.
9 """
11 import os
12 import platform
14 from __init__ import DocutilsTestSupport
17 def suite():
18 settings = {'template': os.path.join(DocutilsTestSupport.testroot,
19 'data', 'full-template.txt'),
20 'stylesheet_path': '/test.css',
21 'embed_stylesheet': 0,}
22 s = DocutilsTestSupport.PublishTestSuite('html', suite_settings=settings)
23 s.generateTests(totest)
24 return s
26 if platform.system() == "Windows":
27 drive_prefix = "C:"
28 else:
29 drive_prefix = ""
31 totest = {}
33 totest['template'] = [
34 ["""\
35 ================
36 Document Title
37 ================
38 ----------
39 Subtitle
40 ----------
42 :Author: Me
44 .. footer:: footer text
46 Section
47 =======
49 Some text.
50 """,
51 r'''head_prefix = """\
52 <?xml version="1.0" encoding="utf-8" ?>
53 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
54 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
55 <head>"""
58 head = """\
59 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
60 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
61 <title>Document Title</title>
62 <meta name="author" content="Me" />"""
65 stylesheet = """\
66 <link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />"""
69 body_prefix = """\
70 </head>
71 <body>
72 <div class="document" id="document-title">"""
75 body_pre_docinfo = """\
76 <h1 class="title">Document Title</h1>
77 <h2 class="subtitle" id="subtitle">Subtitle</h2>"""
80 docinfo = """\
81 <table class="docinfo" frame="void" rules="none">
82 <col class="docinfo-name" />
83 <col class="docinfo-content" />
84 <tbody valign="top">
85 <tr><th class="docinfo-name">Author:</th>
86 <td>Me</td></tr>
87 </tbody>
88 </table>"""
91 body = """\
92 <div class="section" id="section">
93 <h1>Section</h1>
94 <p>Some text.</p>
95 </div>"""
98 body_suffix = """\
99 </div>
100 <div class="footer">
101 <hr class="footer" />
102 footer text
103 </div>
104 </body>
105 </html>"""
108 head_prefix = """\
109 <?xml version="1.0" encoding="utf-8" ?>
110 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
111 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
112 <head>"""
115 head = """\
116 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
117 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
118 <title>Document Title</title>
119 <meta name="author" content="Me" />"""
122 stylesheet = """\
123 <link rel="stylesheet" href="%(drive)s/test.css" type="text/css" />"""
126 body_prefix = """\
127 </head>
128 <body>
129 <div class="document" id="document-title">"""
132 body_pre_docinfo = """\
133 <h1 class="title">Document Title</h1>
134 <h2 class="subtitle" id="subtitle">Subtitle</h2>"""
137 docinfo = """\
138 <table class="docinfo" frame="void" rules="none">
139 <col class="docinfo-name" />
140 <col class="docinfo-content" />
141 <tbody valign="top">
142 <tr><th class="docinfo-name">Author:</th>
143 <td>Me</td></tr>
144 </tbody>
145 </table>"""
148 body = """\
149 <div class="section" id="section">
150 <h1>Section</h1>
151 <p>Some text.</p>
152 </div>"""
155 body_suffix = """\
156 </div>
157 <div class="footer">
158 <hr class="footer" />
159 footer text
160 </div>
161 </body>
162 </html>"""
165 title = """\
166 Document Title"""
169 subtitle = """\
170 Subtitle"""
173 header = """\
177 footer = """\
178 <div class="footer">
179 <hr class="footer" />
180 footer text
181 </div>"""
184 meta = """\
185 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
186 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
187 <meta name="author" content="Me" />"""
190 fragment = """\
191 <div class="section" id="section">
192 <h1>Section</h1>
193 <p>Some text.</p>
194 </div>"""
197 html_prolog = """\
198 <?xml version="1.0" encoding="%%s" ?>
199 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">"""
202 html_head = """\
203 <meta http-equiv="Content-Type" content="text/html; charset=%%s" />
204 <meta name="generator" content="Docutils %(version)s: http://docutils.sourceforge.net/" />
205 <title>Document Title</title>
206 <meta name="author" content="Me" />"""
209 html_title = """\
210 <h1 class="title">Document Title</h1>"""
213 html_subtitle = """\
214 <h2 class="subtitle" id="subtitle">Subtitle</h2>"""
217 html_body = """\
218 <div class="document" id="document-title">
219 <h1 class="title">Document Title</h1>
220 <h2 class="subtitle" id="subtitle">Subtitle</h2>
221 <table class="docinfo" frame="void" rules="none">
222 <col class="docinfo-name" />
223 <col class="docinfo-content" />
224 <tbody valign="top">
225 <tr><th class="docinfo-name">Author:</th>
226 <td>Me</td></tr>
227 </tbody>
228 </table>
229 <div class="section" id="section">
230 <h1>Section</h1>
231 <p>Some text.</p>
232 </div>
233 </div>
234 <div class="footer">
235 <hr class="footer" />
236 footer text
237 </div>"""
238 ''' % {'version': DocutilsTestSupport.docutils.__version__,
239 'drive': drive_prefix,
243 if __name__ == '__main__':
244 import unittest
245 unittest.main(defaultTest='suite')