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
	>> | »,
	<< | &laquo;,
	 *  |  &lowast; ,
	 1/2  |  &frac12; ,
	 1/4  |  &frac14; ,
	 3/4  |  &frac34; ,
	 ->  |  &rarr; ,
	 <-  |  &larr; ,
	 <->  |  &harr; ,
	 =>  |  &rArr; ,
	 <=  |  &lArr; ,
	 <=>  |  &hArr; ,
	 -  |  &ndash; ,
	 --  |  &mdash; ,
	... | &hellip;,
	(C) |  &copy;,
	(R) |  &reg;

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:

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.

SEE ALSO

Konstrukt::Plugin::wiki