forked from Orc/discount
/
list.t
178 lines (137 loc) · 2.13 KB
/
list.t
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
./echo "lists"
rc=0
MARKDOWN_FLAGS=
try() {
unset FLAGS
case "$1" in
-*) FLAGS=$1
shift ;;
esac
./echo -n " $1" '..................................' | ./cols 36
Q=`./echo "$2" | ./markdown $FLAGS`
if [ "$3" = "$Q" ]; then
./echo " ok"
else
./echo " FAILED"
./echo "wanted: $3"
./echo "got : $Q"
rc=1
fi
}
try 'two separated items' \
' * A
* B' \
'<ul>
<li><p>A</p></li>
<li><p>B</p></li>
</ul>'
try 'two adjacent items' \
' * A
* B' \
'<ul>
<li>A</li>
<li>B</li>
</ul>'
try 'two adjacent items, then space' \
' * A
* B
space, the final frontier' \
'<ul>
<li>A</li>
<li>B</li>
</ul>
<p>space, the final frontier</p>'
try 'nested lists (1)' \
' * 1. Sub (list)
2. Two (items)
3. Here' \
'<ul>
<li><ol>
<li>Sub (list)</li>
<li>Two (items)</li>
<li>Here</li>
</ol>
</li>
</ul>'
try 'nested lists (2)' \
' * A (list)
1. Sub (list)
2. Two (items)
3. Here
Here
* B (list)' \
'<ul>
<li><p>A (list)</p>
<ol>
<li>Sub (list)</li>
<li>Two (items)</li>
<li>Here</li>
</ol>
<p> Here</p></li>
<li>B (list)</li>
</ul>'
try 'list inside blockquote' \
'>A (list)
>
>1. Sub (list)
>2. Two (items)
>3. Here' \
'<blockquote><p>A (list)</p>
<ol>
<li>Sub (list)</li>
<li>Two (items)</li>
<li>Here</li>
</ol>
</blockquote>'
try 'blockquote inside list' \
' * A (list)
> quote
> me
dont quote me' \
'<ul>
<li><p>A (list)</p>
<blockquote><p>quote
me</p></blockquote>
<p>dont quote me</p></li>
</ul>'
try 'empty list' \
'
-
-
' \
'<ul>
<li></li>
<li></li>
</ul>'
try 'blockquote inside a list' \
' * This is a list item.
> This is a quote insde a list item. ' \
'<ul>
<li><p> This is a list item.</p>
<blockquote><p>This is a quote insde a list item.</p></blockquote></li>
</ul>'
if ./markdown -V | grep DL_TAG >/dev/null; then
try 'dl followed by non-dl' \
'=a=
test
2. here' \
'<dl>
<dt>a</dt>
<dd>test</dd>
</dl>
<ol>
<li>here</li>
</ol>'
try 'non-dl followed by dl' \
'1. hello
=sailor=
hi!' \
'<ol>
<li>hello</li>
</ol>
<dl>
<dt>sailor</dt>
<dd>hi!</dd>
</dl>'
fi
exit $rc