nlopess         Wed Apr 28 12:45:33 2004 EDT

  Modified files:              
    /livedocs   style_mapping.php 
  Log:
  fix the display of version info and better hack for highliting php code
  #didou: in fact this was easy to solve: Ive just changed the version information 
function from refname to refpurpose. just a small hacl :)
  
http://cvs.php.net/diff.php/livedocs/style_mapping.php?r1=1.8&r2=1.9&ty=u
Index: livedocs/style_mapping.php
diff -u livedocs/style_mapping.php:1.8 livedocs/style_mapping.php:1.9
--- livedocs/style_mapping.php:1.8      Sun Apr 18 12:12:02 2004
+++ livedocs/style_mapping.php  Wed Apr 28 12:45:33 2004
@@ -18,7 +18,7 @@
 // | Helper functions for formatting elements                             |
 // +----------------------------------------------------------------------+
 //
-// $Id: style_mapping.php,v 1.8 2004/04/18 16:12:02 nlopess Exp $
+// $Id: style_mapping.php,v 1.9 2004/04/28 16:45:33 nlopess Exp $
 
 // almost XPATH.. ;-)
 $map = array(
@@ -70,8 +70,8 @@
        'proptype'              => 'span',
        'pubdate'               => 'format_pubdate',
        'reference/title'       => 'h1',
-       'refnamediv/refname'    => 'format_refname',
-       'refnamediv/refpurpose' => 'h2',
+       'refnamediv/refname'    => 'h1',
+       'refnamediv/refpurpose' => 'format_refpurpose',
        'refsect1/title'        => 'h3',
        'refsect2/title'        => 'h4',
        'replaceable'           => 'span',
@@ -153,13 +153,13 @@
        return sprintf('<div class="copyright">Copyright &copy; %s by %s</div>', 
implode(", ", $y), $holder);
 }
 
-function format_refname($node) 
+function format_refpurpose($node) 
 {
        global $current_page, $idx, $print_version;
 
        $vers = '';
 
-       if (substr($current_page, 0, 9) == 'function.' && !isset($print_version)) {
+       if (substr($current_page, 0, 9) == 'function.') {
                $func_name = sqlite_escape_string(strtr(substr($current_page, 9), '-', 
'_'));
                $q = sqlite_query($idx, "SELECT versinfo FROM funcs where 
funcname='$func_name'");
                if ($q && $r = sqlite_fetch_array($q, SQLITE_NUM)) {
@@ -167,10 +167,9 @@
                } else {
                        $vers = '<div class="versinfo">no version information, might 
be only in CVS</div>';
                }
-               $print_version = 1;
        }
-       
-       return sprintf('<h1 class="%s">%s</h1>%s', $node->tagname, $node->content, 
$vers);
+
+       return sprintf('%s<h2 class="refpurpose">%s</h2>', $vers, $node->content);
 }
 
 function format_name($node) 
@@ -281,12 +280,11 @@
                case 'php':
 
 // Small hack because highlight_string has changed its behaviour in PHP 5 RC1
-                       $compare = version_compare(phpversion(), '5.0.0RC1');
-                       if ($compare == 1 || $compare == 0){
+                       if (version_compare(phpversion(), '5.0.0RC1') == -1){
                                $content = preg_replace(array(
                                        '@<br />@',
-                                       '@<span style="color: ([^"]+)">@',
-                                       '@</span>@',
+                                       '@<font color="([^"]+)">@',
+                                       '@</font>@',
                                        ),
                                        array(
                                        "<br />\n",
@@ -297,8 +295,8 @@
                        } else {
                                $content = preg_replace(array(
                                        '@<br />@',
-                                       '@<font color="([^"]+)">@',
-                                       '@</font>@',
+                                       '@<span style="color: ([^"]+)">@',
+                                       '@</span>@',
                                        ),
                                        array(
                                        "<br />\n",

Reply via email to