Apache::VimColor - Apache mod_perl Handler for syntax highlighting in HTML.
This apache handler converts text files in syntax highlighted HTML output using Text::VimColor. If allowed by the configuration the visitor can also download the text-file without syntax highlighting.
Since Text::VimColor isn't the fastest module this version can use Cache::Cache to cache the parsed files. Also the ETag and LastModified HTTP headers are set to help browsers and proxy servers to cache the URL.
This module requires mod_perl2 (see http://perl.apache.org/) and Text::VimColor.
The apache configuration neccessary might look a bit like this:
# in httpd.conf (or any other apache configuration file) <Location /source> SetHandler perl-script PerlHandler Apache::VimColor # Below here is optional PerlSetVar AllowDownload "True" PerlSetVar CacheType "File" PerlSetVar CacheSize 1048576 # 1 MByte PerlSetVar CacheExpire 7200 # 2 hours PerlSetVar StyleSheet "http://domain.com/stylesheet.css" PerlSetVar TabSize 8 PerlSetVar LineNumbers "True" </Location>
For a complete list of all options and descriptions see below.
All features of the this PerlHandler can be set in the apache configuration using the PerlSetVar directive. For example:
PerlSetVar AllowDownload true # inside <Files>, <Location>, ... # apache directives
Setting this option to true will allow plaintext downloads of the files. A link will be included in the output. The default is not to allow downloads.
Selects the caching method to use. Depending on your choices a Cache::Cache module will be loaded and used. The default is not to use any caching. CacheType can be one of:
Memory SharedMemory File
Although the default is not to use caching, if CacheSize is given and CacheType is not, then Memory is being used. Obviously these values correspond to the Cache::*Cache modules.
The modules are loaded at runtime. If errors occur they are logged to Apache's errorlog.
Sets the maximum size of the cache in bytes. If CacheSize is non-zero the Cache::SizeAware*Cache variants will be used.
CacheExpire sets the expiration time. The value must be given in seconds. Defaults to 3600 seconds (one hour). See Cache::Cache for details.
Sets the width of one tab symbol. The default is eight spaces.
If you want to include a custom stylesheet you can set this option. The string will be included in the html-output as-is, you will have to take care of relative filenames yourself.
All highlighted text is withing a
span-tag with one of the following classes:
Comment Constant Error Identifier PreProc Special Statement Todo Type Underlined
Sets wether or not line numbers will be displayed. The Default is not to display line numbers.
Florian octo Forster octo(at)verplant.org http://verplant.org/
Copyright (c) 2005 Florian Forster.
All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.