Commit a5dc5a73 authored by Andreas Gohr's avatar Andreas Gohr

we don't need to handle the headers ourselves

We can simply add baseonly as allowed and let headers do their own
thing.
parent d82cb568
......@@ -6,7 +6,9 @@
["cdata", ["1abc"]],
["p_close", []],
["plugin", ["ifauthex", [1, " admin"], 1, "<ifauth admin>"]],
["section_close", []],
["header", ["Sec 2", 3, 40]],
["section_open", [3]],
["p_open", []],
["plugin", ["ifauthex", [3, "2def"], 3, "2def"]],
["p_close", []],
......@@ -19,7 +21,9 @@
["cdata", ["3ghi"]],
["p_close", []],
["plugin", ["ifauthex", [1, " admina"], 1, "<ifauth admina>"]],
["section_close", []],
["header", ["Sec 4", 3, 114]],
["section_open", [3]],
["p_open", []],
["plugin", ["ifauthex", [3, "4jkl"], 3, "4jkl"]],
["p_close", []],
......
......@@ -24,7 +24,7 @@ class syntax_plugin_ifauthex extends DokuWiki_Syntax_Plugin
/** @inheritDoc */
function getAllowedTypes()
{
return array('container', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs');
return array('container', 'formatting', 'substition', 'protected', 'disabled', 'paragraphs', 'baseonly');
}
/** @inheritDoc */
......@@ -49,7 +49,6 @@ class syntax_plugin_ifauthex extends DokuWiki_Syntax_Plugin
public function postConnect()
{
$this->Lexer->addExitPattern('</ifauth>', 'plugin_ifauthex');
$this->Lexer->addPattern('[ \t]*={2,}[^\n]+={2,}[ \t]*(?=\n)', 'plugin_ifauthex');
}
/** @inheritDoc */
......@@ -69,20 +68,6 @@ class syntax_plugin_ifauthex extends DokuWiki_Syntax_Plugin
}
return array($state, null);
case DOKU_LEXER_MATCHED:
// source of the following solution: plugin wrap
// we have a == header ==, use the core header() renderer
// (copied from core header() in inc/parser/handler.php)
$title = trim($match);
$level = 7 - strspn($title,'=');
if($level < 1) $level = 1;
$title = trim($title,'=');
$title = trim($title);
$handler->_addCall('header',array($title,$level,$pos), $pos);
// close the section edit the header could open
# if ($title && $level <= $conf['maxseclevel']) {
# $handler->addPluginCall('ifauthex_closesection', array(), DOKU_LEXER_SPECIAL, $pos, '');
# }
break;
case DOKU_LEXER_UNMATCHED:
return array($state, $match);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment