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.

80 lines
1.3 KiB

  1. . tests/functions.sh
  2. rc=0
  3. MARKDOWN_FLAGS=
  4. if ./markdown -V | grep ID-ANCHOR >/dev/null; then
  5. # old-style; uses id= tag (and collides
  6. # with #-style css)
  7. title "(old) table-of-contents support"
  8. try '-T -ftoc' 'table of contents' \
  9. '#H1
  10. hi' \
  11. '<ul>
  12. <li><a href="#H1">H1</a></li>
  13. </ul>
  14. <h1 id="H1">H1</h1>
  15. <p>hi</p>'
  16. try '-T -ftoc' 'toc item with link' \
  17. '##[H2](H2) here' \
  18. '<ul>
  19. <li>
  20. <ul>
  21. <li><a href="#H2.here">H2 here</a></li>
  22. </ul>
  23. </li>
  24. </ul>
  25. <h2 id="H2.here"><a href="H2">H2</a> here</h2>'
  26. try '-T -ftoc' 'toc item with non-alpha start' \
  27. '#1 header' \
  28. '<ul>
  29. <li><a href="#L1.header">1 header</a></li>
  30. </ul>
  31. <h1 id="L1.header">1 header</h1>'
  32. else
  33. # new-style; uses a (depreciated) name=
  34. # inside a null <a> tag
  35. title "(new) table-of-contents support"
  36. try '-T -ftoc' 'table of contents' \
  37. '#H1
  38. hi' \
  39. '<ul>
  40. <li><a href="#H1">H1</a></li>
  41. </ul>
  42. <a name="H1"></a>
  43. <h1>H1</h1>
  44. <p>hi</p>'
  45. try '-T -ftoc' 'toc item with link' \
  46. '##[H2](H2) here' \
  47. '<ul>
  48. <li>
  49. <ul>
  50. <li><a href="#H2.here">H2 here</a></li>
  51. </ul>
  52. </li>
  53. </ul>
  54. <a name="H2.here"></a>
  55. <h2><a href="H2">H2</a> here</h2>'
  56. try '-T -ftoc' 'toc item with non-alpha start' \
  57. '#1 header' \
  58. '<ul>
  59. <li><a href="#L1.header">1 header</a></li>
  60. </ul>
  61. <a name="L1.header"></a>
  62. <h1>1 header</h1>'
  63. fi
  64. summary $0
  65. exit $rc