Modify ↓
Opened 21 years ago
Closed 19 years ago
#2 closed defect (fixed)
Does not handle changes in header depth gracefully
| Reported by: | Alec Thomas | Owned by: | Christian Boos |
|---|---|---|---|
| Priority: | low | Component: | TocMacro |
| Severity: | normal | Keywords: | |
| Cc: | sns@… | Trac Release: | 0.11 |
Description
If headers jump more than one level at a time, eg. from == to ====, the TocMacro will display <li> entries for intervening header levels. This is not ideal.
Attachments (0)
Change History (5)
comment:1 Changed 21 years ago by
| Cc: | sns@… added; anonymous removed |
|---|
comment:2 Changed 20 years ago by
| milestone: | 1.0 → 0.9 |
|---|---|
| version: | 0.1 → stable |
comment:4 Changed 19 years ago by
| Owner: | changed from Alec Thomas to Christian Boos |
|---|---|
| Trac Release: | → 0.11 |
This is still present in the 0.11 branch, mostly annoying with the inline mode.
comment:5 Changed 19 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note: See
TracTickets for help on using
tickets.



I have a patch (or at least some
svn diffoutput, if that's usable) for the TOC macro that makes it output valid HTML. It's not particularly clean code, but it seems to handle all the weird cases that I threw at it fairly well. You can find my test case (in my wiki's SandBox) here (valid!), and you can find the diff on my website here. The full source is here.I should have done this in two stages, but this version also includes a relatively small modification (for which there is a diff without the above changes here) that does the traditional outline numbering and adds a depth-based CSS class to each
<ol>. The example in our sandbox shows both of these.You can remove the inline styles (the
style="list-style-type: ...;"part) and just add some CSS statements like this, if you want:ol.toc-depth1 { list-style-type: upper-roman; } ol.toc-depth2 { list-style-type: upper-alpha; } ol.toc-depth3 { list-style-type: decimal; } ...This would be somewhat cleaner and less redundant, I suppose.