1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
|
. tests/functions.sh
title "html blocks"
rc=0
MARKDOWN_FLAGS=
try 'self-closing block tags (hr)' \
'<hr>
text' \
'<hr>
<p>text</p>'
try 'self-closing block tags (hr/)' \
'<hr/>
text' \
'<hr/>
<p>text</p>'
try 'no smartypants inside tags (#1)' \
'<img src="linky">' \
'<p><img src="linky"></p>'
try 'no smartypants inside tags (#2)' \
'<img src="linky" alt=":)" />' \
'<p><img src="linky" alt=":)" /></p>'
try -fnohtml 'block html with -fnohtml' '<b>hi!</b>' '<p><b>hi!</b></p>'
try -fnohtml 'malformed tag injection' '<x <script>' '<p><x <script></p>'
try -fhtml 'allow html with -fhtml' '<b>hi!</b>' '<p><b>hi!</b></p>'
# check that nested raw html blocks terminate properly.
#
BLOCK1SRC='Markdown works fine *here*.
*And* here.
<div><pre>
</pre></div>
Markdown here is *not* parsed by RDiscount.
Nor in *this* paragraph, and there are no paragraph breaks.'
BLOCK1OUT='<p>Markdown works fine <em>here</em>.</p>
<p><em>And</em> here.</p>
<div><pre>
</pre></div>
<p>Markdown here is <em>not</em> parsed by RDiscount.</p>
<p>Nor in <em>this</em> paragraph, and there are no paragraph breaks.</p>'
try 'nested html blocks (1)' "$BLOCK1SRC" "$BLOCK1OUT"
try 'nested html blocks (2)' \
'<div>This is inside a html block
<div>This is, too</div>and
so is this</div>' \
'<div>This is inside a html block
<div>This is, too</div>and
so is this</div>'
try 'unfinished tags' '<foo bar' '<p><foo bar</p>'
try 'block with trailing text' '<p>this is</p>a test' \
'<p>this is</p>
<p>a test</p>'
try 'unclosed block' '<p>here we go!' '<p><p>here we go!</p>'
try '<form> block' '<form>
pie?
</form>' '<form>
pie?
</form>'
try 'code inside a blockquote' \
'><form stuff>
stuff
</form>' \
'<blockquote><form stuff>
stuff
</form>
</blockquote>'
try 'multi-line html with trailing text' \
'<p>test test test
test test test</p>+' \
'<p>test test test
test test test</p>
<p>+</p>'
summary $0
exit $rc
|