- def read_dict(s, default, h =header):
- try:
- ret = h[s]
- except KeyError:
- ret = default
- return ret
- head = read_dict('title', ex)
- composer = read_dict('composer', '')
- desc = read_dict('description', '')
- list.write('<hr>')
- list.write('<h1>example file: %s</h1>' % head);
- if composer <> '':
- list.write('<h2>%s</h2>\n' % composer)
- if desc <> '':
- list.write('%s<p>' % desc)
- list.write ('<ul>')
- def list_item(filename, desc, type, l = list):
- if file_exist_b(filename):
- l.write ('<li><a href=%s>%s</a>' % (filename, desc))
- size=os.stat(filename)[stat.ST_SIZE]
- l.write (' (%s %dk)' % (type, (size + 512) / 1024))
- pictures = ['jpeg', 'png', 'xpm']
- # silly, no?
- if 0 and type in pictures:
- l.write (' <a href="http://www.gnu.org/philosophy/gif.html">no gifs due to patent problems</a>')
- l.write ('\n')
- list_item(ex + ex_ext + '.txt', 'The input', 'ASCII')
- for pageno in range(1,100):
- f = ex + '-page%d.png' % pageno
- if not file_exist_b (f):
- break
- list_item(f, 'The output, page %d' % pageno, 'png')
- list_item(ex + '.ps.gz', 'The output', 'gzipped PostScript')
- list_item(ex + '.midi', 'The output', 'MIDI')
- list.write ("</ul>");
-
- list.write( "</BODY></HTML>");
- list.close()
+ if inputs:
+ list.write (headertext)
+ else:
+ list.write (headertext_nopics)
+
+
+ for ex in inputs:
+ (base, ext) = os.path.splitext (ex)
+ (base, ext2) = os.path.splitext (base)
+ ext = ext2 + ext
+
+ print '%s, ' % ex
+ header = read_lilypond_header(ex)
+
+ def read_dict(s, default, h =header):
+ try:
+ ret = h[s]
+ except KeyError:
+ ret = default
+ return ret
+ head = read_dict('title', os.path.basename (base))
+ composer = read_dict('composer', '')
+ desc = read_dict('description', '')
+ list.write('<hr>\n')
+ list.write('<h1>example file: %s</h1>\n' % head);
+ if composer <> '':
+ list.write('<h2>%s</h2>\n' % composer)
+ if desc <> '':
+ list.write('%s<p>' % desc)
+ list.write ('<ul>\n')
+ def list_item(filename, desc, type, l = list):
+ if file_exist_b(filename):
+ l.write ('<li><a href="%s">%s</a>' % (filename, desc))
+ size=os.stat(filename)[stat.ST_SIZE]
+ kB=(size + 512) / 1024
+ if kB:
+ l.write (' (%s %dkB)' % (type, kB))
+ else:
+ l.write (' (%s %dcharacters)' % (type, size))
+ pictures = ['jpeg', 'png', 'xpm']
+ l.write ('\n')
+
+ list_item(base + ext, 'The input', 'ASCII')
+ for pageno in range(1,100):
+ f = base + '-page%d.png' % pageno
+ if not file_exist_b (f):
+ break
+ list_item(f, 'See a picture of page %d' % pageno, 'png')
+ list_item(base + '.pdf', 'Print ', 'PDF')
+ list_item(base + '.ps.gz', 'Print ', 'gzipped PostScript')
+ list_item(base + '.midi', 'Listen', 'MIDI')
+ list.write ("</ul>\n");
+
+ list.write('</body></html>\n');
+ list.close()