Fix automatic table of contents, fixes #421
This commit is contained in:
parent
e5c7747884
commit
be6438aca5
@ -113,6 +113,8 @@ class Processor implements DocumentProcessorInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Make a tree of the list of headings
|
||||||
|
*
|
||||||
* @param Entry[] $headings
|
* @param Entry[] $headings
|
||||||
* @return RootEntry
|
* @return RootEntry
|
||||||
*/
|
*/
|
||||||
@ -125,7 +127,7 @@ class Processor implements DocumentProcessorInterface
|
|||||||
$parent = $previous;
|
$parent = $previous;
|
||||||
do {
|
do {
|
||||||
$parent = $parent->getParent();
|
$parent = $parent->getParent();
|
||||||
} while ($heading->getLevel() <= $parent->getLevel() || $parent->getLevel() != 0);
|
} while ($heading->getLevel() <= $parent->getLevel() && $parent->getLevel() != 0);
|
||||||
|
|
||||||
$parent->addChild($heading);
|
$parent->addChild($heading);
|
||||||
$previous = $heading;
|
$previous = $heading;
|
||||||
|
Loading…
Reference in New Issue
Block a user