#!/usr/bin/python # "boolean" not documented type in kconfig-language.txt line 51 import os,sys helplen = 0 if len(sys.argv)!=4: sys.stderr.write("Usage: menuconfig2html.py kconfigfile outdir version\n") sys.exit(1) def zapquotes(str): if str[0]=='"': str = str[1:str.rfind('"')] return str def htmlescape(str): return str.strip().replace("&","&").replace("<","<").replace(">",">") def starthtml(out): out.write("
\n") out.write("\n") starthtml(sys.stdout) sys.stdout.write("' % (config,config,description)) sys.stdout.write('%s %s \n' % (myfn,config,config,description)) helplen = len(i[:i.find(words[0])].expandtabs()) elif words[0] == "comment": out.write("%s
\n" % htmlescape(zapquotes(words[1]))) elif words[0]=="menu": out.write("
\n") if len(words)>1: temp = htmlescape(zapquotes(words[1])) out.write("Menu: %s
\n" % temp) sys.stdout.write("Menu [%s]
\n" % temp) sys.stdout.write("\n") elif words[0] == "endmenu": out.write("
\n") elif words[0] == "source": fn=zapquotes(words[1]) readfile(fn) out.write('
\n") sys.stdout.write("%(link)s
\n' % {"link": "%s/%s.html" % (sys.argv[2], "-".join(fn.split("/")))}) elif words[0] in ("default","depends", "select", "if", "endif", "#"): pass #else: sys.stderr.write("unknown: %s\n" % i) if helplen: out.write("