left.php 1.2 KB

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