-def gen_list(inputs, filename):
+def gen_list(inputs, subdir, filename):
+ (pre, subdirs, post)=subdir
print "generating HTML list %s\n" % filename
list = open(filename, 'w')
- list.write ('<html><TITLE>Rendered Examples</TITLE>\n'
- '<body>These example files are taken from the LilyPond distribution.\n'
+ list.write ('<html><TITLE>Rendered Examples</TITLE>\n')
+ list.write ('<body>')
+ if len(subdirs):
+ list.write ('<h2>subdirectories</h2>')
+ list.write ('<ul>')
+ for ex in subdirs:
+ print 'subdir %s ' % ex
+ list.write ('<li><a href=%s>Subdirectory: %s</a></li>\n' % (pre + ex + post , ex))
+
+ list.write ('</ul>')
+
+ list.write('<h2>Contents of this directory</h2>\n');
+ list.write ('These example files are taken from the LilyPond distribution.\n'
'LilyPond currently only outputs TeX and MIDI. The pictures and\n'
'PostScript files were generated using TeX, Ghostscript and some\n'
'graphics tools. The papersize used for these examples is A4. The GIF\n'
'files have been scaled to eliminate aliasing.\n');
+
for ex in inputs:
print '%s, ' % ex
header = read_mudela_header(ex + '.ly.txt')
allfiles = multiple_find (['*.ly.txt'], '.')
-gen_list (sys.argv[1:], 'index.html')
+import getopt
+
+(cl_options, files) = getopt.getopt(sys.argv[1:],
+ 'hs:', ['help', 'subdirs=', 'suffix=', 'prefix='])
+subdir_pre=''
+subdir_suf =''
+
+subdirs =[]
+for opt in cl_options:
+ o = opt[0]
+ a = opt[1]
+ if o == '--subdirs' or o == '-s':
+ subdirs.append (a)
+ elif o == '--prefix':
+ subdir_pre = a
+ elif o == '--suffix':
+ subdir_suf = a
+
+gen_list (files, (subdir_pre, subdirs, subdir_suf), 'index.html')
gif_examples=$(addprefix $(outdir)/, $(addsuffix .gif, $(examples)))
+html_subdirs=$(addprefix --subdirs ,$(SUBDIRS))
-WWW: $(ly_examples) $(ps_examples) $(gif_examples)
- (cd $(outdir); $(PYTHON) ../$(depth)/bin/mutopia-index.py $(examples))
+
+local-WWW: $(ly_examples) $(ps_examples) $(gif_examples)
+ (cd $(outdir); $(PYTHON) ../$(depth)/bin/mutopia-index.py --prefix=../ --suffix=/$(outdir) $(html_subdirs) $(examples))