Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 227
- Log:
Added a truly automatic section numbering script derived
from Rhino (see script comments) which can be included in
Wiki pages if required. Wiki help updated to describe the
process for enabling the contents section - for the record
here, adding a DIV with ID toc_heading and closing the
tag, then another DIV with ID toc and closing the tag,
will add a "Contents" heading at level 2, then the TOC. It
is recommended that pages then use a level 2 heading after
the TOC and do not skip header levels (e.g. don't jump
from 2 to 4 without level 3 in between).Might be nice to get this server side some time, but this
works resonably in Firefox 2, Opera 9 and IE 7, degrades
gracefully in older browsers, and is better than nothing!
- Author:
- rool
- Date:
- Thu Jun 14 11:20:41 +0100 2007
- Size:
- 3852 Bytes
1 | /* Variable depth automatic section numbering inserted by short, |
2 | * manually added scripts. |
3 | * |
4 | * History |
5 | * ======= |
6 | * |
7 | * 30-May-2007 (ADH): Imported into Wiki structure. |
8 | */ |
9 | |
10 | var sectionNumberingDepth = 2; // Maximum allowed depth |
11 | var sectionNumberingContents = new Array(); |
12 | var sectionNumberingSections = new Array(); |
13 | |
14 | for (var i = 0; i < sectionNumberingDepth; i++) |
15 | { |
16 | sectionNumberingContents[i] = 1; |
17 | sectionNumberingSections[i] = 1; |
18 | } |
19 | |
20 | ////////////////////////////////////////////////////////////////////////// |
21 | // Insert section number into the document. Pass the nesting level; |
22 | // 1 = highest level (i.e. a major section), 'sectionNumberingDepth' |
23 | // (see start of script) = lowest level (i.e. a subsection). |
24 | ////////////////////////////////////////////////////////////////////////// |
25 | |
26 | function isn(level) |
27 | { |
28 | if (level > sectionNumberingDepth) return; |
29 | |
30 | // Must reset any section number counters at a lower level than this one |
31 | // - array indices start at 0, so the loop initial condition is right. |
32 | |
33 | for (var i = level; i < sectionNumberingDepth; i++) sectionNumberingSections[i] = 1; |
34 | sectionNumberingSections[level - 1]++; |
35 | |
36 | for (var i = 0; i < level; i++) document.write((sectionNumberingSections[i] - 1) + "."); |
37 | document.write(" "); |
38 | } |
39 | |
40 | ////////////////////////////////////////////////////////////////////////// |
41 | // Increment section counters for a contents page. Pass the nesting |
42 | // level - see function 'isn' for details. If the level is greater |
43 | // than zero, a number will be output into the document as well, |
44 | // indented by an appropriate amount. At levels of 1, no number is |
45 | // output; it is assumed an ordered list will be being used, so that |
46 | // scriptless browsers get at least some kind of sensible contents. |
47 | ////////////////////////////////////////////////////////////////////////// |
48 | |
49 | function icsn(level) |
50 | { |
51 | if (level > sectionNumberingDepth) return; |
52 | |
53 | for (var i = level; i < sectionNumberingDepth; i++) sectionNumberingContents[i] = 1 |
54 | sectionNumberingContents[level - 1]++; |
55 | |
56 | if (level > 1) |
57 | { |
58 | var indent = " "; // Ick... |
59 | |
60 | document.write("<tt>"); |
61 | for (var i = 1; i < level; i++) { document.write(indent); } |
62 | document.write("<\/tt>"); |
63 | |
64 | for (var i = 0; i < level; i++) { document.write((sectionNumberingContents[i] - 1) + "."); } |
65 | document.write(" "); |
66 | } |
67 | } |
68 | |
69 | ////////////////////////////////////////////////////////////////////////// |
70 | // Output a grey 'banner' for a SWI, service call etc. section header; |
71 | // pass the nesting level (usually 2, or 3 for (sub-)reason codes), |
72 | // an anchor name, and the title text to write out. |
73 | ////////////////////////////////////////////////////////////////////////// |
74 | |
75 | function icp(level, name, title) |
76 | { |
77 | var insert1 = ' <table border="0" cellpadding="0" cellspacing="0" width="100%">\n' + |
78 | ' <tr>\n' + |
79 | ' <td align="left">\n' + |
80 | ' <font size="+1">\n'; |
81 | |
82 | var insert2 = ' <\/font>\n' + |
83 | ' <\/td>\n' + |
84 | ' <td align="right">\n' + |
85 | ' <font size="+1">\n' + |
86 | ' <a name="' + name + '">' + title + '<\/a>\n' + |
87 | ' <\/font>\n' + |
88 | ' <\/td>\n' + |
89 | ' <\/tr>\n' + |
90 | ' <\/table>\n' |
91 | |
92 | document.write(insert1); |
93 | isn(level); |
94 | document.write(insert2); |
95 | } |