@@ -264,8 +264,8 @@ namespace boost { namespace python { namespace objects {
264264 }
265265
266266 namespace detail {
267- char py_signature_tag[] = " PY signature : " ;
268- char cpp_signature_tag[] = " C++ signature:" ;
267+ char py_signature_tag[] = " PY signature :" ;
268+ char cpp_signature_tag[] = " C++ signature :" ;
269269 }
270270
271271 list function_doc_signature_generator::function_doc_signatures ( function const * f)
@@ -280,24 +280,43 @@ namespace boost { namespace python { namespace objects {
280280 if (*sfi == *fi){
281281 if ((*fi)->doc ()){
282282 str func_doc = str ((*fi)->doc ());
283- int doc_len = len (func_doc);
283+ int doc_len = len (func_doc);
284284 bool show_py_signature = doc_len >=int (sizeof (detail::py_signature_tag)/sizeof (char )-1 )
285285 && str (detail::py_signature_tag)==func_doc.slice (0 , int (sizeof (detail::py_signature_tag)/sizeof (char ))-1 );
286- bool show_cpp_signature = doc_len >=int (sizeof (detail::cpp_signature_tag)/sizeof (char ))
286+ if (show_py_signature){
287+ func_doc = str (func_doc.slice (int (sizeof (detail::py_signature_tag)/sizeof (char ))-1 , _));
288+ doc_len = len (func_doc);
289+ }
290+
291+ bool show_cpp_signature = doc_len >=int (sizeof (detail::cpp_signature_tag)/sizeof (char )-1 )
287292 && str (detail::cpp_signature_tag)==func_doc.slice (- int (sizeof (detail::cpp_signature_tag)/sizeof (char ))+1 , _);
288293
289- str res;
294+ if (show_cpp_signature){
295+ func_doc = str (func_doc.slice (_, 1 - int (sizeof (detail::cpp_signature_tag)/sizeof (char ))));
296+ doc_len = len (func_doc);
297+ }
298+
299+ str res=" \n " ;
300+ str pad = " \n " ;
290301 if (show_py_signature)
291302 {
292303 str sig = pretty_signature (*fi, n_overloads,false );
293304 res+=sig;
294- if (doc_len > int (sizeof (detail::py_signature_tag)/sizeof (char ))-1 )
295- res+=" : " +func_doc.slice (int (sizeof (detail::py_signature_tag)/sizeof (char ))-1 ,_);
296- }else
297- res+=func_doc;
298-
299- if ( show_cpp_signature)
300- res+=str (" \n " )+pretty_signature (*fi, n_overloads,true );
305+ if (doc_len || show_cpp_signature )res+=" :" ;
306+ pad+= str (" " );
307+ }
308+
309+ if (doc_len){
310+ if (show_py_signature)
311+ res+=pad;
312+ res+= pad.join (func_doc.split (" \n " ));
313+ }
314+
315+ if ( show_cpp_signature){
316+ if (len (res)>1 )
317+ res+=" \n " +pad;
318+ res+=detail::cpp_signature_tag+pad+" " +pretty_signature (*fi, n_overloads,true );
319+ }
301320
302321 signatures.append (res);
303322 }
0 commit comments