source: trunk/lib/css.cc @ 831

Last change on this file since 831 was 831, checked in by Peter Johansson, 12 years ago

fixes #240 - explain linetype coloring in blame output

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