Answer the question
In order to leave comments, you need to log in
Custom prefix for content element in mediawiki
Task:
on a page in mediawiki, set the root index (prefix) to the number in the content, i.e. for example, somehow set the initial index to 4.1 and then in the content, and on the page
== First element ==
Will look like 4.1.1
== Second element ==
Will look like 4.1.2
=== First subelement of the second element = ==
Would look like 4.1.2.1
Is this even feasible? I looked through the documentation and didn't find anything like it.
Now I have to install _NOTOC_ and generate content manually, which is not very convenient.
Answer the question
In order to leave comments, you need to log in
I also faced the same problem... search on the Internet didn't give anything... I had to do it myself :)
In general, you need to edit the code a little:
/w/includes/parser/Parser.php
$toc .= Linker::tocLine( $anchor, $tocline,
$numbering, $toclevel, ( $isTemplate ? false : $sectionIndex ) );
if (!empty($tocline)) {
$toc .= Linker::tocLine( $anchor, $tocline,
$numbering, $toclevel, ( $isTemplate ? false : $sectionIndex ) );
}
$head[$headlineCount] = Linker::makeHeadline( $level,
$matches['attrib'][$headlineCount], $anchor, $headline,
$editlink, $legacyAnchor );
if (!empty($tocline)) {
$head[$headlineCount] = Linker::makeHeadline( $level,
$matches['attrib'][$headlineCount], $anchor, $headline,
$editlink, $legacyAnchor );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question