diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index 20f7f33..8e91a68 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -115,12 +115,10 @@ class IDF_Diff { $out = ''; foreach ($this->files as $filename=>$file) { - $openPre = ''; - $closePre = ''; + $pretty = ''; $fileinfo = IDF_Views_Source::getMimeType($filename); if (IDF_Views_Source::isSupportedExtension($fileinfo[2])) { - $openPre = '
';
-                $closePre = '
'; + $pretty = ' prettyprint'; } $out .= "\n".''."\n"; $out .= ''."\n"; @@ -135,7 +133,7 @@ class IDF_Diff $class = 'diff-a'; } $line_content = self::padLine(Pluf_esc($line[2])); - $out .= sprintf(''."\n", $line[0], $line[1], $class, $openPre, $line_content, $closePre); + $out .= sprintf(''."\n", $line[0], $line[1], $class, $pretty, $line_content); } if (count($file['chunks']) > $cc) $out .= ''."\n"; diff --git a/src/IDF/Views/Source.php b/src/IDF/Views/Source.php index 3c9775b..1e228dd 100644 --- a/src/IDF/Views/Source.php +++ b/src/IDF/Views/Source.php @@ -384,17 +384,15 @@ class IDF_Views_Source public static function highLight($fileinfo, $content) { - $openPre = ''; - $closePre = ''; + $pretty = ''; if (IDF_Views_Source::isSupportedExtension($fileinfo[2])) { - $openPre = '
';
-            $closePre = '
'; + $pretty = ' prettyprint'; } $table = array(); $i = 1; foreach (preg_split("/\015\012|\015|\012/", $content) as $line) { $table[] = '' - .''; + .''; $i++; } return Pluf_Template::markSafe(implode("\n", $table)); diff --git a/www/media/idf/js/prettify.js b/www/media/idf/js/prettify.js index 6a18f43..05e6818 100644 --- a/www/media/idf/js/prettify.js +++ b/www/media/idf/js/prettify.js @@ -31,7 +31,8 @@ * 1) include this source file in an html page via * * 2) define style rules. See the example page for examples. - * 3) mark the
 and  tags in your source with class=prettyprint.
+ * 3) mark the 
'.Pluf_esc($filename).'
%s%s%s%s%s
%s%s%s
...... 
'.$i.''.$openPre.IDF_Diff::padLine(Pluf_esc($line)).$closePre.'
'.IDF_Diff::padLine(Pluf_esc($line)).'
,
 and  tags in your source 
+ *    with class=prettyprint.
  *    You can also use the (html deprecated)  tag, but the pretty printer
  *    needs to do more substantial DOM manipulations to support that, so some
  *    css styles may not be preserved.
@@ -1273,6 +1274,7 @@ function prettyPrint() {
   var codeSegments = [
       document.getElementsByTagName('pre'),
       document.getElementsByTagName('code'),
+      document.getElementsByTagName('td'),
       document.getElementsByTagName('xmp') ];
   var elements = [];
   for (var i = 0; i < codeSegments.length; ++i) {