From: Timo Heister Date: Wed, 24 Dec 2014 14:25:02 +0000 (-0500) Subject: update wrapcomments.py X-Git-Tag: v8.2.0~3^2~10 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9043ad1d529ea2753fb9b45cd4c8b8078220a3ad;p=dealii.git update wrapcomments.py now handle @image tags correctly --- diff --git a/contrib/utilities/wrapcomments.py b/contrib/utilities/wrapcomments.py index 8ee0ec6b73..52cf0b120c 100755 --- a/contrib/utilities/wrapcomments.py +++ b/contrib/utilities/wrapcomments.py @@ -12,7 +12,7 @@ import sys import string wrapper = textwrap.TextWrapper() -# take an array of lines and wrap them to 78 columns and let each lines start +# take an array of lines and wrap them to 78 columns and let each line start # with @p startwith def wrap_block(lines, startwith): longline = " ".join(lines) @@ -87,12 +87,16 @@ def format_block(lines, infostr=""): idx = string.find(lines[0],"/**") start = lines[0][:idx]+" * " - out = [lines[0]] + out = [lines[0].rstrip()] idx = 1 endidx = len(lines)-1 curlines = [] - ops_startline = ["
  • ", "@param", "@returns", "@warning", "@ingroup", "@author", "@date", "@related", "@deprecated"] + ops_startline = ["
  • ", "@param", "@returns", "@warning", "@ingroup", "@author", "@date", "@related", "@deprecated", "@image"] + + # subset of ops_startline that does not want stuff from the next line appended + # to this. + ops_also_end_paragraph = ["@image"] ops_separate_line = ["
      ", "
    ", "", "@{", "@}", "
    "] @@ -115,7 +119,10 @@ def format_block(lines, infostr=""): for it in ops_startline: if it in thisline: print ("%s warning %s not at start of line"%(infostr, it), file=sys.stderr) - curlines.append(lines[idx]) + if one_in(ops_startline, lines[idx]): + out.append(lines[idx].rstrip()) + else: + curlines.append(lines[idx]) elif one_in(["@code", "@verbatim", "@f["], lines[idx]): if curlines!=[]: out.extend(wrap_block(remove_junk(curlines), start)) @@ -295,6 +302,18 @@ lineO = [" /**", \ " */"] assert(format_block(lineI)==lineO) +lineI = [" /** ", \ + " * bla", \ + " * @image testing.png", \ + " * blub", \ + " */"] +lineO = [" /**", \ + " * bla", \ + " * @image testing.png", \ + " * blub", \ + " */"] +assert(format_block(lineI)==lineO) + # now open the file and do the work