Tags:
create new tag
view all tags
Since TWiki.org has been updated with the CVS version (a few days ago), the Table of Contents on some TWiki pages is displaying poorly -- in fact, it looks like this:

The Problem

Contents

One Fix

Oops, this attempt to display the three alternatives will not work (I guess RichardDonkin recognized that) because the problem occurs as soon as "Contents" is recognized as a heading to be included in the TOC. If someone really wants to see the different results, they can edit this page to try out the variations, or compare the results on some other pages. I'll add some links here next time I find them.

Contents

  • Fixed this by using lower case 'h3' for Contents header - see below. [ RichardDonkin ] Aside, this did work (until I reedited the page), but I'm surprised -- does this mean that currently <hn> tags display as a heading but are not included in the TOC? That is the opposite of the original loophole. -- RandyKramer

My Preferred Fix (keeps "contents" out of TOC)

Contents

  • Fixed by using "*" to make "contents" bold, but not a heading.

This is because I have been using a "loophole" of the old TWiki code which ignored <Hn> in making the table of contents -- if I wanted a heading to not appear in the table of contents I could enclose it in <Hn> tags.

Apparently this loophole has been closed, so something should be done to fix all the pages that used that loophole.

The thing I would like to see done (I think) is convert all the occurrences of <H3>Contents</H3> (ignore the <nop>s) to *Contents*.

I am starting to work on a cgi sed script to do this, but somebody else may actually be able to accomplish the necessary results much faster (and I may not be able to run it all on TWiki because I may not have the necessary privileges on twiki.org).

I am using the page Wikilearn.LinuxCommandsOnTWiki as my scratchpad to develop the necessary script, if you want to check on my progress and/or actually run the script.

Although most of the pages affected are on Wikilearn, there are pages on the other webs, like TWikiOnSourceForge. If anybody runs a script to correct the pages on any webs, I would appreciate it if you would run the script on the Wikilearn web as well.

Test Heading 1

Test Heading 2

-- RandyKramer - 05 Apr 2002

There is another anomaly -- don't know whether it is related or not -- see TWiki.FileAttachment and notice that "Comments & Questions about the Documentation in this Section" appears twice in the document -- once after the TOC and again at the end of the document. I doubt this is related, but I just noticed it and haven't tried to figure it out at all.

PS: I doubt that I'll make much progress soon on the script I'm talking about in the first section, so if anybody else can fix the problem globally, that would be great!!

-- RandyKramer - 05 Apr 2002

This is a bug that happens when people use upper case HTML headings, e.g. <H3> not <h3>. The latter is recommended anyway since it's XHTML compliant, but I have fixed this in CVS for the TWikiAlphaRelease with an update to TWiki.pm - the relevant code was not doing case-insensitive matching.

I've also fixed TWiki.DocsComments to use lower case H3 tags, avoiding this problem on the documentation pages.

As for your conversion script, here's one to make the existing heading tags appear properly in the TOC, working around this bug - you could do something similar to just replace the heading tags with '*' characters (simply put \* on the right hand side of the substitute operator):

$ perl -pi~ 's!(</?H[1-9]>)!\L$1\E!g' *.txt
The s!!! operator matches and lowercases the appropriate <Hn> tags - this edits a whole set of files in-place. See WindowsInstallCookbook for some other examples.

-- RichardDonkin - 06 Apr 2002

Richard,

Thanks for your help! IIUC, the fix you put in CVS will make the behavior revert to the old behavior? (That is, something surrounded by <Hn> tags will be formatted as a heading but will not be included in the TOC?) If that is the case, I'll probably not worry too urgently about changing all the existing pages, but hope that PeterThoeny updates twiki.org again, fairly soon. (I prefer the old behavior -- if that is going to be restored, I'll just wait for it.)

In the meantime, I have noted your Perl example and have taken it over to Wikilearn.LinuxCommandsOnTWiki where I will continue to "contemplate" making the change.

-- RandyKramer - 06 Apr 2002

My bug fix only fixes the bug (i.e. the fact that <H3> breaks TWiki rendering) - if it did any more, e.g. reverting to some other behaviour, it would be a feature enhancement...

-- RichardDonkin - 06 Apr 2002

Follow up in SpecificHeadingsExcludedFromTOC

-- PeterThoeny - 09 Apr 2002

Edit | Attach | Watch | Print version | History: r13 < r12 < r11 < r10 < r9 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r13 - 2002-08-24 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.