page: strip nested placeholder indicators
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 15 Sep 2017 17:33:50 +0000 (19:33 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Sep 2017 18:21:28 +0000 (20:21 +0200)
Allow replacements within replacements.

page.php

index d0a8826a1106bff518009ed2da7c3303e00a786b..8b264bf7e35e6512e6ac2b6cebc8bfeeafa97f43 100644 (file)
--- a/page.php
+++ b/page.php
@@ -66,7 +66,8 @@ if ($Page) {
                $rep = [];
                foreach ($blocks as $name => $html) {
                        $rep["[[$name]]"] = sprintf('<!--BLOCK:%s-->%s<!--/-->',
-                               is_numeric($name) ? '' : "[[$name]]", $html
+                               is_numeric($name) ? '' : "[[$name]]",
+                               preg_replace('{<!--[^-]*-->}', '', $html)
                        );
                }
                return str_replace(array_keys($rep), array_values($rep), ob_get_clean());