mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-25 00:48:53 -05:00
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:
parent
5c925c7e64
commit
1c8a4de58e
@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ module BacktickCodeBlock
|
|||||||
if markup =~ AllOptions
|
if markup =~ AllOptions
|
||||||
highlight(code, $1, {caption: $2, url: $3, anchor: $4 || 'Link', linenos: linenos, start: start, marks: marks})
|
highlight(code, $1, {caption: $2, url: $3, anchor: $4 || 'Link', linenos: linenos, start: start, marks: marks})
|
||||||
elsif markup =~ LangCaption
|
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
|
else
|
||||||
highlight(code, 'plain', {linenos: linenos, start: start})
|
highlight(code, 'plain', {linenos: linenos, start: start})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user