bjori           Tue Jan 30 18:30:29 2007 UTC

  Modified files:              
    /phpdoc/scripts     html_syntax.php 
  Log:
  Catch phpweb-xsl markup too
  
  
http://cvs.php.net/viewvc.cgi/phpdoc/scripts/html_syntax.php?r1=1.6&r2=1.7&diff_format=u
Index: phpdoc/scripts/html_syntax.php
diff -u phpdoc/scripts/html_syntax.php:1.6 phpdoc/scripts/html_syntax.php:1.7
--- phpdoc/scripts/html_syntax.php:1.6  Thu Jan  1 00:35:41 2004
+++ phpdoc/scripts/html_syntax.php      Tue Jan 30 18:30:29 2007
@@ -31,7 +31,7 @@
 }
 
 function callback_highlight_php($matches) {
-       $with_tags = preg_replace_callback("!&#([0-9]+);!", 
"callback_html_number_entities_decode", $matches[1]);
+       $with_tags = preg_replace_callback("!&#([0-9]+);!", 
"callback_html_number_entities_decode", trim($matches[1]));
        if ($GLOBALS["TYPE"] == "php") {
                return "\n<?php\nhighlight_php('". addcslashes($with_tags, 
"'\\") ."');\n?>\n";
        } else { // "html"
@@ -58,6 +58,7 @@
                //~ echo "$filename\n";
                $original = file_get_contents($filename);
                $highlighted = 
preg_replace_callback("!<PRE\r?\nCLASS=\"php\"\r?\n>(.*)</PRE\r?\n>!sU", 
"callback_highlight_php", $original);
+               $highlighted = preg_replace_callback("!<pre 
class=\"php\">(.*)</pre>!sU", "callback_highlight_php", $highlighted); /* XSL 
build */
                if ($original != $highlighted) {
                        // file_put_contents is only in PHP >= 5
                        $fp = fopen($filename, "wb");

Reply via email to