[r190]: trunk / www / htdocs / vimcdoc-sf.py Maximize Restore History

Download this file

vimcdoc-sf.py    313 lines (289 with data), 11.7 kB

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