summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
authorchris <chris@jalakai.co.uk>2006-08-09 17:54:17 +0200
committerchris <chris@jalakai.co.uk>2006-08-09 17:54:17 +0200
commit2fe7363dd1d999395d0bc0067171e212f0a75d05 (patch)
tree1ac3d7866877fa4e858240930ea61d32ebb2b2d1 /inc/parser
parent43e1f4d9a1db477e01036ca9b497e5218cb87c82 (diff)
downloadrpg-2fe7363dd1d999395d0bc0067171e212f0a75d05.tar.gz
rpg-2fe7363dd1d999395d0bc0067171e212f0a75d05.tar.bz2
fix for footnote nesting
darcs-hash:20060809155417-9b6ab-c88a818425487cac0cd1f8d7cd266ac088bba16c.gz
Diffstat (limited to 'inc/parser')
-rw-r--r--inc/parser/handler.php19
-rw-r--r--inc/parser/parser.php2
2 files changed, 20 insertions, 1 deletions
diff --git a/inc/parser/handler.php b/inc/parser/handler.php
index 4b090b9ef..7e6a7b847 100644
--- a/inc/parser/handler.php
+++ b/inc/parser/handler.php
@@ -192,13 +192,32 @@ class Doku_Handler {
function footnote($match, $state, $pos) {
// $this->_nestingTag($match, $state, $pos, 'footnote');
+ static $footnote = false;
+
switch ( $state ) {
case DOKU_LEXER_ENTER:
+ // footnotes can not be nested - however due to limitations in lexer it can't be prevented
+ // we will still enter a new footnote mode, we just do nothing
+ if ($footnote) {
+ $this->_addCall('cdata',array($match), $pos);
+ break;
+ }
+
+ $footnote = true;
+
$ReWriter = & new Doku_Handler_Nest($this->CallWriter,'footnote_close');
$this->CallWriter = & $ReWriter;
$this->_addCall('footnote_open', array(), $pos);
break;
case DOKU_LEXER_EXIT:
+ // check whether we have already exitted the footnote mode, can happen if the modes were nested
+ if (!$footnote) {
+ $this->_addCall('cdata',array($match), $pos);
+ break;
+ }
+
+ $footnote = false;
+
$this->_addCall('footnote_close', array(), $pos);
$this->CallWriter->process();
$ReWriter = & $this->CallWriter;
diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 2f6588d71..b5fb6ed23 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -197,6 +197,7 @@ class Doku_Parser_Mode_footnote extends Doku_Parser_Mode {
$PARSER_MODES['disabled']
);
+ unset($this->allowedModes[array_search('footnote', $this->allowedModes)]);
}
function connectTo($mode) {
@@ -209,7 +210,6 @@ class Doku_Parser_Mode_footnote extends Doku_Parser_Mode {
$this->Lexer->addExitPattern(
'\x29\x29','footnote'
);
-
}
function getSort() {