]> https://gitweb.dealii.org/ - dealii.git/commitdiff
teach wrapcomments.py about nested lists 2007/head
authorTimo Heister <timo.heister@gmail.com>
Mon, 21 Dec 2015 23:01:40 +0000 (18:01 -0500)
committerTimo Heister <timo.heister@gmail.com>
Mon, 21 Dec 2015 23:09:23 +0000 (18:09 -0500)
contrib/utilities/wrapcomments.py

index 30a870e511690ea8ab3f294a541280d320fc4086..ddd53eefae993dd47205888b418c42643e729ac5 100755 (executable)
@@ -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

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.