File: toc.t

package info (click to toggle)
discount 2.2.7-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,004 kB
  • sloc: ansic: 5,707; pascal: 1,027; sh: 287; makefile: 208
file content (95 lines) | stat: -rw-r--r-- 1,765 bytes parent folder | download | duplicates (9)
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
. tests/functions.sh


rc=0
MARKDOWN_FLAGS=

# old-style; uses id= tag (and collides
# with #-style css)

title "(old) table-of-contents support"

try -fidanchor '-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 -fidanchor -fnohtml5anchor '-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 -fidanchor -fnohtml5anchor '-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>'

try -fidanchor -fhtml5anchor '-T -ftoc' 'toc item with non-alpha start (url encoded)' \
'#1 header' \
'<ul>
 <li><a href="#1-header">1 header</a></li>
</ul>
<h1 id="1-header">1 header</h1>'

summary $0

# 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>'

# Be sure to save toc.t as UTF-8.
try '-T -ftoc,html5anchor' 'html5 multibyte chars' \
'#It’s an apostrophe' \
'<ul>
 <li><a href="#It’s-an-apostrophe">It’s an apostrophe</a></li>
</ul>
<a name="It’s-an-apostrophe"></a>
<h1>It’s an apostrophe</h1>'

summary $0
exit $rc