Diff of /tags/VIMCDOC_1_6_0/www/htdocs/vimcdoc-sf.py [000000] .. [r157] Maximize Restore

  Switch to unified view

a b/tags/VIMCDOC_1_6_0/www/htdocs/vimcdoc-sf.py
1
#!/usr/bin/python
2
# vimcdoc-sf.py
3
# An index.html generator for the vimcdoc project.
4
# Usage: 
5
#   'vimcodc-sf.py' to output to stdout
6
#   'vimcodc-sf.py -ci' to generate the index.html 
7
# Author: lang2 (lang2@users.sourceforge.net)
8
9
10
import re
11
vimcdoc_ver = "" 
12
data_dir_prefix = "../../"
13
news_file = data_dir_prefix + "NEWS"
14
author_file = data_dir_prefix + "AUTHORS"
15
version_file = data_dir_prefix + "VERSION"
16
index_file = "./index.html"
17
18
def GetVimcdocVersion():
19
    global vimcdoc_ver
20
    f = open (version_file)
21
    vimcdoc_ver = vimcdoc_ver + f.readline().rstrip()
22
    f.close()
23
24
def PrintNewsHeader():
25
    print '<table class="HEADER1" width="100%" border="0" cellspacing="0" cellpadding="1">'
26
    print '<tbody>'
27
    print '<tr>'
28
    print '<td>'
29
    print '<table width="100%" border="0" cellspacing="0" cellpadding="4">'
30
    print '<tbody>'
31
    print '<tr class="ROW1">'
32
    print '<td class="NEWS"> <em>News</em> </td>'
33
    print '</tr>'
34
    print '</tbody>'
35
    print '</table>'
36
    print '</td>'
37
    print '</tr>'
38
    print '</tbody>'
39
    print '</table>'
40
    print '<p class="LEFT">'
41
    print '<dl class="NEWS">'
42
43
def PrintNewsFooter():
44
    print '</dl>'
45
    print '<br><br>'
46
47
def PrintNews():
48
    PrintNewsHeader()
49
    f = open( news_file )
50
    line = f.readline()
51
    while ( line ):
52
        print '<dt class="NEWS">'
53
        print line
54
        print '</dt>'
55
        print '<dd class="NEWS">'
56
        line = f.readline()
57
        while ( line != "\n" ):
58
            print line
59
            line = f.readline()
60
        line = f.readline()
61
        print '<br><br>'
62
63
    f.close()
64
    PrintNewsFooter()
65
66
def PrintHeader():
67
    print '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'
68
    print '<html>'
69
    print '<head>'
70
    print '<meta content="text/html;charset=iso-8859-1" http-equiv="Content-Type">'
71
    print '<title>Vim Chinese Documentation</title>'
72
    print '<style type="text/css">'
73
    print 'A          {color:black; text-decoration:underline}'
74
    print 'H2         {color:black; align:center}'
75
    print 'BODY       {background-color:white}'
76
    print 'P          {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:center; font-weight:normal; font-size:0.9em}'
77
    print 'P.LEFT     {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:left;   font-weight:normal; font-size:0.9em}'
78
    print 'P.SMALL    {font-family: Verdana, Helvetica, sans-serif; color:#38506c; text-align:center; font-weight:normal; font-size:0.5em}'
79
    print 'UL.LEFT    {font-family: Verdana, Helvetica, sans-serif; color:#758cab; text-align:left;   font-weight:normal; font-size:0.9em}'
80
    print 'TD.NEWS    {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:left;   font-weight:bold; font-size:1.1em}'
81
    print 'TD.LEFT    {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:left;   font-weight:normal; font-size:0.9em}'
82
    print 'TD.HEADER  {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:center; font-weight:bold; font-size:0.9em} '
83
    print 'DD.NEWS    {font-family: Verdana, Helvetica, sans-serif; color:black; text-align:left; font-weight:normal; font-size:0.9em} '
84
    print 'DT.NEWS    {font-family: Verdana, Helvetica, sans-serif; color:#758cab; text-align:left; font-weight:normal; font-size:0.9em} '
85
    print 'TR.ROW1    {background-color:#E6E6fE}'
86
    print 'TR.HEADER1,TABLE.HEADER1 {background-color:#657a97}'
87
    print '</style>'
88
    print '</head>'
89
    print '<body>'
90
91
def PrintSidebar():
92
    print '<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">'
93
    print '<tbody>'
94
    print '<tr>'
95
    print '<td valign="top" align="left" width="15%">'
96
    print '<table class="HEADER1" border="0" cellpadding="1" cellspacing="0">'
97
    print '<tbody>'
98
    print '<tr>'
99
    print '<td>'
100
    print '<table class="HEADER1" cellpadding="4" cellspacing="0" border="0">'
101
    print '<tbody>'
102
    print '<tr class="ROW1">'
103
    print '<td class="left">&nbsp;</td>'
104
    print '</tr>'
105
    print '<tr class="ROW1">'
106
    print '<td class="HEADER">'
107
    print '<h2>Vimcdoc</h2>'
108
    print '<hr noshade="noshade" size="1">'
