# HG changeset patch # User Rob Landley # Date 1187158643 18000 # Node ID 3c78854053e34e5e71f6800c0a7c7a0f9a75fc91 # Parent fe01baf8e2a0b6adbc4bd90077f451a9ba082a78 A script to convert menuconfig to html. Have make.sh call it for all $ARCH. (Need to create an index.html, and improve the conversion...) diff -r fe01baf8e2a0 -r 3c78854053e3 make/make.sh --- a/make/make.sh Mon Aug 13 16:25:58 2007 -0500 +++ b/make/make.sh Wed Aug 15 01:17:23 2007 -0500 @@ -1,18 +1,29 @@ #!/bin/bash echo Update linux kernel from kernel.org Mercurial repository -# mkdir -p ~/linux/hg -# hg clone http://kernel.org/hg/linux-2.6 -cd ~/linux/hg/linux-2.6 +# mkdir -p ~/linux +# cd ~/linux +# hg clone http://kernel.org/hg/linux-2.6 hg +cd ~/linux/hg hg pull -u +echo Convert kconfig to html for all architectures +mkdir -p ~/www/kdocs/menuconfig +for i in $(find arch -maxdepth 2 -name Kconfig) +do + echo Converting "$i" + ARCH=$(echo $i | sed -r 's@.*/(.*)/.*@\1@') + + ~/www/kdocs/make/menuconfig2html.py $i > ~/www/kdocs/menuconfig/$(echo $i | sed -r 's@.*/(.*)/.*@\1@').html +done + echo Install updated Documentation rm -rf ~/www/kdocs/Documentation/ -cp -a ~/linux/hg/linux-2.6/Documentation ~/www/kdocs/Documentation +cp -a ~/linux/hg/Documentation ~/www/kdocs/Documentation echo Build htmldocs and xhtml-nochunks rm -rf ~/linux/temp -cd ~/linux/hg/linux-2.6 +cd ~/linux/hg mkdir ~/linux/temp make allnoconfig O=~/linux/temp diff -r fe01baf8e2a0 -r 3c78854053e3 make/menuconfig2html.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/menuconfig2html.py Wed Aug 15 01:17:23 2007 -0500 @@ -0,0 +1,64 @@ +#!/usr/bin/python + +# "boolean" not documented type in kconfig-language.txt line 51 + +import os,sys + +def zapquotes(str): + if str[0]=='"': str = str[1:str.rfind('"')] + return str + +def htmlescape(str): + return str.strip().replace("&","&").replace("<","<").replace(">",">") + +helplen = 0 +out = sys.stdout + +def readfile(filename): + global helplen + #sys.stderr.write("Reading %s\n" % filename) + try: + lines = open(filename).read().split("\n") + except IOError: + sys.stderr.write("File %s missing\n" % filename) + return + config = None + description = None + for i in lines: + if helplen: + i = i.expandtabs() + if not len(i) or i[:helplen].isspace(): + out.write("%s\n" % htmlescape(i)) + continue + else: + helplen = 0 + out.write("\n") + + words = i.strip().split(None,1) + if not len(words): continue + + if words[0] in ("config", "menuconfig"): + config = words[1] + description = "" + elif words[0] in ("bool", "boolean", "tristate", "string", "hex", "int"): + if len(words)>1: description = htmlescape(zapquotes(words[1])) + elif words[0]=="prompt": + description = htmlescape(zapquotes(words[1])) + elif words[0] in ("help", "---help---"): + out.write('

%s

\n

%s

\n
' % (config,config,description))
+      helplen = len(i[:i.find(words[0])].expandtabs())
+    elif words[0] == "comment":
+      out.write("

%s\n") + if len(words)>1: out.write("

Menu: %s

\n" % htmlescape(zapquotes(words[1]))) + elif words[0] == "endmenu": + out.write("
\n") # Probably something better to do here + elif words[0] == "source": readfile(zapquotes(words[1])) + elif words[0] in ("default","depends", "select", "if", "endif", "#"): pass + #else: sys.stderr.write("unknown: %s\n" % i) + +out.write("\n") +readfile(sys.argv[1]) +if helplen: out.write("
\n") +out.write("\n")