dl.t 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. . tests/functions.sh
  2. title "definition lists"
  3. rc=0
  4. MARKDOWN_FLAGS=
  5. SRC='
  6. =this=
  7. is an ugly
  8. =test=
  9. eh?'
  10. RSLT='<dl>
  11. <dt>this</dt>
  12. <dd>is an ugly</dd>
  13. <dt>test</dt>
  14. <dd>eh?</dd>
  15. </dl>'
  16. # discount style
  17. try -fdefinitionlist '=tag= generates definition lists' "$SRC" "$RSLT"
  18. try 'one item with two =tags=' \
  19. '=this=
  20. =is=
  21. A test, eh?' \
  22. '<dl>
  23. <dt>this</dt>
  24. <dt>is</dt>
  25. <dd>A test, eh?</dd>
  26. </dl>'
  27. # extra style
  28. try -fnodefinitionlist,dlextra '=tag= does nothing' "$SRC" \
  29. '<p>=this=
  30. is an ugly
  31. =test=
  32. eh?</p>'
  33. try -fdlextra 'markdown extra-style definition lists' \
  34. 'foo
  35. : bar' \
  36. '<dl>
  37. <dt>foo</dt>
  38. <dd>bar</dd>
  39. </dl>'
  40. try -fdlextra '... with two <dt>s in a row' \
  41. 'foo
  42. bar
  43. : baz' \
  44. '<dl>
  45. <dt>foo</dt>
  46. <dt>bar</dt>
  47. <dd>baz</dd>
  48. </dl>'
  49. try -fdlextra '... with two <dd>s in a row' \
  50. 'foo
  51. : bar
  52. : baz' \
  53. '<dl>
  54. <dt>foo</dt>
  55. <dd>bar</dd>
  56. <dd>baz</dd>
  57. </dl>'
  58. try -fdlextra '... with blanks between list items' \
  59. 'foo
  60. : bar
  61. zip
  62. : zap' \
  63. '<dl>
  64. <dt>foo</dt>
  65. <dd>bar</dd>
  66. <dt>zip</dt>
  67. <dd>zap</dd>
  68. </dl>'
  69. # Hmm, redundancy...
  70. SRC='foo
  71. : bar
  72. =this=
  73. is ugly'
  74. RSLT='<p>foo
  75. : bar</p>
  76. <p>=this=
  77. is ugly</p>'
  78. try -fnodldiscount '... with definitionlists enabled but all styles disabled' \
  79. "$SRC" \
  80. "$RSLT"
  81. try -fnodefinitionlist,dldiscount,dlextra '... with definitionlists disabled but all styles enabled' \
  82. "$SRC" \
  83. "$RSLT"
  84. summary $0
  85. exit $rc