diff options
author | n-peugnet <n.peugnet@free.fr> | 2020-04-08 16:06:41 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2020-04-08 16:06:41 +0200 |
commit | ef4d9d383a92a6759ee6e6b2961d5b8e1b9f5db6 (patch) | |
tree | ed95ee51af8910e0c13862dcd842fd0f6e194635 /app/class/Modelrender.php | |
parent | b49830232096951202688bd775193424880bbd11 (diff) | |
download | wcms-ef4d9d383a92a6759ee6e6b2961d5b8e1b9f5db6.tar.gz wcms-ef4d9d383a92a6759ee6e6b2961d5b8e1b9f5db6.zip |
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
Diffstat (limited to 'app/class/Modelrender.php')
-rw-r--r-- | app/class/Modelrender.php | 6 |
1 files changed, 2 insertions, 4 deletions
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 . '])(\s+(\s*\w+="\w+")*)?\s*>(.+)<\/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 '<h' . $matches[1] . $matches[2] . ' id="' . $cleanid . '">' . $matches[4] . '</h' . $matches[1] . '>'; }, $text ); - $this->sum[$element] = $sum; return $text; } |