From e103d4145b4dd560d275b79dbbc63c9f3487a83a Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Sat, 6 Feb 2016 18:33:21 -0500 Subject: [PATCH] improve wrapcomments.py --- contrib/utilities/wrapcomments.py | 39 +++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/contrib/utilities/wrapcomments.py b/contrib/utilities/wrapcomments.py index ddd53eefae..61ce6144ea 100755 --- a/contrib/utilities/wrapcomments.py +++ b/contrib/utilities/wrapcomments.py @@ -92,11 +92,11 @@ def format_block(lines, infostr=""): endidx = len(lines)-1 curlines = [] - ops_startline = ["
  • ", "@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 = ["
  • ", "@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 -- 2.39.5