NAME

Templer::Plugin::RootPath - A plugin to add path to web-root to variables.

SYNOPSIS

The following is a good example use of this plugin

title: About my site
css: path_to(css)
----
<p>CSS files are stored in <!-- tmpl_var name='css' -->.

This is mainly useful as global variables used in the default layout.

DESCRIPTION

This plugin allows template variables (considered as absolute path from the web-root) to be set to a correct relative path from any page of the website.

An empty call to path_to may be used to compute the relative path to the web-root.

LICENSE

This module is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version, or

b) the Perl "Artistic License".

AUTHOR

Bruno BEAUFILS <bruno@boulgour.com>

COPYRIGHT AND LICENSE

Copyright (C) 2013 Bruno BEAUFILS <bruno@boulgour.com>.

This library is free software. You can modify and or distribute it under the same terms as Perl itself.

METHODS

Constructor. No arguments are required/supported.

expand_variables

This is the method which is called by the Templer::Plugin::Factory to expand the variables contained in a Templer::Site::Page object.

Variables are written in the file in the form "key: value", and are internally stored within the Page object as a hash.

This method iterates over each key & value and updates any that seem to refer to file-paths.