Added diff pretty print in the commit.
This commit is contained in:
parent
99a2e2b83f
commit
5c32145e13
@ -115,6 +115,13 @@ class IDF_Diff
|
|||||||
{
|
{
|
||||||
$out = '';
|
$out = '';
|
||||||
foreach ($this->files as $filename=>$file) {
|
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 .= "\n".'<table class="diff" summary="">'."\n";
|
||||||
$out .= '<tr id="diff-'.md5($filename).'"><th colspan="3">'.Pluf_esc($filename).'</th></tr>'."\n";
|
$out .= '<tr id="diff-'.md5($filename).'"><th colspan="3">'.Pluf_esc($filename).'</th></tr>'."\n";
|
||||||
$cc = 1;
|
$cc = 1;
|
||||||
@ -128,7 +135,7 @@ class IDF_Diff
|
|||||||
$class = 'diff-a';
|
$class = 'diff-a';
|
||||||
}
|
}
|
||||||
$line_content = self::padLine(Pluf_esc($line[2]));
|
$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)
|
if (count($file['chunks']) > $cc)
|
||||||
$out .= '<tr class="diff-next"><td>...</td><td>...</td><td> </td></tr>'."\n";
|
$out .= '<tr class="diff-next"><td>...</td><td>...</td><td> </td></tr>'."\n";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{extends "source/base.html"}
|
{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 docclass}yui-t1{assign $inCommit=true}{/block}
|
||||||
{block body}
|
{block body}
|
||||||
<table class="commit" summary="">
|
<table class="commit" summary="">
|
||||||
@ -43,3 +44,9 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/block}
|
{/block}
|
||||||
|
|
||||||
|
{block javascript}
|
||||||
|
<script type="text/javascript" src="{media '/idf/js/prettify.js'}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
prettyPrint();
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
|
Loading…
Reference in New Issue
Block a user