[Mediawiki-l] short headers in TOC

Frederick Grose fgrose at gmail.com
Tue Jul 20 02:01:18 UTC 2010


On Mon, Jul 19, 2010 at 7:53 PM, Platonides <Platonides at gmail.com> wrote:

> Scheid, Bernhard wrote:
> > Sounds interesting but a bit arcane. I found  the tocLine() function in
> my Linker.php, but the problem seems to me how to define/override the
> $tocline parameter.
> > Can you give me some more detailled advice? New skin would be no problem,
> btw...
> >
> > B.
>
> The skins inherit from the linker.
> You could create a skin (supposing you want it to look like the vector
> skin) by putting in the appropiate file in the skins folder something
> like this:
>
> require_once "Vector.php";
> class SkinBernhard extends SkinVector {
>        var $skinname = 'bernhardtoc';
>
>  function tocLine( $anchor, $tocline, $tocnumber, $level, $sectionIndex
> = false ) {
>                $n = strpos($tocline, '  ');
>                if ($n !== false) $tocline = substr( $tocline, 0, $n );
>                return parent::tocLine($anchor, $tocline, $tocnumber,
> $level,
> $sectionIndex);
>        }
> }
>
> In this case, if the has a double space, the toc only shows the text
> that appears before that.


This would be a valuable feature to make part of the standard software.  It
would provide a way to collapse TOC boxes made suddenly wide, and obscuring
of page content, by the insertion of a long section header.

Is there a CSS or JS method we could employ for those without access to the
Skins folder?

        --Fred


More information about the MediaWiki-l mailing list