Fixed issue where gists wouldn't get line numbers added. Fixed issue where backtick code blocks were getting empty figcaptions

This commit is contained in:
Brandon Mathis 2012-06-05 00:35:13 -05:00
parent 608d9fb9bd
commit 64b2d2355d
2 changed files with 5 additions and 5 deletions

View File

@ -40,17 +40,17 @@ function addSidebarToggler() {
function addCodeLineNumbers() {
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">',
lineNumbers = '<pre class="line-numbers">',
tableMiddle = '</pre></td><td class="code">',
tableEnd = '</td></tr></tbody></table>',
count = $('.line', code).length;
count = $('.line', this).length;
for (var i=1;i<=count; i++) {
lineNumbers += '<span class="line-number">'+i+'</span>\n';
}
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
$(code).html(table);
var table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', this).html()+'</pre>' + tableEnd;
$(this).html(table);
});
}

View File

@ -24,7 +24,7 @@ module BacktickCodeBlock
if markup =~ AllOptions
highlight(code, $1, {caption: $2, url: $3, anchor: $4 || 'Link', linenos: linenos, start: start, marks: marks})
elsif markup =~ LangCaption
highlight(code, $1, {caption: $2 || '', linenos: linenos, start: start, marks: marks})
highlight(code, $1, {caption: $2 || nil, linenos: linenos, start: start, marks: marks})
else
highlight(code, 'plain', {linenos: linenos, start: start})
end