mirror of
https://github.com/Orc/discount.git
synced 2026-09-25 04:10:00 +03:00
Widen the range of permissible non-alnum characters in
an autolink, add more testcases for those new characters.
This commit is contained in:
+1
-1
@@ -894,7 +894,7 @@ maybe_autolink(MMIOT *f)
|
||||
if ( peek(f, size+2) != EOF )
|
||||
++size;
|
||||
}
|
||||
else if ( !(isalnum(c) || strchr("/:._%~@&?=", c) || (c & 0x80)) )
|
||||
else if ( !(isalnum(c) || strchr(",;+-/:._%~@&?=", c) || (c & 0x80)) )
|
||||
break;
|
||||
|
||||
if ( (size > 1) && process_possible_link(f, size) ) {
|
||||
|
||||
@@ -28,4 +28,9 @@ try() {
|
||||
try 'backslashes in []()' '[foo](http://\this\is\.a\test\(here\))' \
|
||||
'<p><a href="http://\this\is.a\test(here)">foo</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with trailing \' \
|
||||
'http://a.com/\' \
|
||||
'<p><a href="http://a.com/\">http://a.com/\</a></p>'
|
||||
|
||||
|
||||
exit $rc
|
||||
|
||||
+16
-1
@@ -69,9 +69,24 @@ try -fautolink 'autolink url with escaped ()' \
|
||||
'http://a.com/\(foo\)' \
|
||||
'<p><a href="http://a.com/(foo)">http://a.com/(foo)</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with trailing \' \
|
||||
try -fautolink 'autolink url with escaped \' \
|
||||
'http://a.com/\\\)' \
|
||||
'<p><a href="http://a.com/\)">http://a.com/\)</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with -' \
|
||||
'http://experts-exchange.com' \
|
||||
'<p><a href="http://experts-exchange.com">http://experts-exchange.com</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with +' \
|
||||
'http://www67.wolframalpha.com/input/?i=how+old+was+jfk+jr+when+jfk+died' \
|
||||
'<p><a href="http://www67.wolframalpha.com/input/?i=how+old+was+jfk+jr+when+jfk+died">http://www67.wolframalpha.com/input/?i=how+old+was+jfk+jr+when+jfk+died</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with ,' \
|
||||
'http://www.spiegel.de/international/europe/0,1518,626171,00.html' \
|
||||
'<p><a href="http://www.spiegel.de/international/europe/0,1518,626171,00.html">http://www.spiegel.de/international/europe/0,1518,626171,00.html</a></p>'
|
||||
|
||||
try -fautolink 'autolink url with : & ;' \
|
||||
'http://www.biblegateway.com/passage/?search=Matthew%205:29-30;&version=31;' \
|
||||
'<p><a href="http://www.biblegateway.com/passage/?search=Matthew%205:29-30;&version=31;">http://www.biblegateway.com/passage/?search=Matthew%205:29-30;&version=31;</a></p>'
|
||||
|
||||
exit $rc
|
||||
|
||||
Reference in New Issue
Block a user