$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: nickm_at_[hidden]
Date: 2007-09-18 13:16:31
Author: nikiml
Date: 2007-09-18 13:16:31 EDT (Tue, 18 Sep 2007)
New Revision: 39368
URL: http://svn.boost.org/trac/boost/changeset/39368
Log:
epydoc friendlier formatting
Text files modified: 
   trunk/libs/python/src/object/function.cpp               |    10 ++++----                                
   trunk/libs/python/src/object/function_doc_signature.cpp |    43 ++++++++++++++++++++++++++++----------- 
   2 files changed, 36 insertions(+), 17 deletions(-)
Modified: trunk/libs/python/src/object/function.cpp
==============================================================================
--- trunk/libs/python/src/object/function.cpp	(original)
+++ trunk/libs/python/src/object/function.cpp	2007-09-18 13:16:31 EDT (Tue, 18 Sep 2007)
@@ -543,10 +543,10 @@
 
     if (docstring_options::show_cpp_signatures_)
     {
-        if(len(_doc))
-            _doc += "\n    "+str(reinterpret_cast<const char*>(detail::cpp_signature_tag));
-        else
-            _doc += "    "+str(reinterpret_cast<const char*>(detail::cpp_signature_tag));
+//        if(len(_doc))
+//            _doc += "\n"+str(reinterpret_cast<const char*>(detail::cpp_signature_tag));
+//        else
+            _doc += str(reinterpret_cast<const char*>(detail::cpp_signature_tag));
     }
     if(_doc)
     {    
@@ -630,7 +630,7 @@
         list signatures = function_doc_signature_generator::function_doc_signatures(f);
         if(!signatures) return python::detail::none();
         signatures.reverse();
-        return python::incref( str("\n   ").join(signatures).ptr());
+        return python::incref( str("\n").join(signatures).ptr());
     }
     
     static int function_set_doc(PyObject* op, PyObject* doc, void*)
Modified: trunk/libs/python/src/object/function_doc_signature.cpp
==============================================================================
--- trunk/libs/python/src/object/function_doc_signature.cpp	(original)
+++ trunk/libs/python/src/object/function_doc_signature.cpp	2007-09-18 13:16:31 EDT (Tue, 18 Sep 2007)
@@ -264,8 +264,8 @@
     }
 
     namespace detail {    
-        char py_signature_tag[] = "PY signature : ";
-        char cpp_signature_tag[] = "C++ signature:";
+        char py_signature_tag[] = "PY signature :";
+        char cpp_signature_tag[] = "C++ signature :";
     }
 
     list function_doc_signature_generator::function_doc_signatures( function const * f)
@@ -280,24 +280,43 @@
             if(*sfi == *fi){
                 if((*fi)->doc()){
                     str func_doc = str((*fi)->doc());
-                    int doc_len = len(func_doc);			
+                    int doc_len = len(func_doc);
                     bool show_py_signature = doc_len >=int(sizeof(detail::py_signature_tag)/sizeof(char)-1)
                                             && str(detail::py_signature_tag)==func_doc.slice(0, int(sizeof(detail::py_signature_tag)/sizeof(char))-1);
-                    bool show_cpp_signature = doc_len >=int(sizeof(detail::cpp_signature_tag)/sizeof(char))
+					if(show_py_signature){
+						func_doc = str(func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1, _));
+						doc_len = len(func_doc);
+					}
+					
+                    bool show_cpp_signature = doc_len >=int(sizeof(detail::cpp_signature_tag)/sizeof(char)-1)
                                             && str(detail::cpp_signature_tag)==func_doc.slice(- int(sizeof(detail::cpp_signature_tag)/sizeof(char))+1, _);
                     
-                    str res;
+					if(show_cpp_signature){
+						func_doc = str(func_doc.slice(_, 1 - int(sizeof(detail::cpp_signature_tag)/sizeof(char))));
+						doc_len = len(func_doc);
+					}
+					
+                    str res="\n";
+					str pad = "\n";
                     if(show_py_signature)
                     { 
                         str sig = pretty_signature(*fi, n_overloads,false);
                         res+=sig;
-			if(doc_len > int(sizeof(detail::py_signature_tag)/sizeof(char))-1 )
-                            res+=" : "+func_doc.slice(int(sizeof(detail::py_signature_tag)/sizeof(char))-1,_);
-                    }else
-                        res+=func_doc;
-
-                    if( show_cpp_signature)
-                        res+=str("\n        ")+pretty_signature(*fi, n_overloads,true);
+						if(doc_len || show_cpp_signature )res+=" :";
+						pad+= str("    ");
+                    }
+					
+					if(doc_len){
+						if(show_py_signature)
+							res+=pad;
+	                     res+= pad.join(func_doc.split("\n"));
+					}
+
+                    if( show_cpp_signature){
+						if(len(res)>1)
+							res+="\n"+pad;
+                        res+=detail::cpp_signature_tag+pad+"    "+pretty_signature(*fi, n_overloads,true);
+					}
                     
                     signatures.append(res);
                 }