Indefero

Indefero Commit Details


Date:2008-11-15 14:23:29 (16 years 1 month ago)
Author:Loic d'Anterroches
Branch:dev, develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:7ca43e0ec2514a8878d544bc36290ec0d135123c
Parents: 5c32145e13f653beb28c851a9a9ea1002b9059e2
Message:Updated the pretty print not to need extra <pre></pre>.

Changes:

File differences

src/IDF/Diff.php
115115
116116
117117
118
119
118
120119
121120
122
123
121
124122
125123
126124
......
135133
136134
137135
138
136
139137
140138
141139
{
$out = '';
foreach ($this->files as $filename=>$file) {
$openPre = '';
$closePre = '';
$pretty = '';
$fileinfo = IDF_Views_Source::getMimeType($filename);
if (IDF_Views_Source::isSupportedExtension($fileinfo[2])) {
$openPre = '<pre class="prettyprint">';
$closePre = '</pre>';
$pretty = ' prettyprint';
}
$out .= "\n".'<table class="diff" summary="">'."\n";
$out .= '<tr id="diff-'.md5($filename).'"><th colspan="3">'.Pluf_esc($filename).'</th></tr>'."\n";
$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%s%s</td></tr>'."\n", $line[0], $line[1], $class, $openPre, $line_content, $closePre);
$out .= sprintf('<tr class="diff-line"><td class="diff-lc">%s</td><td class="diff-lc">%s</td><td class="%s%s mono">%s</td></tr>'."\n", $line[0], $line[1], $class, $pretty, $line_content);
}
if (count($file['chunks']) > $cc)
$out .= '<tr class="diff-next"><td>...</td><td>...</td><td>&nbsp;</td></tr>'."\n";
src/IDF/Views/Source.php
384384
385385
386386
387
388
387
389388
390
391
389
392390
393391
394392
395393
396394
397
395
398396
399397
400398
public static function highLight($fileinfo, $content)
{
$openPre = '';
$closePre = '';
$pretty = '';
if (IDF_Views_Source::isSupportedExtension($fileinfo[2])) {
$openPre = '<pre class="prettyprint">';
$closePre = '</pre>';
$pretty = ' prettyprint';
}
$table = array();
$i = 1;
foreach (preg_split("/\015\012|\015|\012/", $content) as $line) {
$table[] = '<tr class="c-line"><td class="code-lc" id="L'.$i.'"><a href="#L'.$i.'">'.$i.'</a></td>'
.'<td class="code mono">'.$openPre.IDF_Diff::padLine(Pluf_esc($line)).$closePre.'</td></tr>';
.'<td class="code mono'.$pretty.'">'.IDF_Diff::padLine(Pluf_esc($line)).'</td></tr>';
$i++;
}
return Pluf_Template::markSafe(implode("\n", $table));
www/media/idf/js/prettify.js
3131
3232
3333
34
34
35
3536
3637
3738
......
12731274
12741275
12751276
1277
12761278
12771279
12781280
* 1) include this source file in an html page via
* <script type="text/javascript" src="/path/to/prettify.js"></script>
* 2) define style rules. See the example page for examples.
* 3) mark the <pre> and <code> tags in your source with class=prettyprint.
* 3) mark the <td>, <pre> and <code> tags in your source
* with class=prettyprint.
* You can also use the (html deprecated) <xmp> tag, but the pretty printer
* needs to do more substantial DOM manipulations to support that, so some
* css styles may not be preserved.
var codeSegments = [
document.getElementsByTagName('pre'),
document.getElementsByTagName('code'),
document.getElementsByTagName('td'),
document.getElementsByTagName('xmp') ];
var elements = [];
for (var i = 0; i < codeSegments.length; ++i) {

Archive Download the corresponding diff file

Page rendered in 0.08498s using 13 queries.