Opened 12 years ago

Closed 9 years ago

Does not handle changes in header depth gracefully

Reported by: Owned by: athomas cboos low TocMacro normal sns@… 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.

comment:1 Changed 11 years ago by Steven N. Severinghaus <sns@…>

• Cc sns@… added; anonymous removed

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.

comment:2 Changed 11 years ago by athomas

• milestone changed from 1.0 to 0.9
• version changed from 0.1 to stable

comment:3 Changed 10 years ago by athomas

• milestone 0.9 deleted

Milestone 0.9 deleted

comment:4 Changed 9 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 9 years ago by cboos

• Resolution set to fixed
• Status changed from new to closed

(In [1907]) The outline tree is now much nicer in inline mode, as there won't be a new entry for each sublevel. Rather, the previous entry will be reused if available. Plus other validation fixes (the TOC macro now always validates).

Fixes #2.