> > > BTW2: Anyone feel like tweaking the code highlighting so that
> > > function names are turned into links to the manual pages?
> >
> > There is a user note in highlight_string() that has the code. It is
simple
> > to implement (but I can't do that, I have no karma...)
>
> You can submit a patch.
>
> --Wez.


Here is my patch to style_mapping.php.
It has a bug: doesn't work with OO yet. For example:
$object->xxx() or $static::static()

Apart of that bug, which I'll solve latter (maybe tomorrow), this works
great!

Nuno
Index: style_mapping.php
===================================================================
RCS file: /repository/livedocs/style_mapping.php,v
retrieving revision 1.11
diff -u -r1.11 style_mapping.php
--- style_mapping.php   1 May 2004 11:34:50 -0000       1.11
+++ style_mapping.php   5 May 2004 18:27:28 -0000
@@ -270,6 +270,17 @@
                );
 }
 
+
+/* Callback to link highlighted function to the manual */
+function function_callback($matches) {
+       global $lang, $FORCE_DYNAMIC, $WEBBASE;
+
+       $link = strtr($matches[1], array('_' => '-'));
+       $link = WEBBASE . (FORCE_DYNAMIC ? "?l=$lang&q=function.$link" : 
"$lang/function.$link.html");
+
+       return '<a class="phpfunc" target="_blank" title="'.$matches[1].'" 
href="'.$link.'">'.$matches[1].'</a>(';
+}
+
 function format_listing($node) 
 {
        $content = trim($node->content);
@@ -310,6 +321,8 @@
                                        ),
                                        highlight_string($content, 1));
                        }
+                       $content = 
preg_replace_callback('{([\w_]+)(\s*</span>)(\s*<span\s+class="keyword">\s*\()}m', 
'function_callback', $content);
+
                        break;
                case 'shell':
                case 'html':

Reply via email to