Wiki::...ltiple(3pm)

πŸ“¦
version 0.86 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

Okay bestie, welcome to the Wiki::Toolkit::Formatter::Multiple manual page (the 3pm one, header shorthand Wiki::...ltiple(3pm) because terminal width said no πŸ’€) from User Contributed Perl Documentation. This is the whole page, no skips, periodt.

🌸 NAME 🌸

Wiki::Toolkit::Formatter::Multiple β€” literally allows a Wiki::Toolkit wiki to use more than one formatter πŸ’…

πŸ’… DESCRIPTION πŸ’…

It's a "dummy" formatter for Wiki::Toolkit, bestie. What it does is pass methods through to other Wiki::Toolkit formatters, and which one it passes to depends on the supplied metadata. That's the whole vibe check ✨

✨ SYNOPSIS ✨

Here's the group-chat demo, copied exactly so you can see the config:

         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" } );

πŸŽ€ METHODS πŸŽ€

These are the methods the page gives you, no gatekeeping πŸ’–

🧚 new 🧚

             my $formatter = Wiki::Toolkit::Formatter::Multiple->new(
                 label_1  => Formatter1->new( ... ),
                 label_2  => Formatter2->new( ... ),
                 _DEFAULT => Wiki::Toolkit::Formatter::Default->new,
             );

Okay so you may supply as many formatter objects as you wish. They don't have to be of different classes; maybe you just want to, for example, permit different HTML tags to be used on different types of pages. Cute, right? πŸ¦‹

The "labels" 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 "formatter" and the value is the label of the formatter that should be used to render that node. Iykyk πŸ”‘

The "_DEFAULT" label is special β€” it defines the formatter that will be used for any node that does not have a "formatter" stored in its metadata. The "_DEFAULT" formatter, if not supplied to ->new, will default to the very basic Wiki::Toolkit::Formatter::Default. Slay defaults πŸ’…

🌈 format( $raw, \%metadata ) 🌈

               my $output = $formatter->format( "Here is some text.", undef,
                                                { formatter => "discussion" } );

It uses the value of "formatter" given in the metadata to decide which of the formatter objects passed on instantiation to use, then uses it to format the provided rawwikitext. So it's like a lil formatter selector, no cap ✨

The "undef" 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. That's why it's undef in the standalone example, bestie 🫢

That's the signature, and this page doesn't add any extra prose under it β€” iconic minimalism, honestly πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

  • Wiki::Toolkit

πŸ’– AUTHOR πŸ’–

Kake Pugh <kake@earth.li> β€” crown her πŸ‘‘

🫢 SUPPORT 🫢

Bug reports, questions and feature requests should go to cgi-wiki-dev@earth.li. Don't be shy, bestie πŸ’Œ

Copyright (C) 2003-4 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. Periodt πŸ’…


Okay that's the whole page, bestie πŸŽ€ cute little sign-off: this bad boy was sourced from perl v5.32.0, dated 2021-01-04, and the footer label is Wiki::...ltiple(3pm). Bye, love you, go format something cute πŸ’–πŸ¦‹

πŸ“¦ where this page comes from