*/ class syntax_plugin_qna_block extends DokuWiki_Syntax_Plugin { private $mode; private $questionId; private $maxIdLength; /** * Constructor */ public function __construct() { $this->mode = substr(get_class($this), 7); $this->questionId = array(); $this->maxIdLength = 30; } /** * What kind of syntax are we? */ public function getType() { return 'container'; } public function getPType() { return 'block'; } /** * Where to sort in? */ public function getSort() { return 55; } /** * */ public function connectTo($mode) { $this->Lexer->addSpecialPattern('\n\?{3}.*?(?=\n)', $mode, $this->mode); $this->Lexer->addSpecialPattern('\n!{3}', $mode, $this->mode); } /** * */ public function handle($match, $state, $pos, Doku_Handler $handler) { if ($state == DOKU_LEXER_SPECIAL) { if ($match[1] == '?') { $question = trim(substr($match, 4)); if ($question != '') { $identifier = $this->questionToIdentifier($question); $data = array('open_question', $question, $identifier); } else { $data = array('close_block'); } } else { $data = array('open_answer'); } } else { $data = false; } return $data; } /** * */ public function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { list($tag, $style) = explode('_', $data[0]); if ($tag == 'open') { $renderer->doc .= '