From 6b37aa9a045e59830efdc2d77a0384b31ae8a510 Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Mon, 19 Jul 2004 05:15:50 +0000 Subject: [PATCH] New global config setting $wgMaxTocLevel: Maximum indent level of toc. --- includes/DefaultSettings.php | 3 +++ includes/Parser.php | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index eb9c1d19f6..905518e42b 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -442,4 +442,7 @@ $wgExtraRandompageSQL = false; # Allow the "info" action, very inefficient at the moment $wgAllowPageInfo = false; + +# Maximum indent level of toc. +$wgMaxTocLevel = 999; ?> diff --git a/includes/Parser.php b/includes/Parser.php index 1d36b397f1..5ee377873e 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1848,7 +1848,7 @@ class Parser */ /* private */ function formatHeadings( $text, $isMain=true ) { - global $wgInputEncoding; + global $wgInputEncoding, $wgMaxTocLevel; $doNumberHeadings = $this->mOptions->getNumberHeadings(); $doShowToc = $this->mOptions->getShowToc(); @@ -1990,7 +1990,7 @@ class Parser if($refcount[$headlineCount] > 1 ) { $anchor .= '_' . $refcount[$headlineCount]; } - if( $doShowToc ) { + if( $doShowToc && ( !isset($wgMaxTocLevel) || $toclevel<$wgMaxTocLevel ) ) { $toc .= $sk->tocLine($anchor,$tocline,$toclevel); } if( $showEditLink ) { -- 2.20.1