From b4deb311f24ad47034b4e8098f020dce9cea22e4 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Mon, 21 Dec 2015 18:01:40 -0500 Subject: [PATCH] teach wrapcomments.py about nested lists --- contrib/utilities/wrapcomments.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/contrib/utilities/wrapcomments.py b/contrib/utilities/wrapcomments.py index 30a870e511..ddd53eefae 100755 --- a/contrib/utilities/wrapcomments.py +++ b/contrib/utilities/wrapcomments.py @@ -116,6 +116,13 @@ def format_block(lines, infostr=""): if it in thisline and thisline!=it: print ("%s warning %s not in separate line"%(infostr, it), file=sys.stderr) out.append(start + thisline) + elif starts_with_one(["* - ", "* - "],lines[idx].strip()): + if curlines!=[]: + out.extend(wrap_block(remove_junk(curlines), start)) + curlines=[] + thisline = lines[idx].strip()[2:] + out.append(start + thisline) + elif "@page" in lines[idx]: # do not break @page if curlines!=[]: @@ -423,6 +430,19 @@ lineO = [" /**", \ " */"] assert(format_block(lineI)==lineO) +# nested lists +lineI = [" /**", \ + " * Hello:", \ + " * - A", \ + " * - B", \ + " * - C", \ + " * - D", \ + " * - E", \ + " */"] +lineO = lineI +assert(format_block(lineI)==lineO) + + # now open the file and do the work -- 2.39.5