Merge pull request #2688 from Elberet/tests-passed

Workaround markdown-js links parser bug
This commit is contained in:
Robin Ward 2014-08-23 20:33:13 -04:00
commit a11a21ca09
2 changed files with 5 additions and 1 deletions

View File

@ -138,6 +138,10 @@ test("Links", function() {
cooked("[http://google.com ... wat](http://discourse.org)", cooked("[http://google.com ... wat](http://discourse.org)",
"<p><a href=\"http://discourse.org\">http://google.com ... wat</a></p>", "<p><a href=\"http://discourse.org\">http://google.com ... wat</a></p>",
"it supports linkins within links"); "it supports linkins within links");
cooked("[Link](http://www.example.com) (with an outer \"description\")",
"<p><a href=\"http://www.example.com\">Link</a> (with an outer \"description\")</p>",
"it doesn't consume closing parens as part of the url")
}); });
test("simple quotes", function() { test("simple quotes", function() {

View File

@ -1310,7 +1310,7 @@
// back based on if there a matching ones in the url // back based on if there a matching ones in the url
// ([here](/url/(test)) // ([here](/url/(test))
// The parens have to be balanced // The parens have to be balanced
var m = text.match( /^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ ); var m = text.match( /^\s*\([ \t]*([^"'\s]*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ );
if ( m ) { if ( m ) {
var url = m[1].replace(/\s+$/, ''); var url = m[1].replace(/\s+$/, '');
consumed += m[0].length; consumed += m[0].length;