[build/doc] Add support for comments on section

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-03-27 17:22:35 +01:00
parent 51b6630d9e
commit 7294dc55fd
1 changed files with 7 additions and 7 deletions

View File

@ -16,18 +16,19 @@ def section_print(section, options):
underline += "~" underline += "~"
i += 1 i += 1
print underline print underline
if options.has_key("comments"):
print "%s\n" % options.pop("comments")
for option, format in options.items(): for option, format in options.items():
print "%s::" % option print "%s::" % option
print " %s" % format print " %s" % format
print print
def sections_print(sections): def sections_print(sections):
section_print("Base sections", sections['awesome']) section_print("Base sections", sections.pop("awesome"))
keylist = sections.keys() keylist = sections.keys()
keylist.sort() keylist.sort()
for key in keylist: for key in keylist:
if key != "awesome": section_print(key, sections[key])
section_print(key, sections[key])
def sections_get(file): def sections_get(file):
sections = {} sections = {}
@ -36,14 +37,13 @@ def sections_get(file):
for line in file.readlines(): for line in file.readlines():
if line.startswith("cfg_opt_t"): if line.startswith("cfg_opt_t"):
section_name = (line.split(" ", 1)[1]).split("_opts")[0] section_name = (line.split(" ", 1)[1]).split("_opts")[0]
section_doc['comments'] = lastline[4:-3]
section_begin = True section_begin = True
continue elif section_begin and line.startswith("};"):
if section_begin and line.startswith("};"):
section_begin = False section_begin = False
sections[section_name] = section_doc sections[section_name] = section_doc
section_doc = {} section_doc = {}
continue elif section_begin and line.startswith(" CFG_"):
if section_begin and line.startswith(" CFG_"):
if line.startswith(" CFG_AWESOME_END"): if line.startswith(" CFG_AWESOME_END"):
continue continue
option_title = line.split("\"")[1].split("\"")[0] option_title = line.split("\"")[1].split("\"")[0]