page: prevent reparsing of placeholder blocks v3.8
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 26 Nov 2018 17:28:37 +0000 (18:28 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 27 Nov 2018 00:04:17 +0000 (01:04 +0100)
Quick hack to support consecutive calls of getoutput() on news pages,
ignoring the original placeholder in inserted block comments and resulting
<!--BLOCK:<!--BLOCK:[[nieuws]]-->-->… output.

page.php

index 175c2eb30f71e51c3cbf1509425b1e2987221953..9c88e79adef63baae3a0c04efad458e186108077 100644 (file)
--- a/page.php
+++ b/page.php
@@ -53,7 +53,7 @@ function getoutput($blocks = [])
        }
 
        return preg_replace_callback(
-               '< \[\[ ([^] ]+) ([^]]*) \]\] >x',
+               '{ (?<! <!--BLOCK: ) \[\[ ([^] ]+) ([^]]*) \]\] }x',
                function ($sub) use ($blocks) {
                        list ($placeholder, $name, $params) = $sub;
                        if (isset($blocks[$name])) {