handle unescaped angle brackets in attribute. closes #12.

This commit is contained in:
Christopher Jeffrey 2012-01-11 02:01:16 -06:00
parent bb382e3425
commit 3296d10f18
5 changed files with 6 additions and 13 deletions

View File

@ -38,11 +38,7 @@ block.html = (function() {
html = html html = html
.replace('comment', /<!--[^\0]*?-->/.source) .replace('comment', /<!--[^\0]*?-->/.source)
.replace('closed', /<(\w+)[^\0]+?<\/\1>/.source) .replace('closed', /<(\w+)[^\0]+?<\/\1>/.source)
.replace('closing', /<\w+[^>]*>/.source); .replace('closing', /<\w+(?!:\/|@)\b(?:"[^"]*"|'[^']*'|[^>])*>/.source);
// Better regexes:
// .replace('closed', /<(\w+)\b[^\0]*?<\/\1>/.source)
// .replace('closing', /<\w+(?!:\/|@)\b[^>]*>/.source);
return new RegExp(html); return new RegExp(html);
})(); })();
@ -183,9 +179,6 @@ block.token = function(str, tokens, top) {
cap = cap[0].replace(/^ *>/gm, ''); cap = cap[0].replace(/^ *>/gm, '');
// Better conformance:
// cap = cap[0].replace(/^ *> ?/gm, '');
// Pass `top` to keep the current // Pass `top` to keep the current
// "toplevel" state. This is exactly // "toplevel" state. This is exactly
// how markdown.pl works. // how markdown.pl works.
@ -293,7 +286,7 @@ var inline = {
escape: /^\\([\\`*{}\[\]()#+\-.!_>])/, escape: /^\\([\\`*{}\[\]()#+\-.!_>])/,
autolink: /^<([^ >]+(@|:\/)[^ >]+)>/, autolink: /^<([^ >]+(@|:\/)[^ >]+)>/,
gfm_autolink: /^(\w+:\/\/[^\s]+[^.,:;"')\]\s])/, gfm_autolink: /^(\w+:\/\/[^\s]+[^.,:;"')\]\s])/,
tag: /^<!--[^\0]*?-->|^<\/?\w+[^>]*>/, tag: /^<!--[^\0]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^>])*>/,
link: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\(([^\)]*)\)/, link: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\(([^\)]*)\)/,
reflink: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\s*\[([^\]]*)\]/, reflink: /^!?\[((?:\[[^\]]*\]|[^\[\]]|\[|\](?=[^[\]]*\]))*)\]\s*\[([^\]]*)\]/,
nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/, nolink: /^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,

View File

@ -1 +1 @@
<div style=">"></div> <div style=">"/>

View File

@ -1 +1 @@
<div style=">"/></div> <div style=">"/>

View File

@ -1 +1 @@
<div style=">"></div> <div style=">"/>

View File

@ -1 +1 @@
<div style=">"/></div> <div style=">"/>