changeset 29:c91c3395876f

Produce better menuconfig output, now in multiple files and with concise symbol indexes per architecture, with nested menus displayed as lists.
author Rob Landley <rob@landley.net>
date Wed, 29 Aug 2007 22:42:39 -0500
parents 35b3feac366a
children fc688c499467
files make/make.sh make/menuconfig2html.py
diffstat 2 files changed, 36 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/make/make.sh	Thu Aug 16 20:45:33 2007 -0500
+++ b/make/make.sh	Wed Aug 29 22:42:39 2007 -0500
@@ -1,13 +1,17 @@
 #!/bin/bash
 
 echo Update linux kernel from kernel.org Mercurial repository
+
 # 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
+
+rm -rf ~/www/kdocs/menuconfig/
 mkdir -p ~/www/kdocs/menuconfig
 echo "<html>Menuconfig docs for kernel $(make kernelversion)</html><body><ul>" > ~/www/kdocs/menuconfig/index.html
 for i in $(find arch -maxdepth 2 -name Kconfig | sort)
@@ -15,15 +19,19 @@
   echo Converting "$i"
   ARCH=$(echo $i | sed -r 's@.*/(.*)/.*@\1@')
   echo "<li><a href=${ARCH}.html>${ARCH}</a></li>" >> ~/www/kdocs/menuconfig/index.html
-  ~/www/kdocs/make/menuconfig2html.py $i > ~/www/kdocs/menuconfig/$ARCH.html
+  echo ~/www/kdocs/make/menuconfig2html.py $i ~/www/kdocs/menuconfig # $ARCH.html
+
+  ~/www/kdocs/make/menuconfig2html.py $i ~/www/kdocs/menuconfig > ~/www/kdocs/menuconfig/$ARCH.html
 done
 echo "</ul></body></html>" >> ~/www/kdocs/menuconfig/index.html
 
 echo Install updated Documentation
+
 rm -rf ~/www/kdocs/Documentation/
 cp -a ~/linux/hg/Documentation ~/www/kdocs/Documentation
 
 echo Build htmldocs and xhtml-nochunks
+
 rm -rf ~/linux/temp
 cd ~/linux/hg
 mkdir ~/linux/temp
@@ -53,6 +61,7 @@
 rmdir xhtml-nochunks
 
 echo Install htmldocs and update index
+
 rm -rf ~/www/kdocs/htmldocs
 cp -a ~/linux/temp/Documentation/DocBook ~/www/kdocs/htmldocs
 cd ~/www/kdocs/htmldocs
--- a/make/menuconfig2html.py	Thu Aug 16 20:45:33 2007 -0500
+++ b/make/menuconfig2html.py	Wed Aug 29 22:42:39 2007 -0500
@@ -4,6 +4,10 @@
 
 import os,sys
 
+if len(sys.argv)!=3:
+  sys.stderr.write("Usage: menuconfig2html.py kconfigfile outdir\n")
+  sys.exit(1)
+
 def zapquotes(str):
   if str[0]=='"': str = str[1:str.rfind('"')]
   return str
@@ -12,16 +16,20 @@
   return str.strip().replace("&","&amp;").replace("<","&lt;").replace(">","&gt;")
 
 helplen = 0
-out = sys.stdout
 
 def readfile(filename):
   global helplen
+
+  myfn="%s.html" % "-".join(filename.split("/"))
+
+  out=open("%s/%s.html" % (sys.argv[2], myfn),"w")
   #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
+  out.write("<html>\n")
   config = None
   description = None
   for i in lines:
@@ -46,19 +54,29 @@
       description = htmlescape(zapquotes(words[1]))
     elif words[0] in ("help", "---help---"):
       out.write('<a name="%s"><h2>%s</h2>\n<h3>%s</h3>\n<blockquote><pre>' % (config,config,description))
+      sys.stdout.write('<li><a href="%s#%s">%s</a> %s</li>\n' % (myfn,config,config,description))
       helplen = len(i[:i.find(words[0])].expandtabs())
     elif words[0] == "comment":
-      out.write("<h3>%s</h3\n" % htmlescape(zapquotes(words[1])))
+      out.write("<h3>%s</h3>\n" % htmlescape(zapquotes(words[1])))
     elif words[0]=="menu":
       out.write("<hr>\n")
-      if len(words)>1: out.write("<h1>Menu: %s</h1>\n" % htmlescape(zapquotes(words[1])))
+      if len(words)>1:
+        temp = htmlescape(zapquotes(words[1]))
+        out.write("<h1>Menu: %s</h1>\n" % temp)
+        sys.stdout.write("<h2>Menu [%s]</h2>\n" % temp)
+      sys.stdout.write("<ul>\n")
     elif words[0] == "endmenu":
-      out.write("<hr>\n")  # Probably something better to do here
-    elif words[0] == "source": readfile(zapquotes(words[1]))
+      out.write("<hr>\n")
+      sys.stdout.write("</ul>\n")
+    elif words[0] == "source":
+      fn=zapquotes(words[1])
+      readfile(fn)
+      out.write('<h2><a href="%(link)s">%(link)s</a></h2>\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("</pre></blockquote>\n")
+  out.write("</html>\n")
 
-out.write("<html>\n")
+sys.stdout.write("<html>\n<ul>\n")
 readfile(sys.argv[1])
-if helplen: out.write("</pre></blockquote>\n")
-out.write("</html>\n")
+sys.stdout.write("</ul>\n</html>\n")