]> https://gitweb.dealii.org/ - dealii.git/commitdiff
teach wrapcomments.py about @name 2467/head
authorTimo Heister <timo.heister@gmail.com>
Wed, 6 Apr 2016 09:47:15 +0000 (11:47 +0200)
committerTimo Heister <timo.heister@gmail.com>
Wed, 6 Apr 2016 09:48:21 +0000 (11:48 +0200)
contrib/utilities/wrapcomments.py

index 8a0d93f67fa8dd5d828c1eb81e2889eb0220c725..b3c0c30a22ed47a420d5c8a95a7ed6450a500839 100755 (executable)
@@ -102,6 +102,8 @@ def format_block(lines, infostr=""):
 
     ops_separate_line = ["<ol>", "</ol>", "<ul>", "</ul>", "@{", "@}", "<br>"]
 
+    # separate and do not break:
+    ops_title_line = ["@page", "@name"]
 
     #todo:
     #  @arg @c @cond  @em @endcond @f{ @internal @name @post @pre  @sa 
@@ -131,14 +133,15 @@ def format_block(lines, infostr=""):
             thisline = lines[idx].strip()[2:]
             out.append(start + thisline)
             
-        elif "@page" in lines[idx]:
-            # do not break @page
+        elif one_in(ops_title_line, lines[idx]):
+            # do not break @page, etc.
             if curlines!=[]:
                 out.extend(wrap_block(remove_junk(curlines), start))
                 curlines=[]
             thisline = remove_junk([lines[idx]])[0]
-            if not thisline.startswith("@page") and not thisline.startswith("(@page"):
-                print ("%s warning %s not at start of line"%(infostr, "@page"), file=sys.stderr)
+            
+            if not thisline.split(" ")[0] in ops_title_line:
+                print ("%s warning title not at start of line"%(infostr), file=sys.stderr)
             out.append(start + thisline.strip())
 
         elif "@ref" in lines[idx]:
@@ -503,6 +506,13 @@ lineI = [" /**", \
 lineO = lineI
 assert(format_block(lineI)==lineO)
 
+# do not break @name:
+longtext = "bla bla"*20
+lineI = [" /**", \
+         "  * @name " + longtext, \
+         "  * hello", \
+         "  */"]
+assert(format_block(lineI)==lineI)
 
 
 #print (lineI)

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.