From 05e773de34da0f903c6ddb41ba6a462970db5ffc Mon Sep 17 00:00:00 2001 From: Frieder Schrempf Date: Sat, 8 May 2021 16:52:57 +0200 Subject: [PATCH] Fix dw2pdf multipage struct output When the dw2pdf plugin is used to export multiple pages in a single document, all the pages are rendered in a single instance of syntax_plugin_struct_output. We want to allow this usecase and only skip repeated calls for non-dw2pdf renderings. Signed-off-by: Frieder Schrempf --- syntax/output.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/syntax/output.php b/syntax/output.php index 2037fdd2..2846a7ec 100644 --- a/syntax/output.php +++ b/syntax/output.php @@ -98,9 +98,19 @@ public function render($format, Doku_Renderer $renderer, $data) return true; } } + if ($ID != $INFO['id']) return true; if (!$INFO['exists']) return true; - if ($this->hasBeenRendered) return true; + + /* + * When the dw2pdf plugin is used to export multiple pages in a + * single document, all the pages are rendered in a single instance + * of syntax_plugin_struct_output. We want to allow this usecase and + * only skip repeated calls for non-dw2pdf renderings. + */ + if (!is_a($renderer, 'renderer_plugin_dw2pdf') && $this->hasBeenRendered) + return true; + if (!preg_match(self::WHITELIST_ACTIONS, act_clean($ACT))) return true; // do not render the output twice on the same page, e.g. when another page has been included