فهرست منبع

Fixed #26 -- Urls which contained matched parenthesis are now supported

Titus 13 سال پیش
والد
کامیت
541b3eccb1
3فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 1 1
      src/showdown.js
  2. 2 0
      test/cases/url-with-parenthesis.html
  3. 2 0
      test/cases/url-with-parenthesis.md

+ 1 - 1
src/showdown.js

@@ -483,7 +483,7 @@ var _DoAnchors = function(text) {
 		)
 		/g,writeAnchorTag);
 	*/
-	text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);
+	text = text.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?(?:\(.*?\).*?)?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,writeAnchorTag);
 
 	//
 	// Last, handle reference-style shortcuts: [link text]

+ 2 - 0
test/cases/url-with-parenthesis.html

@@ -0,0 +1,2 @@
+
+<p>There's an <a href="http://en.memory-alpha.org/wiki/Darmok_(episode)">episode</a> of Star Trek: The Next Generation</p>

+ 2 - 0
test/cases/url-with-parenthesis.md

@@ -0,0 +1,2 @@
+
+There's an [episode](http://en.memory-alpha.org/wiki/Darmok_(episode)) of Star Trek: The Next Generation