summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorChristopher Smith <chris@jalakai.co.uk>2010-09-18 18:13:59 +0100
committerChristopher Smith <chris@jalakai.co.uk>2010-09-18 18:13:59 +0100
commitf4daa9a18d9c09a1bac0696d92e2bceef8a6800f (patch)
treec0cbc46f969dd03f36116acfc6cb56b7b6ea677d /inc/parser
parent3cf900244031048d73d8dc9cc4ae32a9362dca59 (diff)
downloadrpg-f4daa9a18d9c09a1bac0696d92e2bceef8a6800f.tar.gz
rpg-f4daa9a18d9c09a1bac0696d92e2bceef8a6800f.tar.bz2
#1797 fix ptype stack to properly close and reopen <p> elements
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php23
1 files changed, 16 insertions, 7 deletions
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) {