Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
3.3 KiB

  1. . tests/functions.sh
  2. title "Bugs & misfeatures reported by Mike Schiraldi"
  3. rc=0
  4. MARKDOWN_FLAGS=
  5. try -fnohtml 'breaks with -fnohtml' 'foo
  6. bar' '<p>foo<br/>
  7. bar</p>'
  8. try 'links with trailing \)' \
  9. '[foo](http://en.wikipedia.org/wiki/Link_(film\))' \
  10. '<p><a href="http://en.wikipedia.org/wiki/Link_(film)">foo</a></p>'
  11. try -fautolink '(url) with -fautolink' \
  12. '(http://tsfr.org)' \
  13. '<p>(<a href="http://tsfr.org">http://tsfr.org</a>)</p>'
  14. try 'single #' \
  15. '#' \
  16. '<p>#</p>'
  17. try -frelax '* processing with -frelax' \
  18. '2*4 = 8 * 1 = 2**3' \
  19. '<p>2*4 = 8 * 1 = 2**3</p>'
  20. try -fnopants '[]() with a single quote mark' \
  21. '[Poe'"'"'s law](http://rationalwiki.com/wiki/Poe'"'"'s_Law)' \
  22. '<p><a href="http://rationalwiki.com/wiki/Poe'"'"'s_Law">Poe'"'"'s law</a></p>'
  23. try -fautolink 'autolink url with escaped spaces' \
  24. 'http://\(here\ I\ am\)' \
  25. '<p><a href="http://(here%20I%20am)">http://(here I am)</a></p>'
  26. try -fautolink 'autolink café_racer' \
  27. 'http://en.wikipedia.org/wiki/café_racer' \
  28. '<p><a href="http://en.wikipedia.org/wiki/caf%C3%A9_racer">http://en.wikipedia.org/wiki/caf%C3%A9_racer</a></p>'
  29. try -fautolink 'autolink url with arguments' \
  30. 'http://foo.bar?a&b=c' \
  31. '<p><a href="http://foo.bar?a&amp;b=c">http://foo.bar?a&amp;b=c</a></p>'
  32. try '\( escapes in []()' \
  33. '[foo](http://a.com/\(foo\))' \
  34. '<p><a href="http://a.com/(foo)">foo</a></p>'
  35. try -fautolink 'autolink url with escaped ()' \
  36. 'http://a.com/\(foo\)' \
  37. '<p><a href="http://a.com/(foo)">http://a.com/(foo)</a></p>'
  38. try -fautolink 'autolink url with escaped \' \
  39. 'http://a.com/\\\)' \
  40. '<p><a href="http://a.com/\)">http://a.com/\)</a></p>'
  41. try -fautolink 'autolink url with -' \
  42. 'http://experts-exchange.com' \
  43. '<p><a href="http://experts-exchange.com">http://experts-exchange.com</a></p>'
  44. try -fautolink 'autolink url with +' \
  45. 'http://www67.wolframalpha.com/input/?i=how+old+was+jfk+jr+when+jfk+died' \
  46. '<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>'
  47. try -fautolink 'autolink url with &' \
  48. 'http://foo.bar?a&b=c' \
  49. '<p><a href="http://foo.bar?a&amp;b=c">http://foo.bar?a&amp;b=c</a></p>'
  50. try -fautolink 'autolink url with ,' \
  51. 'http://www.spiegel.de/international/europe/0,1518,626171,00.html' \
  52. '<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>'
  53. try -fautolink 'autolink url with : & ;' \
  54. 'http://www.biblegateway.com/passage/?search=Matthew%205:29-30;&version=31;' \
  55. '<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>'
  56. Q="'"
  57. try -fautolink 'security hole with \" in []()' \
  58. '[XSS](/ "\"=\"\"onmouseover='$Q'alert(String.fromCharCode(88,83,83))'$Q'")' \
  59. '<p><a href="/" title="\&quot;=\&quot;\&quot;onmouseover='$Q'alert(String.fromCharCode(88,83,83))'$Q'">XSS</a></p>'
  60. try -fautolink 'autolink and prefix fragment' \
  61. 'xxxxxxx http://x.com/
  62. xxx xxxxht' \
  63. '<p>xxxxxxx <a href="http://x.com/">http://x.com/</a></p>
  64. <p>xxx xxxxht</p>'
  65. summary $0
  66. exit $rc