Added diff pretty print in the commit.

dev
Nicolas Lassalle 2008-11-15 21:10:37 +01:00 committed by Loic d'Anterroches
parent 99a2e2b83f
commit 5c32145e13
2 changed files with 15 additions and 1 deletions

View File

@ -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 = '<pre class="prettyprint">';
$closePre = '</pre>';
}
$out .= "\n".'<table class="diff" summary="">'."\n";
$out .= '<tr id="diff-'.md5($filename).'"><th colspan="3">'.Pluf_esc($filename).'</th></tr>'."\n";
$cc = 1;
@ -128,7 +135,7 @@ class IDF_Diff
$class = 'diff-a';
}
$line_content = self::padLine(Pluf_esc($line[2]));
$out .= sprintf('<tr class="diff-line"><td class="diff-lc">%s</td><td class="diff-lc">%s</td><td class="%s mono">%s</td></tr>'."\n", $line[0], $line[1], $class, $line_content);
$out .= sprintf('<tr class="diff-line"><td class="diff-lc">%s</td><td class="diff-lc">%s</td><td class="%s mono">%s%s%s</td></tr>'."\n", $line[0], $line[1], $class, $openPre, $line_content, $closePre);
}
if (count($file['chunks']) > $cc)
$out .= '<tr class="diff-next"><td>...</td><td>...</td><td>&nbsp;</td></tr>'."\n";

View File

@ -1,4 +1,5 @@
{extends "source/base.html"}
{block extraheader}<link rel="stylesheet" type="text/css" href="{media '/idf/css/prettify.css'}" />{/block}
{block docclass}yui-t1{assign $inCommit=true}{/block}
{block body}
<table class="commit" summary="">
@ -43,3 +44,9 @@
{/if}
{/block}
{block javascript}
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
<script type="text/javascript">
prettyPrint();
</script>
{/block}