html.t 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. . tests/functions.sh
  2. title "html blocks"
  3. rc=0
  4. MARKDOWN_FLAGS=
  5. try 'self-closing block tags (hr)' \
  6. '<hr>
  7. text' \
  8. '<hr>
  9. <p>text</p>'
  10. try 'self-closing block tags (hr/)' \
  11. '<hr/>
  12. text' \
  13. '<hr/>
  14. <p>text</p>'
  15. try 'no smartypants inside tags (#1)' \
  16. '<img src="linky">' \
  17. '<p><img src="linky"></p>'
  18. try 'no smartypants inside tags (#2)' \
  19. '<img src="linky" alt=":)" />' \
  20. '<p><img src="linky" alt=":)" /></p>'
  21. try -fnohtml 'block html with -fnohtml' '<b>hi!</b>' '<p>&lt;b>hi!&lt;/b></p>'
  22. try -fnohtml 'malformed tag injection' '<x <script>' '<p>&lt;x &lt;script></p>'
  23. try -fhtml 'allow html with -fhtml' '<b>hi!</b>' '<p><b>hi!</b></p>'
  24. # check that nested raw html blocks terminate properly.
  25. #
  26. BLOCK1SRC='Markdown works fine *here*.
  27. *And* here.
  28. <div><pre>
  29. </pre></div>
  30. Markdown here is *not* parsed by RDiscount.
  31. Nor in *this* paragraph, and there are no paragraph breaks.'
  32. BLOCK1OUT='<p>Markdown works fine <em>here</em>.</p>
  33. <p><em>And</em> here.</p>
  34. <div><pre>
  35. </pre></div>
  36. <p>Markdown here is <em>not</em> parsed by RDiscount.</p>
  37. <p>Nor in <em>this</em> paragraph, and there are no paragraph breaks.</p>'
  38. try 'nested html blocks (1)' "$BLOCK1SRC" "$BLOCK1OUT"
  39. try 'nested html blocks (2)' \
  40. '<div>This is inside a html block
  41. <div>This is, too</div>and
  42. so is this</div>' \
  43. '<div>This is inside a html block
  44. <div>This is, too</div>and
  45. so is this</div>'
  46. try 'unfinished tags' '<foo bar' '<p>&lt;foo bar</p>'
  47. try 'block with trailing text' '<p>this is</p>a test' \
  48. '<p>this is</p>
  49. <p>a test</p>'
  50. try 'unclosed block' '<p>here we go!' '<p><p>here we go!</p>'
  51. summary $0
  52. exit $rc