NAME
Konstrukt::Plugin::wiki::markup::replace - Inline plugin to handle simple replacements
SYNOPSIS
my $r = use_plugin 'wiki::markup::replace';
my $rv = $r->process($tag);
DESCRIPTION
This one will do a simple search and replace for a configurable list of replacements.
CONFIGURATION
The replacements can be configured in your konstrukt.settings file. The setting is a comma separated list of replacements, where each replacement consists of a string to match and the replacement string (separated by a " | ", note the non-optional whitespaces around the pipe and that whitespaces around the separating comma will belog to the match/replace string).
The matching will be case-insensitive. Most symbols will only match with spaces around them (note the extra space) to avoid ambiguity.
The defaults are (must be on one line in the real config):
wiki/replace
>> | »,
<< | «,
* | ∗ ,
1/2 | ½ ,
1/4 | ¼ ,
3/4 | ¾ ,
-> | → ,
<- | ← ,
<-> | ↔ ,
=> | ⇒ ,
<= | ⇐ ,
<=> | ⇔ ,
- | – ,
-- | — ,
... | …,
(C) | ©,
(R) | ®
If you want to add custom replacements without putting all the defaults into your config, you can use this setting:
wiki/replace_custom :) | :D,foo | bar
So you would only need to modify the defaults if you want to alter/remove any replacements.
EXAMPLE
Note that most of these symbols have to be surrounded by whitespaces to prevent the replacement in some abmiguous/unwanted cases.
Quotes:
some >>beautifully quoted<< text
Asterisk:
beautiful asterisk * here
Fractions:
0 < 1/4 < 1/2 < 3/4 < 1
Arrows:
small -> rightarrow
small <- leftarrow
small <-> leftrightarrow
big => rightarrow
big <= leftarrow
big <=> leftrightarrow
Dashes:
small - dash
long -- dash
Symbols:
copyright (C)
registered (R)
Horizontal Ellipsis:
The End...
METHODS
init
Initialization.
process
This method will do the work.
Parameters:
$nodes - Container node (of type Konstrukt::Parser::Node) containing all (text-)nodes of this documents.
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.