From 266eec9bb14a2456bc198bee13534e5312d8ffbc Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Thu, 9 Feb 2012 14:28:39 +0100
Subject: [PATCH] Changed the way the lists of Actions appear in the manual. 
 Now rather than having

DISTANCE
ANGLE
etc

which each one being a link you have

DISTANCE    calculate the distance between a pair of atoms
ANGLE       calculate the angle between three atoms
etc

each one of DISTANCE, ANGLE and so on is still a link to the more detailed description
---
 user-doc/Colvar.txt |  6 +++-
 user-doc/extract    | 73 +++++++++++++++++++++++++++++++--------------
 2 files changed, 56 insertions(+), 23 deletions(-)

diff --git a/user-doc/Colvar.txt b/user-doc/Colvar.txt
index 04784399d..4015dd435 100644
--- a/user-doc/Colvar.txt
+++ b/user-doc/Colvar.txt
@@ -71,7 +71,11 @@ in a wide variety of MD codes.  Consequentially, we have implemented a more prag
 in input any molecules (or parts of molecules) that must be kept in tact throughout the simulation run.  In plumed 1.0 this was done
 using the ALIGN_ATOMS keyword.  In plumed 2.0 the same effect can be acchieved using any one from the following list of commands
 
-- \subpage WHOLEMOLECULES
+<table align=center frame=void width=95%% cellpadding=5%%>
+<tr>
+<td width=5%> \subpage WHOLEMOLECULES </td> <td> With this command you can specify the atoms in each of your molecules </td> 
+</tr> 
+</table>
 @TOPOLOGY@
 
 The most general of these is the \ref WHOLEMOLECULES keywords.  However, there are advantages in using the others as oftentimes
diff --git a/user-doc/extract b/user-doc/extract
index 5a4c4ddf7..cddbe0bda 100755
--- a/user-doc/extract
+++ b/user-doc/extract
@@ -3,7 +3,7 @@ rm -rf automatic
 mkdir automatic
 
 # Check for files that register actions with no documentation
-touch errors
+rm errors
 for file in ../src/*.cpp
 do
   nreg=`grep "PLUMED_REGISTER_ACTION" $file | wc -l | awk '{print $1}'`
@@ -30,23 +30,27 @@ done
 #  fi
 #done
 
-# Generate all the documentation pages for colvar modifiers
-#rm -f modifier_file
-#echo "\\section mod Working with distributions" > modifier_file
-#echo "As described above you can use this colvar to calculate one or multiple CVs.  Obviously, if you have calculated multiple CVs then you have a distribution of CVs.  As such plumed allows you to calculate a number of functions of this distribution.  These quantities and their derivatives are then stored as the values of the colvar.  N.B.  You cannot calcualte the values of the colvars and these functions of the distribution from a single line in input.  You can however calculate multiple functions of the distribution." >> modifier_file
-#cat ../*/*cpp |
-#awk '{
-#  if($1=="//+ENDPLUMEDOC"){
-#     inside=0
-#  }
-#  if(inside && $1!="/**" && $1!="*/") print $0 >> "modifier_file"
-#  if($1=="//+PLUMEDOC"){
-#     if($2=="MODIFIER"){
-#        print "\\par " $3 >> "modifier_file"   
-#        inside=1;
-#     }
-#  } 
-#}'  
+# Generate all the documentation for colvar modifiers
+rm -f modifier_file
+echo "\\section mod Working with distributions" > modifier_file
+echo "As described above you can use this colvar to calculate one or multiple CVs.  Obviously, if you have calculated multiple CVs then you have a distribution of CVs.  Plumed allows you to calculate a number of functions of this distribution.  These quantities and their derivatives are then stored as the values of the colvar.  N.B.  You cannot calcualte the values of the colvars and these functions of the distribution from a single line in input.  You can however calculate multiple functions of the distribution." >> modifier_file
+echo "<table align=center frame=void width=95%% cellpadding=5%%>" >> modifier_file
+cat ../*/*cpp |
+awk '{
+  if($1=="//+ENDPLUMEDOC" && inside==1){
+     print "</td> </tr>" >> "modifier_file" 
+     inside=0
+  }
+  if(inside && $1!="/**" && $1!="*/") print $0 >> "modifier_file"
+  if($1=="//+PLUMEDOC"){
+     if($2=="MODIFIER"){
+        print "<tr> <td width=5%> <b> ", $3, " </b></td>" >> "modifier_file"
+        print "<td>" >> "modifier_file"   
+        inside=1;
+     }
+  } 
+}'  
+echo "</table>" >> modifier_file
 
 # Generate all the documentation pages from comments
 cat ../*/*cpp |
@@ -55,16 +59,25 @@ awk '{
      inside=0;
      print "*/" >output
   }
-  if(inside && $1!="/**" && $1!="*/") print $0 >output
+  if(inside==2 && NF==0){
+     print "</td> </tr>" > lfile
+     inside=1
+  }
+  if(inside==1 && $1!="/**" && $1!="*/") print $0 >output
+  if(inside==2 && $1!="/**" && $1!="*/" ){
+     print $0 > output
+     print $0 > lfile
+  }
   if($1=="//+PLUMEDOC"){
     if( $2=="TOPOLOGY" || $2=="COLVAR" || $2=="FUNCTION" || $2=="ANALYSIS" || $2=="BIAS" || $2=="VATOM" || $2=="GENERIC" || $2=="TOOLS" ){
       lfile="automatic/"$2".list"
-      print "- \\subpage "$3 > lfile
+      
+      print "<tr> <td width=5%> \\subpage ", $3,"</td> <td>" > lfile
       output="automatic/"$3".tmp";
       print "/**" > output
       print "\\page "$3 > output
       print "\\section "$3 >output
-      inside=1;
+      inside=2;
     }
   }
 }'
@@ -94,7 +107,7 @@ do
           iscol=`grep $flag automatic/COLVAR.list | wc -l`
           if [ $iscol -gt 0 ] ; then
                fname=`grep PLUMED_REGISTER_ACTION ../src/*.cpp | grep $flag | sed -e 's/:/ /g' | awk '{print $1}'`
-               hasmod=`grep ColvarWithModifiers $fname | wc -l | awk '{print $1}'` 
+               hasmod=`grep MultiColvar $fname | wc -l | awk '{print $1}'` 
                if [ $hasmod -gt 0 ] ; then
                     cat modifier_file
                fi
@@ -116,28 +129,44 @@ cat $file.txt |
   do
   if [ "$LINE" = "@COLVAR@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/COLVAR.list
+    echo "</table>"
   elif [ "$LINE" = "@ANALYSIS@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/ANALYSIS.list
+    echo "</table>"
   elif [ "$LINE" = "@BIAS@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/BIAS.list
+    echo "</table>"
   elif [ "$LINE" = "@FUNCTION@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/FUNCTION.list
+    echo "</table>"
   elif [ "$LINE" = "@TOPOLOGY@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/TOPOLOGY.list
+    echo "</table>"
   elif [ "$LINE" = "@VATOM@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/VATOM.list
+    echo "</table>"
   elif [ "$LINE" = "@TOOLS@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/TOOLS.list
+    echo "</table>" 
   elif [ "$LINE" = "@CODES@" ]
   then
+    echo "<table align=center frame=void width=95%% cellpadding=5%%>"
     cat automatic/codes.list
+    echo "</table>"
   else
     echo -E "$LINE"
   fi
-- 
GitLab