====== Label Plugin ======
---- plugin ----
description: Allows to mark parts of the wikipage with labels in order to be qualified for special use with the Embed Plugin
author : Pascal Bihler
email : bihler@iai.uni-bonn.de
type : syntax
lastupdate : 2007-05-14
compatible : Anteater, Rincewind, Angua
depends : embed
conflicts :
similar :
tags : label, replace
downloadurl: http://pb.wh4f.de/dokuwiki/label.zip
----
===== 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://pb.wh4f.de/dokuwiki/label.zip
===== Syntax and Use =====
The wiki-portion to mark has to be included in %%%%, whereas //wikicode// is arbitrary wikicode and %%theLabel%% is an identifier consisting of letters (a-z, A-Z), number (0-9) and underscore (_).
Example:
Here is a sample phrase:
The example is labeled and can be processed by another plugin, e.g. the [[plugin:embed|embed-plugin]].
===== Labels and Lists =====
In order to be recognized as a list, a line in DokuWiki has to start with spaces before the leading ''*''. Therefore, you are required to start a label after the *, like here:
*
*
*
===== Code =====
//(sorry, will be properly indented when I have some time)//
...
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Pascal Bihler
*/
// 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');
class syntax_plugin_label extends DokuWiki_Syntax_Plugin {
var $last_label = array();
var $LABEL_PATTERN = "[a-zA-Z0-9_]+";
/**
* return some info
*/
function getInfo(){
return array(
'author' => 'Pascal Bihler',
'email' => 'bihler@iai.uni-bonn.de',
'date' => '2007-05-14',
'name' => 'Label Plugin',
'desc' => 'Allows to mark parts of the wikipage with labels',
'url' => 'http://www.dokuwiki.org/plugin:label',
);
}
function getType(){ return 'substition'; }
function getPType(){ return 'normal'; }
function getSort(){ return 100; }
function connectTo($mode) {
$this->Lexer->addSpecialPattern('',$mode,'plugin_label');
$this->Lexer->addSpecialPattern('