NAME
Konstrukt::Plugin::wiki::markup::blockplugin - Base class for wiki block plugins
SYNOPSIS
use base 'Konstrukt::Plugin::wiki::markup::blockplugin';
#read the docs
DESCRIPTION
Its main purpose it the documentation of the creation of custom wiki block plugins.
It also provides a method which will help your plugin splitting a block into lines.
METHODS
new
Constructor of this class. You will most likely inherit this one.
init
Initialization. May be overwriten by your class. Your class should set its default settings here.
install
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.
Parameters:
none
process
This method will do the work of your plugin.
A block node containing several child nodes (maybe of type 'plaintext', maybe not) will be passed to this method.
Usually you will only work on nodes matching this criteria
$node->{type} eq 'plaintext' and not $node->{wiki_finished}
as you should leave alone non-plaintext nodes and finally parsed nodes.
If you detect that this block cannot be handled by your plugin, you must return undef. Otherwise you should modify the block (e.g. add text-nodes before or behind it, add/remove nodes, replace the nodes by a template node etc.) and return a true value. The block node will then be replaced by its children.
After your plugin processed the block, its output will be post-processed: All returned template nodes (if any) will be prepared recursively so that their plaintext result will be in the tree and plugins later in the chain may also work on the results (what they couldn't properly if there are tempalte-tag nodes). The result will also be scanned for <nowiki>-areas again to prevent other plugins to work on parts of your results (e.g. HTML-tags).
Parameters:
$block - Block node (of type Konstrukt::Parser::Node) containing the (text-)nodes of this block.
split_block_into_lines
Will split a passed block into lines. The child nodes of the block will be removed. For each line a new child node will be added under the block node. This node will contain the nodes which belong to one line. Nodes containing more than one line will be splitted.
This one is very similar to "split_into_blocks" in Konstrukt::Plugin::wiki.
Parameters:
$block - Reference to the block (and its children) that shall be split into lines.
AUTHOR
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.