From ef4d9d383a92a6759ee6e6b2961d5b8e1b9f5db6 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Wed, 8 Apr 2020 16:06:41 +0200 Subject: fix: SUMMARY produces invalid HTML code - add new Header class to pass clean data structures. - store all headers in the same array. (not anymore grouped by element) - modify sumparser to produce valid HTML. Fixes #81 --- app/class/Modelrender.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'app/class/Modelrender.php') diff --git a/app/class/Modelrender.php b/app/class/Modelrender.php index 29a3fa7..1721e4e 100644 --- a/app/class/Modelrender.php +++ b/app/class/Modelrender.php @@ -437,17 +437,15 @@ class Modelrender extends Modelpage $max = 6; } - $sum = []; $text = preg_replace_callback( '/(.+)<\/h[' . $min . '-' . $max . ']>/mU', - function ($matches) use (&$sum) { + function ($matches) { $cleanid = idclean($matches[4]); - $sum[$cleanid][$matches[1]] = $matches[4]; + $this->sum[] = new Header($cleanid, intval($matches[1]), $matches[4]); return '' . $matches[4] . ''; }, $text ); - $this->sum[$element] = $sum; return $text; } -- cgit v1.2.3