[coreboot-gerrit] Change in coreboot[master]: util/optionlist: move kconfig2wiki to kconfig2html and adapt to html

Patrick Georgi (Code Review) gerrit at coreboot.org
Thu Jun 7 13:59:43 CEST 2018


Patrick Georgi has uploaded this change for review. ( https://review.coreboot.org/26944


Change subject: util/optionlist: move kconfig2wiki to kconfig2html and adapt to html
......................................................................

util/optionlist: move kconfig2wiki to kconfig2html and adapt to html

This also removes a "chapters mode" that we never used.

Change-Id: Ib301e2f4db0b9678081fa987a5dcc7108bb103a4
Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
R util/optionlist/kconfig2html
1 file changed, 17 insertions(+), 31 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/44/26944/1

diff --git a/util/optionlist/kconfig2wiki b/util/optionlist/kconfig2html
similarity index 64%
rename from util/optionlist/kconfig2wiki
rename to util/optionlist/kconfig2html
index 9e8fc27..defd35d 100755
--- a/util/optionlist/kconfig2wiki
+++ b/util/optionlist/kconfig2html
@@ -56,11 +56,11 @@
 		if helplen:
 			i = i.expandtabs()
 			if not len(i) or i[:helplen].isspace():
-				sys.stdout.write("%s\n" % htmlescape(i))
+				sys.stdout.write("%s<br />\n" % htmlescape(i))
 				continue
 			else:
 				helplen = 0
-				sys.stdout.write("||\n")
+				sys.stdout.write("</td></tr>\n")
 
 		words = i.strip().split(None,1)
 		if not len(words): continue
@@ -74,32 +74,18 @@
 		elif words[0]=="prompt":
 			description = htmlescape(zapquotes(words[1]))
 		elif words[0] in ("help", "---help---"):
-			sys.stdout.write("|- bgcolor=\"#eeeeee\"\n")
-			sys.stdout.write("| %s || %s || %s || %s || \n" % (config,source,configtype,description) )
+			sys.stdout.write("<tr bgcolor=\"#eeeeee\">\n")
+			sys.stdout.write("<td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>\n" % (config,source,configtype,description) )
 			helplen = len(i[:i.find(words[0])].expandtabs())
 		elif words[0] == "comment":
-			sys.stdout.write("|- bgcolor=\"#eeeeee\"\n")
-			sys.stdout.write("| || || (comment) || || %s ||\n" % htmlescape(zapquotes(words[1])))
+			sys.stdout.write("<tr bgcolor=\"#eeeeee\">\n")
+			sys.stdout.write("<td></td><td></td><td>(comment)</td><td></td><td>%s</td></tr>\n" % htmlescape(zapquotes(words[1])))
 		elif words[0]=="menu":
 			if len(words)>1:
 				temp = htmlescape(zapquotes(words[1]))
-				if extra_chapters:
-					sys.stdout.write("== Menu: %s ==\n" % temp)
-					sys.stdout.write("{| border=\"0\" style=\"font-size: smaller\"\n");
-					sys.stdout.write("|- bgcolor=\"#6699dd\"\n")
-					sys.stdout.write("! align=\"left\" | Option\n")
-					sys.stdout.write("! align=\"left\" | Source\n")
-					sys.stdout.write("! align=\"left\" | Format\n")
-					sys.stdout.write("! align=\"left\" | Short Description\n")
-					sys.stdout.write("! align=\"left\" | Description\n")
-				else:
-					# Don't start an extra chapter for a
-					# new menu
-					sys.stdout.write("|- bgcolor=\"#6699dd\"\n")
-					sys.stdout.write("! align=\"left\" | Menu: %s || || || ||\n" % temp)
+				sys.stdout.write("<tr bgcolor=\"#6699dd\">\n")
+				sys.stdout.write("<td colspan=5>Menu: %s</td></tr>\n" % temp)
 		elif words[0] == "endmenu":
-			if extra_chapters:
-				sys.stdout.write("|}\n")
 			sys.stdout.write("\n")
 		elif words[0] == "source":
 			fn=zapquotes(words[1])
@@ -107,7 +93,7 @@
 				readfile(name)
 		elif words[0] in ("default","depends", "select", "if", "endif", "#"): pass
 		#else: sys.stderr.write("unknown: %s\n" % i)
-	if helplen: sys.stdout.write("||\n")
+	if helplen: sys.stdout.write("</td></tr>\n")
 
 def main():
 	import sys, time
@@ -118,15 +104,15 @@
 
 	sys.stdout.write("This is an automatically generated list of '''coreboot compile-time options'''.\n")
 	sys.stdout.write("\nLast update: %s\n" % sys.argv[2])
-	sys.stdout.write("{| border=\"0\" style=\"font-size: smaller\"\n");
-	sys.stdout.write("|- bgcolor=\"#6699dd\"\n")
-	sys.stdout.write("! align=\"left\" | Option\n")
-	sys.stdout.write("! align=\"left\" | Source\n")
-	sys.stdout.write("! align=\"left\" | Format\n")
-	sys.stdout.write("! align=\"left\" | Short Description\n")
-	sys.stdout.write("! align=\"left\" | Description\n")
+	sys.stdout.write("<table border=\"0\" style=\"font-size: smaller\">\n");
+	sys.stdout.write("<tr bgcolor=\"#6699dd\">\n")
+	sys.stdout.write("<td align=\"left\">Option</td>\n")
+	sys.stdout.write("<td align=\"left\">Source</td>\n")
+	sys.stdout.write("<td align=\"left\">Format</td>\n")
+	sys.stdout.write("<td align=\"left\">Short Description</td>\n")
+	sys.stdout.write("<td align=\"left\">Description</td></tr>\n")
 	readfile(sys.argv[1])
-	sys.stdout.write("|}\n")
+	sys.stdout.write("</table>\n")
 
 if __name__ == "__main__":
 	main()

-- 
To view, visit https://review.coreboot.org/26944
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib301e2f4db0b9678081fa987a5dcc7108bb103a4
Gerrit-Change-Number: 26944
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Georgi <pgeorgi at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180607/47229f89/attachment-0001.html>


More information about the coreboot-gerrit mailing list