plugin:label
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| plugin:label [2007-05-14 13:32] – is now inline 131.220.9.185 | plugin:label [2015-09-13 19:22] (current) – Aleksandr | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Label Plugin ====== | ||
| + | ---- plugin ---- | ||
| + | description: | ||
| + | author | ||
| + | email : bihler@iai.uni-bonn.de | ||
| + | type : syntax | ||
| + | lastupdate : 2007-05-14 | ||
| + | compatible : Anteater, Rincewind, Angua | ||
| + | depends | ||
| + | conflicts | ||
| + | similar | ||
| + | tags : label, replace | ||
| + | downloadurl: | ||
| + | ---- | ||
| + | |||
| + | ===== Requirements ===== | ||
| + | |||
| + | I've developed the plugin under the DokuWiki version of 2006-11-06 and seems to work with version 2007-06-26 as well. | ||
| + | |||
| + | ===== Download / Installation ===== | ||
| + | |||
| + | Download the plugin here (manually or via Plugin Manager): http:// | ||
| + | |||
| + | ===== Syntax and Use ===== | ||
| + | |||
| + | The wiki-portion to mark has to be included in %%< | ||
| + | |||
| + | Example: | ||
| + | < | ||
| + | Here is a sample phrase: | ||
| + | <label example> | ||
| + | The quick brown fox jumps over the lazy dog. | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | The example is labeled and can be processed by another plugin, e.g. the [[plugin: | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Labels and Lists ===== | ||
| + | |||
| + | In order to be recognized as a list, a line in DokuWiki has to start with spaces before the leading '' | ||
| + | |||
| + | < | ||
| + | * <label element1> | ||
| + | * <label element2> | ||
| + | * <label element3> | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Code ===== | ||
| + | |||
| + | //(sorry, will be properly indented when I have some time)// | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | /** | ||
| + | * Plugin Label: Allows to mark parts of the wikipage with labels in order to | ||
| + | * be qualified for special use in other plugins | ||
| + | * | ||
| + | * Sytnax: <label [a-zA-Z0-9_]+> | ||
| + | | ||
| + | * @license | ||
| + | * @author | ||
| + | */ | ||
| + | |||
| + | // must be run within DokuWiki | ||
| + | if(!defined(' | ||
| + | |||
| + | if(!defined(' | ||
| + | require_once(DOKU_PLUGIN.' | ||
| + | |||
| + | class syntax_plugin_label extends DokuWiki_Syntax_Plugin { | ||
| + | |||
| + | var $last_label = array(); | ||
| + | var $LABEL_PATTERN = " | ||
| + | |||
| + | /** | ||
| + | * return some info | ||
| + | */ | ||
| + | function getInfo(){ | ||
| + | return array( | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ); | ||
| + | } | ||
| + | |||
| + | function getType(){ return ' | ||
| + | function getPType(){ return ' | ||
| + | function getSort(){ return 100; } | ||
| + | function connectTo($mode) { | ||
| + | $this-> | ||
| + | $this-> | ||
| + | } | ||
| + | |||
| + | |||
| + | /** | ||
| + | * Handle the match | ||
| + | */ | ||
| + | function handle($match, | ||
| + | switch ($state) { | ||
| + | case DOKU_LEXER_SPECIAL : | ||
| + | if (preg_match('/< | ||
| + | $labek = $matches[1]; | ||
| + | array_push($this-> | ||
| + | return array(" | ||
| + | | ||
| + | | ||
| + | return array(" | ||
| + | } | ||
| + | } | ||
| + | return array(); | ||
| + | } | ||
| + | |||
| + | /** | ||
| + | * Create output | ||
| + | */ | ||
| + | function render($mode, | ||
| + | return true; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | //Setup VIM: ex: et ts=4 enc=utf-8 : | ||
| + | </ | ||
