Skip to content

Commit

Permalink
extract a slice of headingCount
Browse files Browse the repository at this point in the history
As reported in #1, memory error  may happen on line 115. It is not clear why it happens, anyway rewrite code using array_slice
  • Loading branch information
ssahara committed May 27, 2019
1 parent 6f59357 commit 1e137f7
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions syntax.php
Expand Up @@ -110,11 +110,8 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
}

// build tiered numbers for hierarchical headings
$numbers = [];
for ($i = $this->startlevel; $i <= $level; $i++) {
$numbers[] = $this->headingCount[$i];
}
if ($numbers) {
if ($this->startlevel <= $level) {
$numbers = array_slice($this->headingCount, $this->startlevel -1, $level - $this->startlevel +1);
$tieredNumber = implode('.', $numbers);
if (count($numbers) == 1) {
// append always tailing dot for single tiered number
Expand Down

0 comments on commit 1e137f7

Please sign in to comment.