File: html.t

package info (click to toggle)
discount 2.1.3-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 728 kB
  • sloc: ansic: 4,582; pascal: 855; sh: 196; makefile: 120
file content (132 lines) | stat: -rw-r--r-- 2,169 bytes parent folder | download | duplicates (5)
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
. 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 'html comments' \
    '<!--
**hi**
-->' \
    '<!--
**hi**
-->'
    
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>&lt;b>hi!&lt;/b></p>'
try -fnohtml 'malformed tag injection' '<x <script>' '<p>&lt;x &lt;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>&lt;foo bar</p>'


try 'comment with trailing text' '<!-- this is -->a test' \
'<!-- this is -->


<p>a test</p>'

try 'block with trailing text' '<p>this is</p>a test' \
'<p>this is</p>


<p>a test</p>'


COMMENTS='<!-- 1. -->line 1

<!-- 2. -->line 2'

try 'two comments' "$COMMENTS" \
'<!-- 1. -->


<p>line 1</p>

<!-- 2. -->


<p>line 2</p>'

COMMENTS='<!-- 1. -->line 1
<!-- 2. -->line 2'

try 'two adjacent comments' "$COMMENTS" \
'<!-- 1. -->


<p>line 1</p>

<!-- 2. -->


<p>line 2</p>'

try 'comment, no white space' '<!--foo-->' '<!--foo-->'

try 'unclosed block' '<p>here we go!' '<p><p>here we go!</p>'

summary $0
exit $rc