From f4daa9a18d9c09a1bac0696d92e2bceef8a6800f Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 18 Sep 2010 18:13:59 +0100 Subject: #1797 fix ptype stack to properly close and reopen

elements --- inc/parser/handler.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'inc/parser') diff --git a/inc/parser/handler.php b/inc/parser/handler.php index 0b8b79254..acca3f5a1 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -1543,14 +1543,12 @@ class Doku_Handler_Block { // Process blocks which are stack like... (contain linefeeds) if ( in_array($cname,$this->stackOpen ) && (!$plugin || $plugin_open) ) { - $this->calls[] = $call; - // Hack - footnotes shouldn't immediately contain a p_open - if ( $cname != 'footnote_open' ) { - $this->addToStack(); - } else { - $this->addToStack(false); + if ($this->addToStack($cname != 'footnote_open')) { + $this->closeParagraph($call[2]); } + $this->calls[] = $call; + continue; } @@ -1560,7 +1558,9 @@ class Doku_Handler_Block { $this->closeParagraph($call[2]); } $this->calls[] = $call; - $this->removeFromStack(); + if ($this->removeFromStack()) { + $this->calls[] = array('p_open',array(), $call[2]); + } continue; } @@ -1676,16 +1676,25 @@ class Doku_Handler_Block { return $this->calls; } + /** + * + * @return bool true when a p_close() is required + */ function addToStack($newStart = true) { + $ret = $this->inParagraph; $this->blockStack[] = array($this->atStart, $this->inParagraph); $this->atStart = $newStart; $this->inParagraph = false; + + return $ret; } function removeFromStack() { $state = array_pop($this->blockStack); $this->atStart = $state[0]; $this->inParagraph = $state[1]; + + return $this->inParagraph; } function addCall($call) { -- cgit v1.2.3 From 15f1b77cd64a0f676733cf10227129deffcc922b Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 2 Oct 2010 19:48:26 +0200 Subject: more relaxed recognition of windows share links FS#1991 --- inc/parser/handler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/parser') diff --git a/inc/parser/handler.php b/inc/parser/handler.php index acca3f5a1..a96e6b9db 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -440,7 +440,7 @@ class Doku_Handler { array($link[0],$link[1],strtolower($interwiki[0]),$interwiki[1]), $pos ); - }elseif ( preg_match('/^\\\\\\\\[\w.:?\-;,]+?\\\\/u',$link[0]) ) { + }elseif ( preg_match('/^\\\\\\\\[^\\\\]+?\\\\/u',$link[0]) ) { // Windows Share $this->_addCall( 'windowssharelink', -- cgit v1.2.3 From 6d58f7821f530c90900d3cda301f9e22026c5fcb Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 3 Oct 2010 15:33:32 +0100 Subject: No need for a self include ;) --- inc/parser/renderer.php | 1 - 1 file changed, 1 deletion(-) (limited to 'inc/parser') diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 7e52cfce2..81c33fe62 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -6,7 +6,6 @@ * @author Andreas Gohr */ if(!defined('DOKU_INC')) die('meh.'); -require_once DOKU_INC . 'inc/parser/renderer.php'; require_once DOKU_INC . 'inc/plugin.php'; require_once DOKU_INC . 'inc/pluginutils.php'; -- cgit v1.2.3 From c2122b83f7b1516bad0b5be5d9c617cffcec8f9d Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 3 Oct 2010 16:44:58 +0100 Subject: FS#1995, add a little defense to avoid warnings caused by bad wiki syntax --- inc/parser/renderer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'inc/parser') diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 81c33fe62..b54ccf050 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -74,7 +74,9 @@ class Doku_Renderer extends DokuWiki_Plugin { foreach ( $instructions as $instruction ) { // execute the callback against ourself - call_user_func_array(array(&$this, $instruction[0]),$instruction[1]); + if (method_exists($this,$instruction[0])) { + call_user_func_array(array($this, $instruction[0]),$instruction[1]); + } } } -- cgit v1.2.3