1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-10-31 21:33:00 +00:00

Bugfix: Banish erroneous additional entries in complex tables of contents

This commit is contained in:
Starbeamrainbowlabs 2022-02-18 23:59:42 +00:00
parent 9112884949
commit ae4d03da17
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 4 additions and 1 deletions

View file

@ -20,6 +20,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- [security] Ensure that Javascript in SVGs never gets executed (it's too challenging to strip it, since it could be lurking in many different places - according to [this answer](https://stackoverflow.com/a/68505306/1460422) even Inkscape doesn't strip all Javascript when asked to)
- [security] Fixed XSS when the `action` GET param doesn't match a known action
- StorageBox: create SQLite DB ifi it doesn't exist explicitly with `touch()`, because some systems are weird
- Fixed erroneous additional entries in complex tables of contents
## v0.23

View file

@ -5,7 +5,7 @@
register_module([
"name" => "Parsedown",
"version" => "0.11.4",
"version" => "0.11.5",
"author" => "Emanuil Rusev & Starbeamrainbowlabs",
"description" => "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https://github.com/erusev/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
"extra_data" => [
@ -1477,12 +1477,14 @@ class PeppermintParsedown extends ParsedownExtra
private function insertTableOfContentsObject(object $obj, object $target) {
if($obj->level - 1 > $target->level && !empty($target->children)) {
$this->insertTableOfContentsObject($obj, end($target->children));
return;
}
$target->children[] = $obj;
}
protected function generateTableOfContents() : string {
global $settings;
error_log(var_export($this->tableOfContents, true));
$elements = [ $this->generateTableOfContentsElement($this->tableOfContents) ];
if($settings->parser_toc_heading_level > 1)
array_unshift(