From 9785b7d18e7da5a6454820073a551feb3c2a8617 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Sun, 30 Oct 2016 23:49:42 +0400 Subject: [PATCH 1/2] Add param "newpagevars" for plugin newpagetemplate Fixes #66 --- syntax.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/syntax.php b/syntax.php index a9ba038..98d73ed 100644 --- a/syntax.php +++ b/syntax.php @@ -49,6 +49,7 @@ public function connectTo($mode) { * {{NEWPAGE#newtpl1,newtpl2}} * {{NEWPAGE#newtpl1|Title1,newtpl2|Title1}} * {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1}} + * {{NEWPAGE>your:namespace#newtpl1|Title1,newtpl2|Title1#@HI@,Howdy}} * * @param string $match The text matched by the patterns * @param int $state The lexer state for the match @@ -60,14 +61,16 @@ public function connectTo($mode) { public function handle($match, $state, $pos, Doku_Handler $handler) { /* @codingStandardsIgnoreEnd */ $options = substr($match, 9, -2); // strip markup - $options = explode('#', $options, 2); + $options = explode('#', $options, 3); $namespace = trim(ltrim($options[0], '>')); $templates = explode(',', $options[1] ?? ''); $templates = array_map('trim', $templates); + $newpagevars = trim($options[2]); return array( 'namespace' => $namespace, - 'newpagetemplates' => $templates + 'newpagetemplates' => $templates, + 'newpagevars' => $newpagevars ); } @@ -102,6 +105,7 @@ public function render($mode, Doku_Renderer $renderer, $data) { . DOKU_TAB . DOKU_TAB . $namespaceinput . DOKU_LF . DOKU_TAB . DOKU_TAB . '' . DOKU_LF . $newpagetemplateinput + . DOKU_TAB . DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB . '' . DOKU_LF . DOKU_TAB . DOKU_TAB . '' . DOKU_LF From 9418ebb801290cfb39b21fcf66b7ff91b61c4bba Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Sun, 7 May 2023 18:17:18 +0200 Subject: [PATCH 2/2] Avoid undefined array key error --- syntax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/syntax.php b/syntax.php index 98d73ed..10860a9 100644 --- a/syntax.php +++ b/syntax.php @@ -66,7 +66,7 @@ public function handle($match, $state, $pos, Doku_Handler $handler) { $namespace = trim(ltrim($options[0], '>')); $templates = explode(',', $options[1] ?? ''); $templates = array_map('trim', $templates); - $newpagevars = trim($options[2]); + $newpagevars = trim($options[2] ?? ''); return array( 'namespace' => $namespace, 'newpagetemplates' => $templates,