Skip to content

Commit

Permalink
Fix dw2pdf multipage struct output
Browse files Browse the repository at this point in the history
When the dw2pdf plugin is used to export multiple pages in a
single document, all the pages are rendered in the same context
of a single page. In order to include struct data in the PDF,
let's skip the id related checks and allow multiple pages rendered
in a single instance of syntax_plugin_struct_output.

Signed-off-by: Frieder Schrempf <dev@fris.de>
  • Loading branch information
fschrempf committed May 8, 2021
1 parent d9b413c commit 3ab6a5f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions syntax/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,20 @@ 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 the same context
* of a single page. In order to include struct data in the PDF,
* let's skip the id related checks and allow multiple pages rendered
* in a single instance of syntax_plugin_struct_output.
*/
if (!is_a($renderer, 'renderer_plugin_dw2pdf')) {
if ($ID != $INFO['id']) return true;
if (!$INFO['exists']) return true;
if ($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
Expand Down

0 comments on commit 3ab6a5f

Please sign in to comment.