1Wiki::Toolkit::FormatteUrs:e:rDeCfoanutlrti(b3u)ted PerlWiDkoic:u:mTeonotlaktiito:n:Formatter::Default(3)
2
3
4
6 Wiki::Toolkit::Formatter::Default - A formatter for Wiki::Toolkit.
7
9 A formatter backend for Wiki::Toolkit.
10
12 my $store = Wiki::Toolkit::Store::SQLite->new( ... );
13 # See below for parameter details.
14 my $formatter = Wiki::Toolkit::Formatter::Default->new( %config );
15 my $wiki = Wiki::Toolkit->new( store => $store,
16 formatter => $formatter );
17
19 new
20 my $formatter = Wiki::Toolkit::Formatter::Default->new(
21 extended_links => 0,
22 implicit_links => 1,
23 allowed_tags => [qw(b i)], # defaults to none
24 macros => {},
25 node_prefix => 'wiki.cgi?node=' );
26
27 Parameters will default to the values shown above (apart from
28 "allowed_tags", which defaults to allowing no tags).
29
30 ยท macros - be aware that macros are processed after filtering out
31 disallowed HTML tags. Currently macros are just strings, maybe
32 later we can add in subs if we think it might be useful.
33
34 Macro example:
35
36 macros => { qr/(^|\b)\@SEARCHBOX(\b|$)/ =>
37 qq(<form action="wiki.cgi" method="get">
38 <input type="hidden" name="action" value="search">
39 <input type="text" size="20" name="terms">
40 <input type="submit"></form>) }
41
42 format
43 my $html = $formatter->format( $content );
44
45 Escapes any tags which weren't specified as allowed on creation,
46 then interpolates any macros, then calls Text::WikiFormat::format
47 (with the config set up when new was called) to translate the raw
48 Wiki language supplied into HTML.
49
51 Wiki::Toolkit::Formatter::WikiLinkFormatterParent Wiki::Toolkit
52
54 Kake Pugh (kake@earth.li).
55
57 Copyright (C) 2002-2003 Kake Pugh. All Rights Reserved.
58 Copyright (C) 2006 the Wiki::Toolkit team. All Rights Reserved.
59
60 This module is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
63
64
65perl v5.30.1 2020-01-3W0iki::Toolkit::Formatter::Default(3)