updated octopress.js to get new gist line number fix

This commit is contained in:
Brandon Mathis 2012-06-05 00:35:43 -05:00
parent 1c8a4de58e
commit 76b9e3f19a

View File

@ -40,17 +40,17 @@ function addSidebarToggler() {
function addCodeLineNumbers() { function addCodeLineNumbers() {
if (navigator.appName === 'Microsoft Internet Explorer') { return; } if (navigator.appName === 'Microsoft Internet Explorer') { return; }
$('div.gist-highlight').each(function(code) { $('div.gist-highlight').each(function(index) {
var tableStart = '<table><tbody><tr><td class="gutter">', var tableStart = '<table><tbody><tr><td class="gutter">',
lineNumbers = '<pre class="line-numbers">', lineNumbers = '<pre class="line-numbers">',
tableMiddle = '</pre></td><td class="code">', tableMiddle = '</pre></td><td class="code">',
tableEnd = '</td></tr></tbody></table>', tableEnd = '</td></tr></tbody></table>',
count = $('.line', code).length; count = $('.line', this).length;
for (var i=1;i<=count; i++) { for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line-number">'+i+'</span>\n'; lineNumbers += '<span class="line-number">'+i+'</span>\n';
} }
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd; var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', this).html()+'</pre>' + tableEnd;
$(code).html(table); $(this).html(table);
}); });
} }