source: trunk/lib/css.cc @ 401

Last change on this file since 401 was 401, checked in by Jari Häkkinen, 16 years ago

Addresses #62. Made the blame listing nicer.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 8.7 KB
Line 
1// $Id: css.cc 401 2007-06-28 21:46:24Z jari $
2
3/*
4  Copyright (C) 2006 Peter Johansson
5  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
6
7  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
8
9  svndigest is free software; you can redistribute it and/or modify it
10  under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13
14  svndigest is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with this program; if not, write to the Free Software
21  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22  02111-1307, USA.
23*/
24
25#include "css.h"
26#include <config.h>
27
28#include <fstream>
29#include <string>
30
31namespace theplu{
32namespace svndigest{
33
34  void print_css(const std::string& str)
35  {
36    std::ofstream s(str.c_str());
37    s << "<-- svndigest.css generated by " << PACKAGE_STRING << "\n"
38
39      << "Copyright (C) 2006 Peter Johansson\n"
40      << "Copyright (C) 2007 Jari Häkkinen, Peter Johansson\n\n"
41      << "This file is part of svndigest, " 
42      << "http://lev.thep.lu.se/trac/svndigest\n\n"
43
44      << "svndigest is free software; you can redistribute it and/or " 
45      << "modify it\n"
46      << "under the terms of the GNU General Public License as published by\n"
47      << "the Free Software Foundation; either version 2 of the License, or\n"
48      << "(at your option) any later version.\n\n"
49
50      << "svndigest is distributed in the hope that it will be useful, but\n"
51      << "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
52      << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
53      << "General Public License for more details.\n\n"
54
55      << "You should have received a copy of the GNU General Public License\n"
56      << "along with this program; if not, write to the Free Software\n"
57      << "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
58      << "02111-1307, USA.\n\n"
59
60      << "This file was initially inspired by the cascading style sheet\n"
61      << "within the Trac open source project (http://trac.edgewall.org/)\n"
62      << "Copyright (C) 2003-2006 Edgewall Software\n"
63      << "All rights reserved.\n\n"
64
65      << "Redistribution and use in source and binary forms, with or without\n"
66      << "modification, are permitted provided that the following conditions\n"
67      << "are met:\n\n"
68     
69      << "1. Redistributions of source code must retain the above copyright\n"
70      << "   notice, this list of conditions and the following disclaimer.\n"
71      << "2. Redistributions in binary form must reproduce the above copyright\n"
72      << "   notice, this list of conditions and the following disclaimer in\n"
73      << "   the documentation and/or other materials provided with the\n"
74      << "   distribution.\n"
75      << "3. The name of the author may not be used to endorse or promote\n"
76      << "   products derived from this software without specific prior\n"
77      << "   written permission.\n\n"
78     
79      << "THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS\n"
80      << "OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n"
81      << "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"
82      << "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n"
83      << "DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n"
84      << "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n"
85      << "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n"
86      << "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n"
87      << "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n"
88      << "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n"
89      << "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-->\n";
90
91    s << "body {\n";
92    s << " background: #fff; \n";
93    s << " color: #000; \n";
94    s << " margin: 0px; \n";
95    s << " padding: 0; \n";
96    s << "} \n";
97    s << "\n";
98
99    s << "#menu {\n";
100    s << " background: #eee;\n";
101    s << " width: 100%;\n";
102    s << " margin: 0px;\n";
103    s << " padding: 0px;\n";
104    s << "}\n\n";
105    s << "#menu ul\n";
106    s << "{ \n";
107    s << "padding: 0px;\n";
108    s << "margin: 0px;list-style-type: none; text-align: center;"
109      << "border-bottom: 1px solid black;}\n";
110    s << "#menu ul li { display: inline; border-right: 1px solid black;}\n";
111    s << "#menu ul li a {text-decoration: none; padding-right: 1em;" 
112      << "padding-left: 1em; margin: 0px;}\n";
113    s << "#menu ul li a:hover{ color: #000; background: #ddd;}\n";
114    s << "#menu ul li.highlight a {color: #fff; background: #777; }";
115    s << "\n";
116    s << "#main {\n";
117    s << " margin: 10px; \n";
118    s << "}\n";
119    s << "\n";
120
121    s << "body, th, td {\n";
122    s << " font: normal 13px verdana,arial,'Bitstream Vera Sans',"
123      << "helvetica,sans-serif;\n";
124    s << "}\n";
125    s << ":link, :visited {\n";
126    s << " text-decoration: none;\n";
127    s << " color: #b00;\n";
128    s << "}\n";
129    s << "\n";
130
131    s << "div.main {\n";
132    s << "margin-top: 50px;\n";         
133    s << "margin-left: 50px;\n";
134    s << " \n";
135    s << "}\n";
136
137    s << "table.main {\n"; 
138    s << " text-align: left;\n";
139    s << " padding: 0 1em .1em 0;\n";
140    s << "}\n";
141    s << "table.main th {\n";
142    s << " text-align: left;\n";
143    s << " padding: 0 1em 0.5em 0;\n";
144    s << " font-size: 150%;\n";
145    s << " font-wheight: bold;\n";
146    s << "}\n";
147    s << "table.main td {\n";
148    s << " padding: 0 1em .1em 0;\n";
149    s << "}\n\n";
150
151
152    s << "p.plot { text-align: center; }\n";
153    s << "p.plot img { border: 0; }\n";
154
155    s << "p.footer {\n";
156    s << "text-align: center;\n";
157    s << "font-size: 70%;\n";
158    s << "}\n\n";
159
160    s << "table.blame {\n";
161    s << " border: 1px solid #ddd;\n";
162    s << " border-spacing: 0;\n";
163    s << " border-top: 0;\n";
164    s << " empty-cells: show;\n";
165    s << " font-size: 12px;\n";
166    s << " line-height: 130%;\n";
167    s << " padding: 0;\n";
168    s << " margin: 0 auto;\n";
169    s << " table-layout: fixed;\n";
170    s << " width: 100%;\n";
171    s << "}\n";
172    s << "table.blame th {\n";
173    s << " border-right: 1px solid #d7d7d7;\n";
174    s << " border-bottom: 1px solid #998;\n";
175    s << " font-size: 11px;\n";
176    s << "}\n";
177    s << "table.blame th.author { width: 5em; text-align:right }\n";
178    s << "table.blame th.date { width: 8em; text-align:center }\n";
179    s << "table.blame th.number { width: 3em }\n";
180    s << "table.blame thead th {\n";
181    s << " background: #eee;\n";
182    s << " border-top: 1px solid #d7d7d7;\n";
183    s << " color: #999;\n";
184    s << " padding: 0 .25em;\n";
185    s << " text-align: center;\n";
186    s << " white-space: nowrap;\n";
187    s << "}\n";
188    s << "table.blame tbody td {\n";
189    s << " border-right: 1px solid #f0f0f0;\n";
190    s << " background: #fff;\n";
191    s << " font: normal 11px monospace;\n";
192    s << " overflow: hidden;\n";
193    s << " padding: 1px 2px;\n";
194    s << " vertical-align: top;\n";
195    s << "}\n";
196    s << "table.blame tbody td.author { text-align: right; }\n";
197    s << "table.blame tbody td.date { text-align: center; }\n";
198    s << "table.blame tbody td.number { text-align: right; }\n";
199    s << "table.blame tbody td:hover { background-color: transparent; }\n";
200    s << "table.blame tbody tr:hover { background: #eed; }\n";
201    s << "\n";
202
203    s << "table.listings {\n";
204    s << " clear: both;\n";
205    s << " border-bottom: 1px solid #d7d7d7;\n";
206    s << " border-collapse: collapse;\n";
207    s << " border-spacing: 0;\n";
208    s << " margin-top: 1em;\n";
209    s << " width: 100%;\n";
210    s << "}\n";
211    s << "\n";
212    s << "table.listings th {\n";
213    s << " text-align: left;\n";
214    s << " padding: 0 1em .1em 0;\n";
215    s << " font-size: 12px\n";
216    s << "}\n";
217    s << "table.listings thead { background: #f7f7f0 }\n";
218    s << "table.listings thead th {\n";
219    s << " border: 1px solid #d7d7d7;\n";
220    s << " border-bottom-color: #999;\n";
221    s << " font-size: 11px;\n";
222    s << " font-wheight: bold;\n";
223    s << " padding: 2px .5em;\n";
224    s << " vertical-align: bottom;\n";
225    s << "}\n";
226    s << "\n";
227    s << "table.listings tbody td, table.listing tbody th {\n";
228    s << " border: 1px dotted #ddd;\n";
229    s << " padding: .33em .5em;\n";
230    s << " vertical-align: top;\n";
231    s << "}\n";
232    s << "\n";
233    s << "table.listings tbody td a:hover, table.listing tbody th a:hover {\n";
234    s << " background-color: transparent;\n";
235    s << "}\n";
236    s << "table.listings tbody tr { border-top: 1px solid #ddd }\n";
237    s << "table.listings tbody tr.light { background-color: #fcfcfc }\n";
238    s << "table.listings tbody tr.dark { background-color: #f7f7f7 }\n";
239    s << "table.listings tbody tr:hover { background: #eed }\n";
240    s << "table.listings tbody td { text-align: left }\n";
241    s << "table.listings tbody td a { display: block; }\n";
242    s << "table.listings tbody td.directory a { font-weight: bold }\n";
243    s << "\n";
244
245    s << ".sep { color: #666}\n";
246    s.close();
247  }
248
249}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.