Loading _test/testpage.json +4 −0 Original line number Diff line number Diff line Loading @@ -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", []], Loading @@ -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", []], Loading syntax.php +1 −16 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 */ Loading @@ -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); Loading Loading
_test/testpage.json +4 −0 Original line number Diff line number Diff line Loading @@ -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", []], Loading @@ -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", []], Loading
syntax.php +1 −16 Original line number Diff line number Diff line Loading @@ -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 */ Loading @@ -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 */ Loading @@ -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); Loading