Konstrukt::Plugin::wiki::markup::replace - Inline plugin to handle simple replacements
my $r = use_plugin 'wiki::markup::replace';
my $rv = $r->process($tag);
This one will do a simple search and replace for a configurable list of replacements.
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.
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...
Initialization.
This method will do the work.
Parameters:
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.