This commit is contained in:
Christopher Jeffrey 2011-08-21 08:33:56 -05:00
parent 8ff9c48d26
commit a722edbf32

View File

@ -95,7 +95,7 @@ block.lexer = function(str) {
function(_, id, href, title) { function(_, id, href, title) {
links[id] = { links[id] = {
href: href, href: href,
title: title title: unquote(title)
}; };
return ''; return '';
} }
@ -326,7 +326,7 @@ inline.lexer = function(str) {
} else { } else {
link = { link = {
href: cap[2], href: cap[2],
title: cap[3] title: unquote(cap[3])
}; };
} }
out += '<a href="' out += '<a href="'
@ -349,7 +349,7 @@ inline.lexer = function(str) {
text = /^([^\s]+)\s*(.+)?$/.exec(cap[2]); text = /^([^\s]+)\s*(.+)?$/.exec(cap[2]);
link = { link = {
href: text[1], href: text[1],
title: text[2] title: unquote(text[2])
}; };
} }
out += '<img src="' out += '<img src="'
@ -527,6 +527,13 @@ var each = function(obj, func) {
for (; i < l; i++) func(obj[i]); for (; i < l; i++) func(obj[i]);
}; };
var unquote = function(str) {
if (!str) return str;
var ch = str[0];
return (ch === '"' || ch === '\'')
? str.slice(1, -1) : str;
};
/** /**
* Expose * Expose
*/ */