1<?php 2/* 3 * Autolinks enclosed in <...> 4 */ 5 6if(!defined('DOKU_INC')) die(); 7if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 8require_once(DOKU_PLUGIN.'syntax.php'); 9 10class syntax_plugin_markdowku_autolinks extends DokuWiki_Syntax_Plugin { 11 12 function getType() { return 'substition'; } 13 function getPType() { return 'normal'; } 14 function getSort() { return 102; } 15 16 function connectTo($mode) { 17 $this->Lexer->addSpecialPattern( 18 '<(?:https?|ftp|mailto):[^\'">\s]+?>', 19 $mode, 20 'plugin_markdowku_autolinks' 21 ); 22 } 23 24 function handle($match, $state, $pos, Doku_Handler $handler) { 25 if (preg_match('/^<mailto:/', $match)) { 26 $match = substr($match, 8, -1); 27 $handler->_addCall('emaillink', array($match, NULL), $pos); 28 } else { 29 $match = substr($match, 1, -1); 30 $handler->_addCall('externallink', array($match, NULL), $pos); 31 } 32 33 return true; 34 } 35 36 function render($mode, Doku_Renderer $renderer, $data) { 37 return true; 38 } 39} 40//Setup VIM: ex: et ts=4 enc=utf-8 : 41