| CGI-Wiki documentation | view source | Contained in the CGI-Wiki distribution. |
CGI::Wiki::Formatter::Default - A formatter for CGI::Wiki.
A formatter backend for CGI::Wiki.
my $store = CGI::Wiki::Store::SQLite->new( ... );
# See below for parameter details.
my $formatter = CGI::Wiki::Formatter::Default->new( %config );
my $wiki = CGI::Wiki->new( store => $store,
formatter => $formatter );
my $formatter = CGI::Wiki::Formatter::Default->new(
extended_links => 0,
implicit_links => 1,
allowed_tags => [qw(b i)], # defaults to none
macros => {},
node_prefix => 'wiki.cgi?node=' );
Parameters will default to the values shown above (apart from
allowed_tags, which defaults to allowing no tags).
Macro example:
macros => { qr/(^|\b)\@SEARCHBOX(\b|$)/ =>
qq(<form action="wiki.cgi" method="get">
<input type="hidden" name="action" value="search">
<input type="text" size="20" name="terms">
<input type="submit"></form>) }
my $html = $formatter->format( $content );
Escapes any tags which weren't specified as allowed on creation, then interpolates any macros, then calls Text::WikiFormat::format (with the config set up when new was called) to translate the raw Wiki language supplied into HTML.
my @links_to = $formatter->find_internal_links( $content );
Returns a list of all nodes that the supplied content links to.
(Obviously this is dependent on object properties such as
extended_links etc.)
Kake Pugh (kake@earth.li).
Copyright (C) 2002-2003 Kake Pugh. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| CGI-Wiki documentation | view source | Contained in the CGI-Wiki distribution. |