plugin:linkext
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:linkext [2007-02-12 06:26] – ShTiRLiC | plugin:linkext [2009-10-06 10:01] (current) – tag cleanup laynee | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Summary ====== | ||
+ | ---- plugin ---- | ||
+ | description: | ||
+ | author | ||
+ | email : ShTiRLiC@shtirlic.com | ||
+ | type : syntax | ||
+ | lastupdate : 2007-02-12 | ||
+ | compatible : | ||
+ | depends | ||
+ | conflicts | ||
+ | similar | ||
+ | tags : links, MediaWiki | ||
+ | ---- | ||
+ | |||
+ | This plugin concatenates part of word after internal link and its body (like in MediaWiki) so when you write < | ||
+ | |||
+ | This is my first plugin so it may work bad but I hope it'll be useful. | ||
+ | |||
+ | You may download it from [[http:// | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | /** | ||
+ | * Plugin Linkext: merges links body and its end. | ||
+ | * | ||
+ | * @license | ||
+ | * @author | ||
+ | */ | ||
+ | |||
+ | // must be run within DokuWiki | ||
+ | if(!defined(' | ||
+ | |||
+ | if(!defined(' | ||
+ | require_once(DOKU_PLUGIN.' | ||
+ | |||
+ | /** | ||
+ | * All DokuWiki plugins to extend the parser/ | ||
+ | * need to inherit from this class | ||
+ | */ | ||
+ | class syntax_plugin_linkext extends DokuWiki_Syntax_Plugin { | ||
+ | |||
+ | function getInfo(){ | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | function getType() | ||
+ | { | ||
+ | return ' | ||
+ | } | ||
+ | |||
+ | function getSort() | ||
+ | { | ||
+ | return 51; | ||
+ | } | ||
+ | |||
+ | function connectTo($mode) | ||
+ | { | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | function handle($match, | ||
+ | { | ||
+ | if ($state == DOKU_LEXER_SPECIAL) | ||
+ | { | ||
+ | preg_match('/ | ||
+ | return array($state, | ||
+ | } | ||
+ | else | ||
+ | return array($match, | ||
+ | } | ||
+ | |||
+ | function render($mode, | ||
+ | { | ||
+ | if($mode == ' | ||
+ | { | ||
+ | list($state, | ||
+ | $spos = strrpos($match[1], | ||
+ | if (!is_bool($spos)) | ||
+ | $caption = substr($match[1], | ||
+ | else | ||
+ | $caption = $match[1]; | ||
+ | if ($state == DOKU_LEXER_SPECIAL) | ||
+ | { | ||
+ | $renderer-> | ||
+ | $renderer-> | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | $renderer-> | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | return false; | ||
+ | } | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ====== Comments ====== | ||
+ | |||
+ | > The problem is that if i write < |