From 5c32145e13f653beb28c851a9a9ea1002b9059e2 Mon Sep 17 00:00:00 2001 From: Nicolas Lassalle Date: Sat, 15 Nov 2008 21:10:37 +0100 Subject: [PATCH] Added diff pretty print in the commit. --- src/IDF/Diff.php | 9 ++++++++- src/IDF/templates/source/commit.html | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/IDF/Diff.php b/src/IDF/Diff.php index b1073b5..20f7f33 100644 --- a/src/IDF/Diff.php +++ b/src/IDF/Diff.php @@ -115,6 +115,13 @@ class IDF_Diff { $out = ''; foreach ($this->files as $filename=>$file) { + $openPre = ''; + $closePre = ''; + $fileinfo = IDF_Views_Source::getMimeType($filename); + if (IDF_Views_Source::isSupportedExtension($fileinfo[2])) { + $openPre = '
';
+                $closePre = '
'; + } $out .= "\n".''."\n"; $out .= ''."\n"; $cc = 1; @@ -128,7 +135,7 @@ class IDF_Diff $class = 'diff-a'; } $line_content = self::padLine(Pluf_esc($line[2])); - $out .= sprintf(''."\n", $line[0], $line[1], $class, $line_content); + $out .= sprintf(''."\n", $line[0], $line[1], $class, $openPre, $line_content, $closePre); } if (count($file['chunks']) > $cc) $out .= ''."\n"; diff --git a/src/IDF/templates/source/commit.html b/src/IDF/templates/source/commit.html index 1f8c036..2f01d4d 100644 --- a/src/IDF/templates/source/commit.html +++ b/src/IDF/templates/source/commit.html @@ -1,4 +1,5 @@ {extends "source/base.html"} +{block extraheader}{/block} {block docclass}yui-t1{assign $inCommit=true}{/block} {block body}
'.Pluf_esc($filename).'
%s%s%s
%s%s%s%s%s
...... 
@@ -43,3 +44,9 @@ {/if} {/block} +{block javascript} + + +{/block}