From 9fa736b0317d46fdfb2025895fa0288fd736ca08 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <gohr@cosmocode.de>
Date: Tue, 7 Dec 2010 16:09:01 +0100
Subject: [PATCH] Make baseonly work in allowedModes

This makes it possible to have modes that do accept headers
(baseonly) in the parser.

Related test cases are still running through but I'm not 100% sure
I did not break something here. So it should be tested a bit more.

This patch will allow plugins to wrap multiple sections, however it
also makes it possible to easily break XHTML validity, because
headers also open and close sections, so plugin authors need to be
aware!

In case you wonder: this patch is not about allowing formatting
inside headers.
---
 inc/parser/parser.php | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/inc/parser/parser.php b/inc/parser/parser.php
index 2e6b7791a..b93760f3a 100644
--- a/inc/parser/parser.php
+++ b/inc/parser/parser.php
@@ -90,7 +90,6 @@ class Doku_Parser {
             if ( $mode == 'base' ) {
                 continue;
             }
-
             $this->modes[$mode]->preConnect();
 
             foreach ( array_keys($this->modes) as $cm ) {
@@ -218,11 +217,11 @@ class Doku_Parser_Mode_footnote extends Doku_Parser_Mode {
 //-------------------------------------------------------------------
 class Doku_Parser_Mode_header extends Doku_Parser_Mode {
 
-    function preConnect() {
+    function connectTo($mode) {
         //we're not picky about the closing ones, two are enough
         $this->Lexer->addSpecialPattern(
                             '[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)',
-                            'base',
+                            $mode,
                             'header'
                         );
     }
-- 
GitLab