This is an old revision of the document!
Summary
Compatible with DokuWiki
No compatibility info given!
The missing download url means that this extension cannot be installed via the Extension Manager. Please see Publishing a Plugin on dokuwiki.org. Recommended are public repository hosts like GitHub, GitLab or Bitbucket.
This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.
This plugin concatenates part of word after internal link and its body (like in MediaWiki) so when you write [[test]]ing this link will be shown as 'testing' and point to 'test'.
This is my first plugin so it may work bad but I hope it'll be useful.
You may download it from http://shtirlic.com/wiki/_media/plugins:linkext.zip or just copy the source code.
<?php /** * Plugin Linkext: merges links body and its end. * * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) * @author Serge Shpikin <shtirlic@shtirlic.com> */ // must be run within DokuWiki if(!defined('DOKU_INC')) die(); if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); require_once(DOKU_PLUGIN.'syntax.php'); /** * All DokuWiki plugins to extend the parser/rendering mechanism * need to inherit from this class */ class syntax_plugin_linkext extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Serge Shpikin', 'email' => 'ShTiRLiC@shtirlic.com', 'date' => '2007-02-12', 'name' => 'Link Extension Plugin', 'desc' => 'Concatenates links ending and body (a-la MediaWiki) which is useful for Cyrillic languages (like Russian, Ukrainian etc.). Links like [[test]]ing will be shown as "testing" and point to "test"', 'url' => 'http://shtirlic.com', ); } function getType() { return 'substition'; } function getSort() { return 51; } function connectTo($mode) { $this->Lexer->addSpecialPattern('\[\[[^\s\|]+?\]\][a-zA-Zа-яА-Я]+?\s',$mode,'plugin_linkext'); } function handle($match, $state, $pos, &$handler) { if ($state == DOKU_LEXER_SPECIAL) { preg_match('/\[\[(.+?)\]\](.+?)\s/', $match, $data); return array($state, $data); } else return array($match, $state, $pos); } function render($mode, &$renderer, $data) { if($mode == 'xhtml') { list($state, $match) = $data; $spos = strrpos($match[1], ':'); if (!is_bool($spos)) $caption = substr($match[1], $spos + 1, strlen($match[1]) - $spos); else $caption = $match[1]; if ($state == DOKU_LEXER_SPECIAL) { $renderer->internallink($match[1], $caption.$match[2]); $renderer->doc .= ' '; } else { $renderer->doc .= $match; } return true; } return false; } }
Comments
The problem is that if i write [[test]]ing, alone is colored the word test and ing is not colored.