Modify ↓
Opened 9 years ago
Closed 6 years ago
#2 closed defect (fixed)
Does not handle changes in header depth gracefully
| Reported by: | athomas | Owned by: | cboos |
|---|---|---|---|
| Priority: | low | Component: | TocMacro |
| Severity: | normal | Keywords: | |
| Cc: | sns@… | Trac Release: | 0.11 |
Attachments (0)
Change History (5)
comment:1 Changed 9 years ago by Steven N. Severinghaus <sns@…>
- Cc sns@… added
comment:2 Changed 8 years ago by athomas
- milestone changed from 1.0 to 0.9
- version changed from 0.1 to stable
comment:4 Changed 6 years ago by cboos
- Owner changed from athomas to cboos
- Trac Release set to 0.11
This is still present in the 0.11 branch, mostly annoying with the inline mode.
comment:5 Changed 6 years ago by cboos
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.


I have a patch (or at least some svn diff output, 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.