File: toc.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 (80 lines) | stat: -rw-r--r-- 1,380 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
. tests/functions.sh


rc=0
MARKDOWN_FLAGS=

if ./markdown -V | grep ID-ANCHOR >/dev/null; then
    # old-style; uses id= tag (and collides
    # with #-style css)

    title "(old) table-of-contents support"
    
    try '-T -ftoc' 'table of contents' \
    '#H1
hi' \
'<ul>
 <li><a href="#H1">H1</a></li>
</ul>
<h1 id="H1">H1</h1>

<p>hi</p>'

    try '-T -ftoc' 'toc item with link' \
    '##[H2](H2) here' \
'<ul>
 <li>
 <ul>
  <li><a href="#H2.here">H2 here</a></li>
 </ul>
 </li>
</ul>
<h2 id="H2.here"><a href="H2">H2</a> here</h2>'  

    try '-T -ftoc' 'toc item with non-alpha start' \
    '#1 header' \
'<ul>
 <li><a href="#L1.header">1 header</a></li>
</ul>
<h1 id="L1.header">1 header</h1>'

else
    # new-style; uses a (depreciated) name=
    # inside a null <a> tag
    
    title "(new) table-of-contents support"
    
    try '-T -ftoc' 'table of contents' \
    '#H1
hi' \
'<ul>
 <li><a href="#H1">H1</a></li>
</ul>
<a name="H1"></a>
<h1>H1</h1>

<p>hi</p>'

    try '-T -ftoc' 'toc item with link' \
    '##[H2](H2) here' \
'<ul>
 <li>
 <ul>
  <li><a href="#H2.here">H2 here</a></li>
 </ul>
 </li>
</ul>
<a name="H2.here"></a>
<h2><a href="H2">H2</a> here</h2>'  

    try '-T -ftoc' 'toc item with non-alpha start' \
    '#1 header' \
'<ul>
 <li><a href="#L1.header">1 header</a></li>
</ul>
<a name="L1.header"></a>
<h1>1 header</h1>'
fi

summary $0
exit $rc