1<?php 2/** 3 * @file divalign2/syntax/justify.php 4 * @brief Justify alignment component for divalign2 plugin. 5 * 6 * See common.php for more information. 7 */ 8 9// must be run within DokuWiki 10if(!defined('DOKU_INC')) die(); 11if(!defined('DW_LF')) define('DW_LF',"\n"); 12 13if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 14require_once(DOKU_PLUGIN.'syntax.php'); 15require_once(DOKU_PLUGIN. 'divalign2/common.php'); // for common functions 16 17/** 18 * All DokuWiki plugins to extend the parser/rendering mechanism 19 * need to inherit from this class 20 */ 21class syntax_plugin_divalign2_justify extends syntax_plugin_divalign2_common { 22 function connectTo($mode) { 23 $this->Lexer->addEntryPattern('###(?=.+\n###)', 24 $mode,'plugin_divalign2_justify'); 25 } 26 27 function postConnect() { 28 $this->Lexer->addExitPattern('\n###', 29 'plugin_divalign2_justify'); 30 } 31 32 function handle($match, $state, $pos, Doku_Handler $handler){ 33 $align= 'justify'; 34 $content= $match; 35 $match= array ('content' => $content, 'align'=>$align); 36 parent::handle($match, $state, $pos, $handler); 37 return array($align,$state,$pos); 38 } 39 40} 41