本文整理汇总了PHP中Linker::tocUnindent方法的典型用法代码示例。如果您正苦于以下问题:PHP Linker::tocUnindent方法的具体用法?PHP Linker::tocUnindent怎么用?PHP Linker::tocUnindent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Linker
的用法示例。
在下文中一共展示了Linker::tocUnindent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatHeadings
//.........这里部分代码省略.........
}
if ($toclevel) {
$prevlevel = $level;
}
$level = $matches[1][$headlineCount];
if ($level > $prevlevel) {
# Increase TOC level
$toclevel++;
$sublevelCount[$toclevel] = 0;
if ($toclevel < $wgMaxTocLevel) {
$prevtoclevel = $toclevel;
$toc .= Linker::tocIndent();
$numVisible++;
}
} elseif ($level < $prevlevel && $toclevel > 1) {
# Decrease TOC level, find level to jump to
for ($i = $toclevel; $i > 0; $i--) {
if ($levelCount[$i] == $level) {
# Found last matching level
$toclevel = $i;
break;
} elseif ($levelCount[$i] < $level) {
# Found first matching level below current level
$toclevel = $i + 1;
break;
}
}
if ($i == 0) {
$toclevel = 1;
}
if ($toclevel < $wgMaxTocLevel) {
if ($prevtoclevel < $wgMaxTocLevel) {
# Unindent only if the previous toc level was shown :p
$toc .= Linker::tocUnindent($prevtoclevel - $toclevel);
$prevtoclevel = $toclevel;
} else {
$toc .= Linker::tocLineEnd();
}
}
} else {
# No change in level, end TOC line
if ($toclevel < $wgMaxTocLevel) {
$toc .= Linker::tocLineEnd();
}
}
$levelCount[$toclevel] = $level;
# count number of headlines for each level
$sublevelCount[$toclevel]++;
$dot = 0;
for ($i = 1; $i <= $toclevel; $i++) {
if (!empty($sublevelCount[$i])) {
if ($dot) {
$numbering .= '.';
}
$numbering .= $this->getTargetLanguage()->formatNum($sublevelCount[$i]);
$dot = 1;
}
}
# The safe header is a version of the header text safe to use for links
# Remove link placeholders by the link text.
# <!--LINK number-->
# turns into
# link text with suffix
# Do this before unstrip since link text can contain strip markers
$safeHeadline = $this->replaceLinkHoldersText($headline);
# Avoid insertion of weird stuff like <math> by expanding the relevant sections
示例2: tocUnindent
public function tocUnindent($level)
{
return Linker::tocUnindent($level);
}