root/template.py

Revision 339:a46365f70a13, 2.5 kB (checked in by Stefan Schwarzer <sschwarzer@sschwarzer.net>, 1 year ago)
Improved XHTML compatibilty. Remaining errors (misplaced <body> and
premature </html>) seem to come from bugs in W3C's parser.
Line 
1 # coding: UTF-8
2 # Copyright (C) 2007, Stefan Schwarzer
3 #
4 # Permission is hereby granted, free of charge, to any person
5 # obtaining a copy of this software and associated documentation files
6 # (the "Software"), to deal in the Software without restriction,
7 # including without limitation the rights to use, copy, modify, merge,
8 # publish, distribute, sublicense, and/or sell copies of the Software,
9 # and to permit persons to whom the Software is furnished to do so,
10 # subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be
13 # included in all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 # SOFTWARE.
23
24 """
25 HTML code for use in Websourcebrowser.
26 """
27
28
29 HEADER = u"""\
30 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
31    "http://www.w3.org/TR/xhtml/xhtml1-frameset.dtd">
32 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
33 <head>
34     <link rel="stylesheet" type="text/css"
35      href="/%(special_dir)s/websourcebrowser.css" /> %(refresh_html)s
36     <title>%(title)s - %(project_title)s</title>
37 </head>
38 <body>
39 <h1 class="%(h1_class)s">%(title)s</h1>
40 <div class="Main">
41 """
42
43 FOOTER = u"""
44 </div>
45 </body>
46 </html>
47 """
48
49 HELP = u"""\
50 Sorry, there's no help yet. ;-)
51 """
52
53 FRAMESET = u"""\
54 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
55    "http://www.w3.org/TR/xhtml/xhtml1-frameset.dtd">
56 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
57 <head>
58 <title>%(project_title)s</title>
59 </head>
60 <frameset cols="30%%,70%%">
61   <frame name="%(dir_target)s" src="%(dir_url)s" />
62   <frame name="%(source_target)s" src="/%(special_dir)s/source_placeholder" />
63   <noframes>
64     <body>
65       <h1>Websourcebrowser - source code at a glance</h1>
66       <p>Your browser doesn't seem to work with frames. You may go to
67          the <a href="/?frames=no">frameless version</a>,
68          which will open another browser window to show source code.</p>
69     </body>
70   </noframes>
71 </frameset>
72 </html>
73 """
74
75 SOURCE_PLACEHOLDER = u"""\
76 If you click on a link for a file, its contents will appear here.
77 """
Note: See TracBrowser for help on using the browser.