Attachment 'TableOfContents.py_170.patch'
Download 1 --- TableOfContents.py.orig 2008-03-30 04:04:24.000000000 +0200
2 +++ TableOfContents.py 2008-07-02 22:17:21.000000000 +0200
3 @@ -165,6 +165,11 @@
4
5 lastlvl = 0
6
7 + # variables needed to provide with nice, leveled prefixes
8 + levelnumbers = None
9 + levelnumbers = {}
10 + counter = 1
11 +
12 for lvl, id, txt in macro.request._tocfm_collected_headings:
13 if txt is None:
14 incl_id = id
15 @@ -172,6 +177,22 @@
16 if lvl > maxdepth or id is None:
17 continue
18
19 + # determine number prefix for the TOC line
20 + if lvl > lastlvl:
21 + levelnumbers[lastlvl] = counter
22 + counter = 0
23 + elif lvl < lastlvl:
24 + counter = levelnumbers[lvl]
25 +
26 + counter = counter + 1
27 + levelnumbers[lvl] = counter
28 +
29 + line_number = ""
30 + for i in range(1, lvl):
31 + line_number = line_number + str(levelnumbers[i]) + "."
32 + line_number = line_number + str(counter) + "."
33 +
34 +
35 # will be reset by pop_unique_ids below
36 macro.request.include_id = incl_id
37
38 @@ -179,12 +200,12 @@
39 while lastlvl > lvl:
40 result.extend([
41 macro.formatter.listitem(0),
42 - macro.formatter.number_list(0),
43 + macro.formatter.bullet_list(0),
44 ])
45 lastlvl -= 1
46 while lastlvl < lvl:
47 result.extend([
48 - macro.formatter.number_list(1),
49 + macro.formatter.bullet_list(1, type="none"),
50 macro.formatter.listitem(1),
51 ])
52 lastlvl += 1
53 @@ -196,13 +217,13 @@
54 result.extend([
55 '\n',
56 macro.formatter.anchorlink(1, id),
57 - macro.formatter.text(txt),
58 + macro.formatter.text(line_number + " " + txt),
59 macro.formatter.anchorlink(0),
60 ])
61
62 while lastlvl > 0:
63 result.append(macro.formatter.listitem(0))
64 - result.append(macro.formatter.number_list(0))
65 + result.append(macro.formatter.bullet_list(0))
66 lastlvl -= 1
67
68 macro.request.pop_unique_ids()
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.