Widen the range of permissible non-alnum characters in

an autolink, add more testcases for those new characters.
This commit is contained in:
David Parsons
2009-06-16 18:22:03 -07:00
parent 0f64df4d52
commit 9fd5dc06d1
3 changed files with 22 additions and 2 deletions
+1 -1
View File
@@ -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) ) {
+5
View File
@@ -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
View File
@@ -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;&amp;version=31;">http://www.biblegateway.com/passage/?search=Matthew%205:29-30;&amp;version=31;</a></p>'
exit $rc