Merge branch 'syntax-extensions' of github.com:tstone/showdown into syntax-extensions

This commit is contained in:
Titus 2012-08-09 19:51:43 -06:00
commit 35abe36946

View File

@ -122,10 +122,10 @@ if (typeof module !== 'undefind' && typeof exports !== 'undefined' && typeof req
if (fs) { if (fs) {
// Search extensions folder // Search extensions folder
var extensions = fs.readdirSync('./src/extensions').filter(function(file){ var extensions = fs.readdirSync((__dirname || '.')+'/extensions').filter(function(file){
return ~file.indexOf('.js'); return ~file.indexOf('.js');
}).map(function(file){ }).map(function(file){
return file.replace('.js', ''); return file.replace(/\.js$/, '');
}); });
// Load extensions into Showdown namespace // Load extensions into Showdown namespace
extensions.forEach(function(ext){ extensions.forEach(function(ext){
@ -183,9 +183,9 @@ this.makeHtml = function(text) {
// from other articles when generating a page which contains more than // from other articles when generating a page which contains more than
// one article (e.g. an index page that shows the N most recent // one article (e.g. an index page that shows the N most recent
// articles): // articles):
g_urls = new Array(); g_urls = {};
g_titles = new Array(); g_titles = {};
g_html_blocks = new Array(); g_html_blocks = [];
// attacklab: Replace ~ with ~T // attacklab: Replace ~ with ~T
// This lets us use tilde as an escape char to avoid md5 hashes // This lets us use tilde as an escape char to avoid md5 hashes
@ -1191,7 +1191,7 @@ var _FormParagraphs = function(text) {
text = text.replace(/\n+$/g,""); text = text.replace(/\n+$/g,"");
var grafs = text.split(/\n{2,}/g); var grafs = text.split(/\n{2,}/g);
var grafsOut = new Array(); var grafsOut = [];
// //
// Wrap <p> tags. // Wrap <p> tags.
@ -1310,16 +1310,9 @@ var _EncodeEmailAddress = function(addr) {
// mailing list: <http://tinyurl.com/yu7ue> // mailing list: <http://tinyurl.com/yu7ue>
// //
// attacklab: why can't javascript speak hex?
function char2hex(ch) {
var hexDigits = '0123456789ABCDEF';
var dec = ch.charCodeAt(0);
return(hexDigits.charAt(dec>>4) + hexDigits.charAt(dec&15));
}
var encode = [ var encode = [
function(ch){return "&#"+ch.charCodeAt(0)+";";}, function(ch){return "&#"+ch.charCodeAt(0)+";";},
function(ch){return "&#x"+char2hex(ch)+";";}, function(ch){return "&#x"+ch.charCodeAt(0).toString(16)+";";},
function(ch){return ch;} function(ch){return ch;}
]; ];