109
    print '<!-- NavBar -->'
110
    print '<p><a href="http://sourceforge.net/projects/vimcdoc/" onmouseover="status=\'SourceForge Page\'; return true" onmouseout="status=''; return true">Project Page</a></p>'
111
    print '<p><a href="images" onmouseover="status=\'Vimcdoc Screenshot\'; return true" onmouseout="status=\'\'; return true">Screenshot</a></p>'
112
    print '<p><a href="http://sourceforge.net/project/showfiles.php?group_id=56777" onmouseover="status=\'Download\'; return true" onmouseout="status=''; return true">Download</a></p>'
113
    print '<p><a href="http://vimcdoc.sf.net/doc/help.html" onmouseover="status=\'Read online\'; return true" onmouseout="status=''; return true">Read Online</a></p>'
114
    print '<p><a href="http://vimcdoc.sf.net/ChangeLog" onmouseover="status=\'Changelog\'; return true" onmouseout="status=''; return true">Changelog</a></p>'
115
    print '<p><a href="http://sourceforge.net/svn/?group_id=56777" onmouseover="status=\'Subversion\'; return true" onmouseout="status=''; return true">Subversion</a></p>'
116
    print '<p> <a href="http://sourceforge.net/export/rss2_projnews.php?group_id=56777" \
117
            onmouseover="status=\'Project News RSS Feed\'; return true" onmouseout="status=''; \
118
            return true">News RSS</a></p>'
119
    #print '<p> <a href="http://sourceforge.net/export/rss2_projnews.php?group_id=56777&rss_fulltext=1" \
120
            #onmouseover="status=\'Project File Release RSS Feed\'; return true" onmouseout="status=''; \
121
            #return true">File RSS</a></p>'
122
    print '<hr noshade="noshade" size="1">'
123
    print '<p><a href="http://vcd.gro.clinux.org"'
124
    print 'onmouseover="status=\'vcd\'; return true"'
125
    print 'onmouseout="status=\'\'; return true">gro mirror</a></p>'
126
    print '<p><a href="http://www.vim.org"'
127
    print 'onmouseover="status=\'Vim\'; return true"'
128
    print 'onmouseout="status=\'\'; return true">Vim home</a></p>'
129
    print '<p><a href="http://vimdoc.sf.net"'
130
    print 'onmouseover="status=\'VimDoc\'; return true"'
131
    print 'onmouseout="status=\'\'; return true">VimDoc</a></p>'
132
    print '<hr noshade="noshade" size="1">'
133
    print '<p><a href="mailto:yianwillis@users.sourceforge.net" onmouseover="status=\'Contact\'; return true" onmouseout="status=''; return true">Contact</a></p>'
134
    print '<!-- NavBar --> '
135
    print '</td>'
136
    print '</tr>'
137
    print '</tbody>'
138
    print '</table>'
139
    print '</td>'
140
    print '</tr>'
141
    print '</tbody>'
142
    print '</table>'
143
    print '</td>'
144
    print '<td align="center" valign="top">'
145
    print '<table border="0">'
146
    print '<tbody>'
147
    print '<tr>'
148
    print '<td class="LEFT" width="80%">'
149
150
def BeginMainBody():
151
    print '<!-- Body -->'
152
    print '<!-- ===================================================================== -->'
153
154
def PrintWhatIs():
155
    print '<table class="HEADER1" width="100%" border="0" cellspacing="0" cellpadding="1">'
156
    print '<tbody>'
157
    print '<tr>'
158
    print '<td>'
159
    print '<table width="100%" border="0" cellspacing="0" cellpadding="4">'
160
    print '<tbody>'
161
    print '<tr class="ROW1">'
162
    print '<td class="NEWS"> <em>What is</em> </td>'
163
    print '</tr>'
164
    print '</tbody>'
165
    print '</table>'
166
    print '</td>'
167
    print '</tr>'
168
    print '</tbody>'
169
    print '</table>'
170
    print '<p class="LEFT">'
171
    print 'Vimcdoc is an attempt to translate the wonderful Vim online'
172
    print 'documentation into Chinese, allowing more people to get to'
173
    print 'know and make use of this great tool. After installing vimcdoc,'
174
    print 'You will be able to do <code>:help</code> and read'
175
    print 'documentation in Chinese.'
176
    print '<br><br>'
177
    print '</p>'
178
179
def PrintDivider():
180
    print '<!-- ===================================================================== -->'
181
182
def PrintGetVimcdoc():
183
    print '<table class="HEADER1" width="100%" border="0" cellspacing="0" cellpadding="1">'
184
    print '<tbody>'
185
    print '<tr>'
186
    print '<td>'
187
    print '<table width="100%" border="0" cellspacing="0" cellpadding="4">'
188
    print '<tbody>'
189
    print '<tr class="ROW1">'
190
    print '<td class="NEWS"> <em>Get Vimcdoc</em> </td>'
191
    print '</tr>'
192
    print '</tbody>'
193
    print '</table>'
194
    print '</td>'
195
    print '</tr>'
196
    print '</tbody>'
197
    print '</table>'
198
    print '<p class="LEFT">'
199
    print 'The latest version is <font color="red">' + vimcdoc_ver + '!</font><br>'
200
    print 'Vimcdoc is hosted by sourceforge. So you should be able to'
201
    print 'get it from any sourceforge mirror. See the links below:'
202
    print '<br><br>'
203
    print '</p>'
204
    print '<ul class="LEFT">'
205
    exe_address = 'http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-' + vimcdoc_ver
206
    exe_address = exe_address + '-setup.exe?download'
207
    tarball_address = 'http://prdownloads.sourceforge.net/vimcdoc/vimcdoc-' + vimcdoc_ver
208
    tarball_address = tarball_address + '.tar.gz?download'
209
210
    print '<li> Latest <a href=' + exe_address + '>win32 installation program</a>'
211
    print '</li>'
212
    print '<li> Latest platform independant <a href=' + tarball_address + '> tarball</a>, including an Linux/BSD installation script'
213
    print '</li>'
214
    print '<li> If you are a BSD user, you might want to check out this\
215
            <a href="http://www.freshports.org/chinese/vim-scdoc">port</a>.\
216
            Thanks for hamigua. '
217
    print '<li> There is package for Debian systems too available at\
218
            <a href="http://chinese.alioth.debian.org/vimcdoc">here</a>.\
219
            Thanks for Carlos Liu. '
220
    print '<li> Latest <a href=vim_user_manual_603.0.pdf>PDF</a> version of the translated Vim user manual. '
221
    print 'Thanks slimzhao for permission to host this file.'
222
    print '</li>'
223
    print '<li> For more please use the \'Download\' link on the left.</li>'
224
    print '</ul>'
225
    print '<p class="LEFT">'
226
    print '<a href="http://gro.clinux.org">gro</a> has a '
227
    print '<a href="http://vcd.gro.clinux.org">mirror</a>, where you can get the latest for'
228
    print 'Linux and windows platform.'
229
    print '<br><br>'
230
    print '</p>'
231
232
def PrintAuthors():
233
    print '<table class="HEADER1" width="100%" border="0" cellspacing="0" cellpadding="1">'
234
    print '<tbody>'
235
    print '<tr>'
236
    print '<td>'
237
    print '<table width="100%" border="0" cellspacing="0" cellpadding="4">'
238
    print '<tbody>'
239
    print '<tr class="ROW1">'
240
    print '<td class="NEWS"> <em>Authors</em> </td>'
241
    print '</tr>'
242
    print '</tbody>'
243
    print '</table>'
244
    print '</td>'
245
    print '</tr>'
246
    print '</tbody>'
247
    print '</table>'
248
    print '<p class="LEFT">'
249
    print 'Vimcdoc was started by Ken in 2002.6. lang2 started a similiar'
250
    print 'project from <a href="http://www.linuxforum.net">linuxforum</a> soon after. At the end of 2002 they merged and the'
251
    print 'current vimcdoc took form. We have 19 '
252
    print '<a href="http://sourceforge.net/project/memberlist.php?group_id=56777">members</a>, among'
253
    print 'whom the following has contributed a lot to this project:'
254
    print '<ul class="LEFT">'
255
    f = open( author_file )
256
    auth = re.compile( "^(\w+)\s+\(\s*(\w.*)\s*\)" ) 
257
258
    line = f.readline()
259
    while ( line ):
260
        mobj = auth.match(line)
261
  if mobj is not None:
262
      print '<li>' + mobj.group(1) + ' - ' + mobj.group(2)
263
        line = f.readline()
264
    f.close()
265
266
    print '</ul>'
267
    print '<br><br>'
268
    print '</p>'
269
270
def EndMainBody():
271
    print '<p class="SMALL">'
272
    print 'Vimcdoc is &copy; 2005 by the vimcdoc team.'
273
    print 'All rights reserved.'
274
    print '<br><br>'
275
    print '<a href="http://sourceforge.net">'
276
    print '<img src="http://sourceforge.net/sflogo.php?group_id=56777&amp;type=3" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a>'
277
    print '</p>'
278
    print '</td>'
279
    print '</tr>'
280
    print '</tbody>'
281
    print '</table>'
282
    print '</td>'
283
    print '</tr>'
284
    print '</tbody>'
285
    print '</table>'
286
287
def PrintFooter():
288
    print '</body></html>'
289
290
#####
291
# Main program
292
#####
293
import sys
294
import os
295
from sys import argv
296
297
if len(argv) == 2:
298
    if argv[1] == '-ci':
299
        os.remove ( index_file )
300
        save_out = sys.stdout
301
        sys.stdout = open( index_file, 'w' )
302
303
GetVimcdocVersion()
304
PrintHeader()
305
BeginMainBody()
306
PrintSidebar()
307
PrintWhatIs()
308
PrintGetVimcdoc()
309
PrintNews()
310
PrintAuthors()
311
EndMainBody()
312
PrintFooter()
313
314
if len(argv) == 2:
315
    if argv[1] == '-ci':
316
        sys.stdout.close()
317
        sys.stdout = save_out