nlopess Tue Apr 13 10:39:47 2004 EDT
Modified files:
/livedocs style_mapping.php
Log:
hack to highlight code in PHP > 5.0.0 RC 1
http://cvs.php.net/diff.php/livedocs/style_mapping.php?r1=1.4&r2=1.5&ty=u
Index: livedocs/style_mapping.php
diff -u livedocs/style_mapping.php:1.4 livedocs/style_mapping.php:1.5
--- livedocs/style_mapping.php:1.4 Fri Mar 12 13:08:20 2004
+++ livedocs/style_mapping.php Tue Apr 13 10:39:47 2004
@@ -18,7 +18,7 @@
// | Helper functions for formatting elements |
// +----------------------------------------------------------------------+
//
-// $Id: style_mapping.php,v 1.4 2004/03/12 18:08:20 didou Exp $
+// $Id: style_mapping.php,v 1.5 2004/04/13 14:39:47 nlopess Exp $
// almost XPATH.. ;-)
$map = array(
@@ -276,17 +276,34 @@
switch ($node->attributes['role']) {
case 'php':
- $content = preg_replace(array(
- '@<br />@',
- '@<font color="([^"]+)">@',
- '@</font>@',
- ),
- array(
- "<br />\n",
- '<span class="\\1">',
- '</span>',
- ),
- highlight_string($content, 1));
+
+// 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){
+ $content = preg_replace(array(
+ '@<br />@',
+ '@<span style="color: ([^"]+)">@',
+ '@</span>@',
+ ),
+ array(
+ "<br />\n",
+ '<span class="\\1">',
+ '</span>',
+ ),
+ highlight_string($content, 1));
+ } else {
+ $content = preg_replace(array(
+ '@<br />@',
+ '@<font color="([^"]+)">@',
+ '@</font>@',
+ ),
+ array(
+ "<br />\n",
+ '<span class="\\1">',
+ '</span>',
+ ),
+ highlight_string($content, 1));
+ }
break;
case 'shell':
case 'html':