The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Apache::AxKit::Provider::File::Formatter - An AxKit Provider that can use any Formatter API module

SYNOPSIS

In your Apache config, you can configure this Provider like this example:

  <LocationMatch .textile$>
        PerlHandler AxKit
        AxContentProvider Apache::AxKit::Provider::File::Formatter
        PerlSetVar FormatterModule Formatter::HTML::Textile
  </LocationMatch>

DESCRIPTION

This is an AxKit Provider that may be used to apply any module that conforms with the Formatter API to a file. At the time of this writing, there are two modules in the Formatter:: namespace, one for formatting the Text::Textile syntax, and one to add minimal HTML markup to a preformatted plain text.

The Provider can be configured like any other Provider, to apply to a directory, a file ending, etc. The only thing that is special about it is that it needs a FormatterModule variable to tell it which module will do the actual formatting. It can be set like in the example in the SYNOPSIS.

Make sure you have the module you specify installed, otherwise an error will result.

SEE ALSO

The currently existing Formatters: Formatter::HTML::Preformatted, Formatter::HTML::Textile, where the former gives some rudimentary documentation of the API. Some other Providers may also be of interest: Apache::AxKit::Provider::File, Apache::AxKit::Provider::File::Syntax

TODO

  • Currently, all Formatter modules return HTML fragments, that is, something that could go in the BODY element of a HTML document. This module currently contains some nasty plaintext markup to add those HTML elements to the fragment. This should be done differently, and I feel that it is something that should be addressed by the API itself.

  • It should, in principle, be possible to use a chain of Formatter modules to process a file in stages. This could be an interesting exercise for the future, but then there are also many other pipeline based paradigms that me be better suited.

AUTHOR

Kjetil Kjernsmo, <kjetilk@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Kjetil Kjernsmo

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.