4 # table-to-html.py -- convert char-separated table to html table
6 # source file of the GNU LilyPond music typesetter
8 # (c) 1998 Jan Nieuwenhuizen <jan@digicash.com>
23 lilypath = os.environ['LILYPOND_SOURCEDIR'] + '/'
26 lilypath = os.environ['top_srcdir'] + '/'
28 print 'Please set LILYPOND_SOURCEDIR to the toplevel source, eg LILYPOND_SOURCEDIR=/home/foobar/lilypond-1.2.3/'
30 lilypath = lilypath + '/bin/'
31 sys.path.append (lilypath)
36 return 'table-to-html.py version ' + version;
39 sys.stdout.write (program_id () + '\n')
42 sys.stdout.write ("Usage: table-to-html [options] TABLE_FILE HTML_FILE\n"
43 + "Generate mozarella metrics table from preparated feta log\n\n"
45 + " -h, --help print this help\n"
46 + " -s, --separator=SEP specify separator [:]\n")
51 html.write ('<body><table cellspacing=10>')
54 html.write ('</table></body>')
56 def convert (inname, outname, separator):
59 html = File (outname, 'w')
62 while not table.eof ():
63 line = table.readline ()
64 columns = split (line, separator)
65 html_line = '<tr><td>' + join (columns, '</td><td>') + '</td></tr>'
66 html.write (html_line)
74 (options, files) = getopt.getopt (
75 sys.argv[1:], 'hs:', ['help','separator='])
81 if o == '--separator' or o == '-s':
83 elif o== '--help' or o == '-h':
89 convert (files[0], files[1], separator)