Cleaned out public from repository, updated gitignore, added syntax
highlighting tests, improved syntax highlighting and styling of pre blocks. Overriding dynamic gist styling. Added a plugin for pygments caching which should speed things up terrifically. added ender.js as a lightweight way of scripting the DOM, events, etc. Some general typography and semantic html improvements.
This commit is contained in:
parent
c7d5365f81
commit
8698a276f9
74 changed files with 6018 additions and 1992 deletions
30
source/javascripts/syntax-helper.js
Normal file
30
source/javascripts/syntax-helper.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
function addDivLines(){
|
||||
$('div.highlight pre code').each(function(el){
|
||||
var content = bonzo(el).html();
|
||||
var lines = content.split('\n');
|
||||
var count = lines.length;
|
||||
bonzo(lines).each(function(line, index){
|
||||
if(line == '') line = ' ';
|
||||
lines[index] = '<div class="line">' + line + '</div>';
|
||||
});
|
||||
$(el).html(lines.join(''));
|
||||
});
|
||||
}
|
||||
function preToTable(){
|
||||
$('div.highlight').each(function(code){
|
||||
var tableStart = '<table cellpadding="0" cellspacing="0"><tbody><tr><td class="gutter">';
|
||||
var lineNumbers = '<pre class="line-numbers">';
|
||||
var tableMiddle = '</pre></td><td class="code" width="100%">';
|
||||
var tableEnd = '</td></tr></tbody></table>';
|
||||
var count = $('div.line', code).length;
|
||||
for (i=1;i<=count; i++){
|
||||
lineNumbers += '<span class="line">'+i+'</span>\n';
|
||||
}
|
||||
table = tableStart + lineNumbers + tableMiddle + '<pre>'+$('pre', code).html()+'</pre>' + tableEnd;
|
||||
$(code).html(table);
|
||||
});
|
||||
}
|
||||
$.domReady(function () {
|
||||
addDivLines();
|
||||
preToTable();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue