wez             Sat May  1 04:39:08 2004 EDT

  Modified files:              
    /livedocs   livedoc.php xml_classes.php 
  Log:
  make links to eg: class.com work in the see also section
  
http://cvs.php.net/diff.php/livedocs/livedoc.php?r1=1.93&r2=1.94&ty=u
Index: livedocs/livedoc.php
diff -u livedocs/livedoc.php:1.93 livedocs/livedoc.php:1.94
--- livedocs/livedoc.php:1.93   Tue Apr 27 10:07:11 2004
+++ livedocs/livedoc.php        Sat May  1 04:39:08 2004
@@ -18,7 +18,7 @@
 // | Generate an HTML version of a phpdoc/docbook page on the fly         |
 // +----------------------------------------------------------------------+
 //
-// $Id: livedoc.php,v 1.93 2004/04/27 14:07:11 nlopess Exp $
+// $Id: livedoc.php,v 1.94 2004/05/01 08:39:08 wez Exp $
 
 define('LIVEDOC_SOURCE', dirname(__FILE__));
 include LIVEDOC_SOURCE . '/common.php';
@@ -454,21 +454,42 @@
        return null;
 }
 
+/* transform an entity name of the form "reference.XXXX.functions.ID"
+ * and generate a link to its node using its title */
 function make_function_link($ref) 
 {
        $parts = explode('.', $ref);
-       $id = 'function.'. $parts[3];
+
+       $stag = 'function';
+       $etag = 'function';
+
+       if (count($parts) == 4) {
+               $id = 'function.' . $parts[3];
+               $func_name = strtr($parts[3], array('-'=>'_'));
+       } elseif ($parts[3] == 'class' && count($parts) == 5) {
+               $id = 'class.' . $parts[4];
+               $func_name = strtr($parts[4], array('-'=>'_'));
+               $stag = "xref linkend=\"$id\"";
+               $etag = "xref";
+       } else {
+               /* some weird node type we don't understand */
+               $id = $ref;
+               $func_name = 'Unknown ??';
+       }
+       
        $title = lookup_title($id);
        if (!$title) {
-               $title = $id. ' [?]';
+               $title = $ref . ' [?]';
        }
-       $func_name = strtr($parts[3], array('-'=>'_'));
+
        if ($title == $func_name) {
                $title = "";
+       } elseif ($parts[3] == 'class') {
+               $title = " - $title class";
        } else {
                $title = " - $title";
        }
-       return "<div 
class=\"function_link\"><function>$func_name</function>$title</div>";
+       return "<div class=\"function_link\"><$stag>$func_name</$etag>$title</div>";
 }
 
 function make_xref($ref) 
http://cvs.php.net/diff.php/livedocs/xml_classes.php?r1=1.4&r2=1.5&ty=u
Index: livedocs/xml_classes.php
diff -u livedocs/xml_classes.php:1.4 livedocs/xml_classes.php:1.5
--- livedocs/xml_classes.php:1.4        Fri Mar 12 05:18:31 2004
+++ livedocs/xml_classes.php    Sat May  1 04:39:08 2004
@@ -18,7 +18,7 @@
 // | Two XML handling classes for the docbook to html transformation      |
 // +----------------------------------------------------------------------+
 //
-// $Id: xml_classes.php,v 1.4 2004/03/12 10:18:31 didou Exp $
+// $Id: xml_classes.php,v 1.5 2004/05/01 08:39:08 wez Exp $
 
 class Node { /* {{{ */
 
@@ -295,7 +295,7 @@
                        }
                        $xml .= '</' . $node->tagname . '>';
                }
-               return $xml . "<!-- $node->nodeid -->";
+               return $xml . "<!-- {$node->nodeid} -->";
        }
 
        function start_elem($parser, $tagname, $attributes) 

Reply via email to