#! /usr/bin/env python2 import sys import datetime import types from collections import OrderedDict tabs = OrderedDict([ ("Overview", OrderedDict([ ("index",""), ])), ("Documentation", OrderedDict([ ("news", "News"), ("migration", "Migration"), ("tutorial", "Tutorial"), ("herbstluftwm", "herbstluftwm(1)"), ("herbstclient", "herbstclient(1)"), ])), ("FAQ", OrderedDict([ ("faq", "FAQ"), ])), ("Download", OrderedDict([ ("download", "Download"), ])), ("Wiki", "http://wiki.herbstluftwm.org"), ]) page2tab = {} filename = sys.argv[1] name = filename.replace('-content.html', '') toc = filename.replace('-content.html', '-toc.html') windowtitle = "herbstluftwm" for title, subpages in tabs.iteritems(): if not isinstance(subpages, basestring): for fn, subtitle in subpages.iteritems(): page2tab[fn] = title if not ("" == subtitle) and (name == fn): windowtitle = subtitle + " - herbstluftwm" curtab = page2tab[name] #====~===~=========~== # Header #====~===~=========~== print """\ {title}
""".format(title=windowtitle) #====~===~=========~== # Navigation bar #====~===~=========~== print """\ \
""" subpages = tabs[page2tab[name]] if len(subpages) > 1: print '
' for basename, title in subpages.iteritems(): if basename == name: cls = "subpagecur subpage" else: cls = "subpage" print ''.format(cls = cls) print '{title}'.format( url = basename + ".html",title = title) print "
" print """\
\ """ # possibly table of contents: try: print open(toc).read() except IOError: # no toc file print "" print open(filename).read() print """\ """.format(date=datetime.datetime.now().strftime('%Y-%m-%d at %H:%M:%S %Z')) #====~===~=========~== # Footer #====~===~=========~== print """\
""" # vim: noet