didou           Sun Apr 18 10:34:11 2004 EDT

  Modified files:              
    /livedocs   style_mapping.php 
  Log:
  fix classsynopsis rendering 
  # check index.php?l=en&q=function.mysqli-autocommit before applying this patch and 
after
  
http://cvs.php.net/diff.php/livedocs/style_mapping.php?r1=1.5&r2=1.6&ty=u
Index: livedocs/style_mapping.php
diff -u livedocs/style_mapping.php:1.5 livedocs/style_mapping.php:1.6
--- livedocs/style_mapping.php:1.5      Tue Apr 13 10:39:47 2004
+++ livedocs/style_mapping.php  Sun Apr 18 10:34:11 2004
@@ -18,7 +18,7 @@
 // | Helper functions for formatting elements                             |
 // +----------------------------------------------------------------------+
 //
-// $Id: style_mapping.php,v 1.5 2004/04/13 14:39:47 nlopess Exp $
+// $Id: style_mapping.php,v 1.6 2004/04/18 14:34:11 didou Exp $
 
 // almost XPATH.. ;-)
 $map = array(
@@ -332,6 +332,9 @@
        /* build up prototype */
        $type = $node->children[0]->content;
        $fname = $node->children[1]->content;
+       if (!strlen(trim($fname))) { // it's a class
+               $fname = $node->children[3]->content;
+       }
        $params = "";
        $optclose = "";
        
@@ -343,7 +346,7 @@
                }
        
                $p = '';
-               if (strlen($params)) {
+               if (strlen(trim(strip_tags($params)))) {
                        $p .= ',';
                }
                
@@ -359,17 +362,25 @@
                        $p .= ' ';
                }
 
-               $p .= '<span class="methodparam"><span class="type">' . 
$k->children[0]->content . '</span>';
+               if (isset($k->children[0])) {
+                       $p .= '<span class="methodparam"><span class="type">' . 
$k->children[0]->content . '</span>';
+               }
 
-               $name = $k->children[1]->content;
+               if (isset($k->children[1])) {
+                       $name = $k->children[1]->content;
+               } else {
+                       $name = '';
+               }
                switch ($role) {
                        case 'c':
                                break;
                        default:
                                if ($name && $name{0} == '&') {
                                        $name = '&$' . substr($name, 1);
-                               } else {
+                               } elseif(trim($name) != '') {
                                        $name = '$' . $name;
+                               } else {
+                                       $name = '';
                                }
                }
 
@@ -378,6 +389,7 @@
                $params .= $p;
        }
 
+
        return "<div class=\"methodsynopsis\"><span class=\"type\">$type</span> <span 
class=\"function\">$fname(</span>$params$optclose<span 
class=\"function\">)</span></div>";
 }
 
@@ -385,6 +397,7 @@
 {
        $classname = $node->children[0]->children[0]->content;
 
+
        $head = "<div class=\"classsynopsis\">class <span 
class=\"classname\">$classname</span> {\n<div class=\"classcontents\">";
        $foot = "</div>}\n</div>";
        $body = "";

Reply via email to