]> https://gitweb.dealii.org/ - dealii.git/commitdiff
improve wrapcomments.py
authorTimo Heister <timo.heister@gmail.com>
Sat, 6 Feb 2016 23:33:21 +0000 (18:33 -0500)
committerTimo Heister <timo.heister@gmail.com>
Sun, 7 Feb 2016 00:23:09 +0000 (19:23 -0500)
contrib/utilities/wrapcomments.py

index ddd53eefae993dd47205888b418c42643e729ac5..61ce6144ea7da8c0cabed9e972c5203580554fad 100755 (executable)
@@ -92,11 +92,11 @@ def format_block(lines, infostr=""):
     endidx = len(lines)-1
     curlines = []
 
-    ops_startline = ["<li>", "@param", "@returns", "@warning", "@ingroup", "@author", "@date", "@related", "@relates", "@relatesalso", "@deprecated", "@image", "@return", "@brief", "@attention", "@copydoc", "@addtogroup", "@todo", "@tparam", "@skip", "@skipline", "@until", "@line", "@dontinclude", "@include", "@see", "@note"]
+    ops_startline = ["<li>", "@param", "@returns", "@warning", "@ingroup", "@author", "@date", "@related", "@relates", "@relatesalso", "@deprecated", "@image", "@return", "@brief", "@attention", "@copydoc", "@addtogroup", "@todo", "@tparam", "@see", "@note", "@skip", "@skipline", "@until", "@line", "@dontinclude", "@include"]
 
     # subset of ops_startline that does not want stuff from the next line appended
     # to this.
-    ops_also_end_paragraph = ["@image"]
+    ops_also_end_paragraph = ["@image", "@skip", "@skipline", "@until", "@line", "@dontinclude", "@include"]
 
     # stuff handled in the while loop down: @code, @verbatim, @f @ref
 
@@ -186,7 +186,10 @@ def format_block(lines, infostr=""):
                 out.append(lines[idx].rstrip())
             else:
                 curlines.append(lines[idx])
-        elif one_in(["@code", "@verbatim", "@f["], lines[idx]):
+        elif one_in(["@code", "@verbatim", "@f[", "@f{"], lines[idx]):
+            if "@f{" in lines[idx]:
+                if not lines[idx].endswith("}{"):
+                    print ("%s warning malformed @f{*}{"%(infostr), file=sys.stderr)
             if curlines!=[]:
                 out.extend(wrap_block(remove_junk(curlines), start))
                 curlines=[]
@@ -207,7 +210,7 @@ def format_block(lines, infostr=""):
                 else:
                     thisline = start + thisline.strip()[2:]
                 out.append(thisline.rstrip())
-                if one_in(["@endcode", "@endverbatim", "@f]"], lines[idx]):
+                if one_in(["@endcode", "@endverbatim", "@f]", "@f}"], lines[idx]):
                     break
                 idx += 1
         elif lines[idx].strip()=="*":
@@ -442,7 +445,35 @@ lineI = [" /**", \
 lineO = lineI
 assert(format_block(lineI)==lineO)
 
+# @f{}
+lineI = [" /**", \
+         "  * Hello:", \
+         "  * @f{aligned*}{", \
+         "  *   A\\\\", \
+         "  *   B", \
+         "  * @f}", \
+         "  * bla", \
+         "  */"]
+lineO = lineI
+assert(format_block(lineI)==lineO)
 
+# @until 
+lineI = [" /**", \
+         "  * Hello:", \
+         "  * @include a", \
+         "  * bla", \
+         "  * @dontinclude a", \
+         "  * bla", \
+         "  * @line a", \
+         "  * bla", \
+         "  * @skip a", \
+         "  * bla", \
+         "  * @until a", \
+         "  * bla", \
+         "  */"]
+lineO = lineI
+#print (lineI, "\n",format_block(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.