10 Jul 2016 09:50:11 UTC
- Distribution: App-Templer
- Source (raw)
- Browse (raw)
- How to Contribute
- Clone repository
- Issues (0)
- Testers (447 / 13 / 2)
- KwaliteeBus factor: 1
- 78.03% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity24 month
- Download (173.51KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionSKX Steve Kemp
Templer::Plugin::FileGlob - A plugin to expand file globs.
The following is a good example use of this plugin
title: Images of cats images: file_glob( img/candid*.jpg ) ---- <li> <!-- tmpl_loop name='images' --> <li><img src="<!-- tmpl_var name='file' -->" width="<!-- tmpl_var name='width' -->" height="<!-- tmpl_var name='height' -->" alt="Animal & Pet Photography, Edinburgh" /></li> <!-- /tmpl_loop --> </ul>
This plugin operates on file-patterns and populates loops refering to the specified pattern.
The intended use-case is inline-gallery generation, but more uses would surely be discovered.
For each loop created there will be the variables:
The name of the file.
The height of the image, if the file is an image and Image::Size is available.
The width of the image, if the file is an image and Image::Size is available.
The content of the file if the file is not an image and not a templer input file.
The directory part of the file name.
The basename of the file (without extension).
The extension (everything after the last period) of the file name.
If matching files are templer input files then all templer variables are also populated.
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".
Steve Kemp <firstname.lastname@example.org>
Copyright (C) 2012-2015 Steve Kemp <email@example.com>.
This library is free software. You can modify and or distribute it under the same terms as Perl itself.
Constructor. No arguments are required/supported.
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-globs.