summaryrefslogtreecommitdiff
path: root/inc/parser
diff options
context:
space:
mode:
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() {