.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Wiki::Toolkit::Formatter::Multiple 3pm" .TH Wiki::Toolkit::Formatter::Multiple 3pm "2021-01-04" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Wiki::Toolkit::Formatter::Multiple \- Allows a Wiki::Toolkit wiki to use more than one formatter. .SH "DESCRIPTION" .IX Header "DESCRIPTION" A \*(L"dummy\*(R" formatter for Wiki::Toolkit. Passes methods through to other Wiki::Toolkit formatters, depending on supplied metadata. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Wiki::Toolkit::Formatter::Multiple; \& use Wiki::Toolkit::Formatter::Pod; \& use Wiki::Toolkit::Formatter::UseMod; \& \& my $pod_fmtr = Wiki::Toolkit::Formatter::Pod\->new( \& node_prefix => "wiki.cgi?node=", \& ); \& \& my $usemod_fmtr = Wiki::Toolkit::Formatter::UseMod\->new( \& node_prefix => "wiki.cgi?node=", \& extended_links => 1, \& allowed_tags => [ qw( p b i div br ) ], \& ); \& \& my $formatter = Wiki::Toolkit::Formatter::Multiple\->new( \& documentation => $pod_fmtr, \& discussion => $usemod_fmtr, \& _DEFAULT => $usemod_fmtr, \& ); \& \& my $wiki = Wiki::Toolkit\->new( store => ..., \& formatter => $formatter ); \& my $output = $wiki\->format( "This is some discussion.", \& { formatter => "discussion" } ); .Ve .SH "METHODS" .IX Header "METHODS" .IP "\fBnew\fR" 4 .IX Item "new" .Vb 5 \& my $formatter = Wiki::Toolkit::Formatter::Multiple\->new( \& label_1 => Formatter1\->new( ... ), \& label_2 => Formatter2\->new( ... ), \& _DEFAULT => Wiki::Toolkit::Formatter::Default\->new, \& ); .Ve .Sp You may supply as many formatter objects as you wish. They don't have to be of different classes; you may just wish to, for example, permit different \s-1HTML\s0 tags to be used on different types of pages. .Sp The \*(L"labels\*(R" supplied as the keys of the parameter hash should be unique. When you write a node, you should store a key-value pair in its metadata where the key is \f(CW\*(C`formatter\*(C'\fR and the value is the label of the formatter that should be used to render that node. .Sp The \f(CW\*(C`_DEFAULT\*(C'\fR label is special \- it defines the formatter that will be used for any node that does not have a \f(CW\*(C`formatter\*(C'\fR stored in its metadata. The \f(CW\*(C`_DEFAULT\*(C'\fR formatter, if not supplied to \f(CW\*(C`\->new\*(C'\fR, will default to the very basic Wiki::Toolkit::Formatter::Default. .IP "\fBformat( \f(CB$raw\fB, \e%metadata )\fR" 4 .IX Item "format( $raw, %metadata )" .Vb 2 \& my $output = $formatter\->format( "Here is some text.", undef, \& { formatter => "discussion" } ); .Ve .Sp Uses the value of \f(CW\*(C`formatter\*(C'\fR given in the metadata to decide which of the formatter objects passed on instantiation to use, then uses it to format the provided rawwikitext. .Sp The \f(CW\*(C`undef\*(C'\fR second element of the parameter array in the example is there because when this is called from a Wiki::Toolkit object, the wiki object passes itself in as the second parameter. .IP "\fBfind_internal_links( \f(CB$raw\fB, \f(CB$metadata\fB )\fR" 4 .IX Item "find_internal_links( $raw, $metadata )" .SH "SEE ALSO" .IX Header "SEE ALSO" Wiki::Toolkit .SH "AUTHOR" .IX Header "AUTHOR" Kake Pugh .SH "SUPPORT" .IX Header "SUPPORT" Bug reports, questions and feature requests should go to cgi\-wiki\-dev@earth.li .SH "COPYRIGHT" .IX Header "COPYRIGHT" .Vb 1 \& Copyright (C) 2003\-4 Kake Pugh. All Rights Reserved. .Ve .PP This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.