Yukki::Web::Plugin::Role::FormatHelper - interface for quick format helpers
version 0.991_006
package MyPlugins::LowerCase; use 5.12.1; use Moo; use Types::Standard qw( HashRef Str ); extends 'Yukki::Web::Plugin'; has format_helpers => ( is => 'ro', isa => HashRef[Str], default => sub { +{ 'lc' => 'lc_helper', } }, ); with 'Yukki::Web::Plugin::Role::FormatHelper'; sub lc_helper { my ($self, $params) = @_; return lc $params->{arg}; }
This role defines the interface for quick yukkitext helpers. Each plugin implementing this role may provide code references for embedding content in yukkitext using a special {{...}} notation.
{{...}}
An implementor must provide the following methods.
This must return a reference to hash mapping quick helper names to method names that may be called to handle them.
The names may be any text that does not contain a colon (":").
The methods will be called with the following parameters:
The curent Yukki::Web::Context object.
This is the Yukki::Model::File being formatted.
The helper name the user used.
The string argument passed to it.
When called the method must return a scalar value to insert into the page. This is generally a string and may include any markup that should be added to the page.
If the method throws and exception or returns undef or something other than a scalar, the yukkitext formatter will include the original {{...}} string as-is.
undef
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
This software is copyright (c) 2017 by Qubling Software LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Yukki, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Yukki
CPAN shell
perl -MCPAN -e shell install Yukki
For more information on module installation, please visit the detailed CPAN module installation guide.