source: trunk/lib/css.cc @ 284

Last change on this file since 284 was 284, checked in by Peter Johansson, 16 years ago

moved css generation to separate file

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.1 KB
Line 
1// $Id: css.cc 284 2007-05-06 17:54:09Z peter $
2
3/*
4  Copyright (C) 2006, 2007 Peter Johansson
5
6  This file is part of svndigest, http://lev.thep.lu.se/trac/svndigest
7
8  svndigest is free software; you can redistribute it and/or modify it
9  under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12
13  svndigest is distributed in the hope that it will be useful, but
14  WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
21  02111-1307, USA.
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, 2007 Peter Johansson\n\n"
39      << "This file is part of svndigest, " 
40      << "http://lev.thep.lu.se/trac/svndigest\n\n"
41
42      << "svndigest is free software; you can redistribute it and/or " 
43      << "modify it\n"
44      << "under the terms of the GNU General Public License as published by\n"
45      << "the Free Software Foundation; either version 2 of the License, or\n"
46      << "(at your option) any later version.\n\n"
47
48      << "svndigest is distributed in the hope that it will be useful, but\n"
49      << "WITHOUT ANY WARRANTY; without even the implied warranty of\n"
50      << "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n"
51      << "General Public License for more details.\n\n"
52
53      << "You should have received a copy of the GNU General Public License\n"
54      << "along with this program; if not, write to the Free Software\n"
55      << "Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA\n"
56      << "02111-1307, USA.\n\n"
57
58      << "This 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 " 
70      << "copyright\n"
71      << "   notice, this list of conditions and the following disclaimer in\n"
72      << "   the documentation and/or other materials provided with the\n"
73      << "   distribution.\n"
74      << "3. The name of the author may not be used to endorse or promote\n"
75      << "   products derived from this software without specific prior\n"
76      << "   written permission.\n\n"
77     
78      << "THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS\n"
79      << "OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n"
80      << "WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"
81      << "ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY\n"
82      << "DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n"
83      << "DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE\n"
84      << "GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n"
85      << "INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n"
86      << "WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n"
87      << "NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n"
88      << "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.-->\n";
89
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    s << "#menu {\n";
99    s << " background: #eee;\n";
100    s << " width: 100%;\n";
101    s << " margin: 0px;\n";
102    s << " padding: 0px;\n";
103    s << "}\n\n";
104    s << "#menu ul\n";
105    s << "{ \n";
106    s << "padding: 0px;\n";
107    s << "margin: 0px;list-style-type: none; text-align: center;"
108      << "border-bottom: 1px solid black;}\n";
109    s << "#menu ul li { display: inline; border-right: 1px solid black;}\n";
110    s << "#menu ul li a {text-decoration: none; padding-right: 1em;" 
111      << "padding-left: 1em; margin: 0px;}\n";
112    s << "#menu ul li a:hover{ color: #000; background: #ddd;}\n";
113    s << "#menu ul li.highlight a {color: #fff; background: #777; }";
114    s << "\n";
115    s << "#main {\n";
116    s << " margin: 10px; \n";
117    s << "}\n";
118    s << "\n";
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    s << "div.main {\n";
129    s << "margin-top: 50px;\n";         
130    s << "margin-left: 50px;\n";
131    s << " \n";
132    s << "}\n";
133    s << "table.main {\n"; 
134    s << " text-align: left;\n";
135    s << " padding: 0 1em .1em 0;\n";
136    s << "}\n";
137    s << "table.main th {\n";
138    s << " text-align: left;\n";
139    s << " padding: 0 1em 0.5em 0;\n";
140    s << " font-size: 150%;\n";
141    s << " font-wheight: bold;\n";
142    s << "}\n";
143    s << "table.main td {\n";
144    s << " padding: 0 1em .1em 0;\n";
145    s << "}\n";
146    s << "table.listings {\n";
147    s << " clear: both;\n";
148    s << " border-bottom: 1px solid #d7d7d7;\n";
149    s << " border-collapse: collapse;\n";
150    s << " border-spacing: 0;\n";
151    s << " margin-top: 1em;\n";
152    s << " width: 100%;\n";
153    s << "}\n";
154    s << "\n";
155    s << "table.listings th {\n";
156    s << " text-align: left;\n";
157    s << " padding: 0 1em .1em 0;\n";
158    s << " font-size: 12px\n";
159    s << "}\n";
160    s << "table.listings thead { background: #f7f7f0 }\n";
161    s << "table.listings thead th {\n";
162    s << " border: 1px solid #d7d7d7;\n";
163    s << " border-bottom-color: #999;\n";
164    s << " font-size: 11px;\n";
165    s << " font-wheight: bold;\n";
166    s << " padding: 2px .5em;\n";
167    s << " vertical-align: bottom;\n";
168    s << "}\n";
169    s << "\n";
170    s << "table.listings tbody td a:hover, table.listing tbody th a:hover {\n";
171    s << " background-color: transparent;\n";
172    s << "}\n";
173    s << "\n";
174    s << "table.listings tbody td, table.listing tbody th {\n";
175    s << " border: 1px dotted #ddd;\n";
176    s << " padding: .33em .5em;\n";
177    s << " vertical-align: top;\n";
178    s << "}\n";
179    s << "\n";
180    s << "table.listings tbody td a:hover, table.listing tbody th a:hover {\n";
181    s << " background-color: transparent;\n";
182    s << "}\n";
183    s << "table.listings tbody tr { border-top: 1px solid #ddd }\n";
184    s << "table.listings tbody tr.light { background-color: #fcfcfc }\n";
185    s << "table.listings tbody tr.dark { background-color: #f7f7f7 }\n";
186    s << "table.listings tbody tr:hover { background: #eed }\n";
187    s << "table.listings tbody td { text-align: left }\n";
188    s << "table.listings tbody td.directory a { font-weight: bold }\n";
189    s << "\n";
190    s << ".sep { color: #666}\n";
191    s << "\n";
192    s << "\n";
193    s.close();
194  }
195
196
197}} // end of namespace svndigest and namespace theplu
Note: See TracBrowser for help on using the repository browser.