Question
There are two bugs (that I've found) in the implementation of %TOC%
Bug 1: Although the
documentation
states that headings in HTML ("<h2>text</h2>") are taken into account, this is not so. My headings in HTML were all ignored.
Oddly, when I rewrote them as
<H1>
---+ Foo
<H1>
they did work... (barring the interaction from bug 2)
(by the way, I tried and discarded as not germaine to the problem:
- putting the header tags on the same line as the header text'
- changing the case of the tags from H to h
Bug 2: I originally wrote my page (topic) in "real" HTML and tested it in my browser. For an experiment, I pasted the entire file into the TWiki form and... it worked (complete with the entire <HEAD> and <BODY> sections). I was a bit surprised (although the docs for %INCLUDE% implied that this might happen. I was also pleased.
However, when I tried to insert a TOC (after I worked around bug 1 above), the TOC came out like this:
* Heading 1 * Heading 2 * Heading 3 * Heading 4 ...
that is, in one long line instead of on individual lines and indented.
As an experiment in debugging, I removed the <HEAD> and <BODY> sections et voila! my TOC does the right thing.
Weird.
Let me know when the bug with handling HTML H1, H2, etc headers is fixed, please. People at my site will want to know.
Environment
--
VickiBrown - 05 Nov 2004
Answer
It's a feature, not a bug
See
TWikiVariables which I have just updated to state explicitly that uppercase HTML header tags are ignored.
--
SamHasler - 05 Nov 2004
Well, that's rude. Upper case is pretty much a standard wtdi. Epplicitly ignoring something that many web writers people use every day is, to my way of thinking, a desigined-in bug.
However, I also tried lowercase and all on one line, and they didn't woork for me either.
2. as you did not address point # 2, this question is only partly answered (and unsatisfactorily, I might add
--
VickiBrown - 08 Nov 2004
I didn't say it was necessarily a well thought out feature, but by design or oversite it is how the TOC functionality works and how many expect it to work.
Since there may be many current installations that use this feature to there advantage, and backward compatibility with old data is part of the
TWikiMission I don't expect it will change.
At least not in the way it works out the box in the standard distribution.
I'm sorry I don't know the code well enough to say how you could modify it in your installation to work as you want.
Perhaps someone else reading this can?
Bug 2:
Could you create example topics in the Sandbox web to demonstrate this?
I've reset this topic to
AskedQuestions until both issues are dealt with.
--
SamHasler - 08 Nov 2004
Exclude upper case from TOC: This was done by design before the
---+!! rule existed. Also, it should not affect you as long as you advere to XHTML standard, where all tags are lower case.
--
PeterThoeny - 09 Nov 2004
OK, it's a really bad design. It may be someone else's bad design, but it's still a bad design.
sigh.
It's also a bug, because lower case headers don't work either. See
VickiBrownTOCTest
--
VickiBrown - 10 Nov 2004
Sample of Bug # 2 is at
VickiBrownTOCTest2
--
VickiBrown - 10 Nov 2004