1<?php
2/**
3 * Info Plugin: Displays information about various DokuWiki internals without "start" page
4 * Based on: nslist plugin by Andreas Gohr <andi@splitbrain.org>
5 *
6 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
7 * @author     Zaher Dirkey <zaherdirkey@yahoo.com>
8 * @similar to http://www.dokuwiki.org/plugin:clearfloat
9 * @desc use \\\ at end of line to add clearer tag with break
10 * url: http://www.dokuwiki.org/plugin:clearer
11 */
12
13/*todo
14  add carrier return for windows file \n?\r
15*/
16
17if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
18if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/');
19require_once(DOKU_PLUGIN.'syntax.php');
20
21class syntax_plugin_clearer extends DokuWiki_Syntax_Plugin {
22
23  function getInfo(){
24        return array(
25            'author' => 'Zaher Dirkey',
26            'email'  => 'zaherdirkey@yahoo.com',
27            'date'   => '2020-11-15',
28            'name'   => 'Clearer',
29            'desc'   => 'Add clearer div class using \\\ chars before new line char.',
30            'url'    => 'http://dokuwiki.org/plugin:clearer',
31        );
32    }
33    function getType(){
34        return 'substition';
35    }
36    function getPType(){
37        return 'block';
38    }
39    function getSort(){
40        return 138;
41    }
42    function connectTo($mode) {
43        $this->Lexer->addSpecialPattern('\x5C{3}\n', $mode, 'plugin_clearer');
44    }
45    function handle($match, $state, $pos, Doku_Handler $handler){
46        return array($match, $state, $pos);
47    }
48    function render($format, Doku_Renderer $renderer, $data) {
49            if ($format == 'xhtml') {
50         $renderer->doc .= '<div class="clearer" ></div>';
51        return true;
52      }
53      return false;
54    }
55}
56