index.jsView |
---|
1346 | 1346 | var s = line[0] |
1347 | 1347 | if (s == '\\') return |
1348 | 1348 | var html = escapeHTML(line) |
1349 | 1349 | var trClass = s == '+' ? 'diff-new' : s == '-' ? 'diff-old' : '' |
1350 | | - return '<tr' + (trClass ? ' class="' + trClass + '"' : '') + '>' + |
1351 | | - '<td class="diff-linenum">' + (s == '+' ? '' : oldLine++) + '</td>' + |
1352 | | - '<td class="diff-linenum">' + (s == '-' ? '' : newLine++) + '</td>' + |
| 1350 | + var lineNums = [s == '+' ? '' : oldLine++, s == '-' ? '' : newLine++] |
| 1351 | + var id = [filename].concat(lineNums).join('-') |
| 1352 | + return '<tr id="' + escapeHTML(id) + '" class="' + trClass + '">' + |
| 1353 | + lineNums.map(function (num) { |
| 1354 | + return '<td class="diff-linenum">' + |
| 1355 | + (num ? '<a href="#' + encodeURIComponent(id) + '">' + |
| 1356 | + num + '</a>' : '') + '</td>' |
| 1357 | + }).join('') + |
1353 | 1358 | '<td class="diff-text">' + html + '</td></tr>' |
1354 | 1359 | })) |
1355 | 1360 | }) |
1356 | 1361 | return '<pre><table class="diff">' + |