aboutsummaryrefslogtreecommitdiff
path: root/app/class/Modelrender.php
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2020-04-08 16:06:41 +0200
committern-peugnet <n.peugnet@free.fr>2020-04-08 16:06:41 +0200
commitef4d9d383a92a6759ee6e6b2961d5b8e1b9f5db6 (patch)
treeed95ee51af8910e0c13862dcd842fd0f6e194635 /app/class/Modelrender.php
parentb49830232096951202688bd775193424880bbd11 (diff)
downloadwcms-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.php6
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;
}