- SEE ALSO
Konstrukt::Plugin::wiki::markup::linkplugin - Base class for plugins to handle links
Creating your own plugin:
use base 'Konstrukt::Plugin::wiki::markup::linkplugin'; #overwrite the methods
Using a link plugin:
my $l = use_plugin 'wiki::markup::link::yourplugin'; #get the regexps that will match the links for which this plugin is #responsible for my ($match_implicit, $match_explicit) = $l->matching_regexp(); #let the plugin handle a link string. #the plugin returns a container node which contains the nodes that #will replace the link string. my $replacement = $l->handle($link_string);
This is the base class for all link-markup plugins. There exist several plugins for different kinds of links and you may crerate your own ones.
Look at the actual link plugins for examples.
Constructor of this class.
Initialization. May be overwriten by your class. Your class should set its default settings here.
Installation of your plugin. For example you may want to create template files for your markup here.
For more information take a look at the documentation at "install" in Konstrukt::Plugin.
This method will return two regexp's that will match the link strings for which this plugin is responsible for.
The first regexp will match all implicit links that this plugin can handle. The second one will match all explicit links that this plugin can handle. Those will be the same in most cases, but there are also links that will only match when they are explicit links.
If you don't want your plugin to match, return undef for each regexp.
Internally the text will be split into words and each word will be matched against the regexps of your plugin. If it matches, your plugin will "handle" this link. This implies that implicit links cannot contain whitespaces.
Note: This also implies that a text consisting of 1000 words in combination with 5 link plugins will lead into ~7000 regexp-operations in the worst case. In the best case we would have ~2000 matches. But actually I cannot make it simpler as I don't know any other way to match the beginning of a word (\b will match \W\w and not \s\S). Thank god that we've got caching...
This method will handle the link string and return a container node containing the nodes that will replace the link string.
$link - The link string.
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.