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
1.1 KiB

  1. . tests/functions.sh
  2. title "definition lists"
  3. eval `./markdown -V | tr ' ' '\n' | grep '^DL='`
  4. DL=${DL:-BOTH}
  5. rc=0
  6. MARKDOWN_FLAGS=
  7. SRC='
  8. =this=
  9. is an ugly
  10. =test=
  11. eh?'
  12. RSLT='<dl>
  13. <dt>this</dt>
  14. <dd>is an ugly</dd>
  15. <dt>test</dt>
  16. <dd>eh?</dd>
  17. </dl>'
  18. if [ "$DL" = "DISCOUNT" -o "$DL" = "BOTH" ]; then
  19. try -fdefinitionlist '=tag= generates definition lists' "$SRC" "$RSLT"
  20. try 'one item with two =tags=' \
  21. '=this=
  22. =is=
  23. A test, eh?' \
  24. '<dl>
  25. <dt>this</dt>
  26. <dt>is</dt>
  27. <dd>A test, eh?</dd>
  28. </dl>'
  29. try -fnodefinitionlist '=tag= does nothing' "$SRC" \
  30. '<p>=this=
  31. is an ugly
  32. =test=
  33. eh?</p>'
  34. fi
  35. if [ "$DL" = "EXTRA" -o "$DL" = "BOTH" ]; then
  36. try 'markdown extra-style definition lists' \
  37. 'foo
  38. : bar' \
  39. '<dl>
  40. <dt>foo</dt>
  41. <dd>bar</dd>
  42. </dl>'
  43. try '... with two <dt>s in a row' \
  44. 'foo
  45. bar
  46. : baz' \
  47. '<dl>
  48. <dt>foo</dt>
  49. <dt>bar</dt>
  50. <dd>baz</dd>
  51. </dl>'
  52. try '... with two <dd>s in a row' \
  53. 'foo
  54. : bar
  55. : baz' \
  56. '<dl>
  57. <dt>foo</dt>
  58. <dd>bar</dd>
  59. <dd>baz</dd>
  60. </dl>'
  61. try '... with blanks between list items' \
  62. 'foo
  63. : bar
  64. zip
  65. : zap' \
  66. '<dl>
  67. <dt>foo</dt>
  68. <dd>bar</dd>
  69. <dt>zip</dt>
  70. <dd>zap</dd>
  71. </dl>'
  72. fi
  73. summary $0
  74. exit $rc