Apache::AxKit::Provider::File::Formatter - An AxKit Provider that can use any Formatter API module
In your Apache config, you can configure this Provider like this example:
<Files *.html> PerlHandler AxKit AxAddProcessor text/xsl /transforms/xhtml2html.xsl AxContentProvider Apache::AxKit::Provider::File::Formatter PerlSetVar FormatterModule Formatter::HTML::HTML </Files>
This is an AxKit Provider that may be used to apply any module that conforms with the Formatter API (v0.93) to a file. At the time of this writing, there are three modules in the
Formatter:: namespace, one that can clean existing HTML using HTML::Tidy, 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. Also, you may need to copy a supplied XSLT stylesheet to an appropriate location from the
/transforms/ directory. For example, if you would like to output HTML like in the above example, you need the
The Formatter API specification.
The currently existing Formatters: Formatter::HTML::HTML, Formatter::HTML::Textile and Formatter::HTML::Preformatted. Some other Providers may also be of interest: Apache::AxKit::Provider::File, Apache::AxKit::Provider::File::Syntax
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.
Kjetil Kjernsmo, <firstname.lastname@example.org>
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.