[Hamara-devel] Fwd: Re: [MediaWiki-l] how to make mediawiki make TOC with less than 4 sections ?

shirish shirish at hamaralinux.org
Thu Oct 15 18:35:33 BST 2015


Cannot do less than 4 sections/headers for a wiki entry. Having sections 
and sub-sections in a wiki page is good so it's handy URL to point 
people to.

That's why I had asked on mediawiki-l and now to know that it's a 
hardcoded thing, although thankfully we could rely on _TOC_ or 
_FORCETOC_ if we really need it (I don't like forcing stuff) but anyways 
it is as it is.


-------- Forwarded Message --------
Subject: Re: [MediaWiki-l] how to make mediawiki make TOC with less than 
4 sections ?
Date: Thu, 15 Oct 2015 19:25:53 +0200
From: Bartosz Dziewoński <matma.rex at gmail.com>
To: MediaWiki announcements and site admin list 
<mediawiki-l at lists.wikimedia.org>, shirish at hamaralinux.org

On 2015-10-14 16:44, shirish wrote:
> Hi all,
>
> A temporary way to generate Table of Contents (TOC) is to write
> __FORCETOC__ or _TOC_ before starting the page but what if we don't want
> that. Let's say we want to have all and any pages that has more than 2
> sections should have a TOC. Is there a way to do it ?

Sadly no, it's hardcoded in Parser.php.

# if there are fewer than 4 headlines in the article, do not show TOC
# unless it's been explicitly enabled.
$enoughToc = $this->mShowToc &&
	( ( $numMatches >= 4 ) || $this->mForceTocPosition );

-- 
Bartosz Dziewoński




More information about the Hamara-devel mailing list