NAME

Spreadsheet::Template::Processor::Xslate - preprocess templates with Xslate

VERSION

version 0.05

SYNOPSIS

my $template = Spreadsheet::Template->new(
    processor_class   => 'Spreadsheet::Template::Processor::Xslate',
    processor_options => {
        syntax => 'TTerse'
    },
);

DESCRIPTION

This class implements Spreadsheet::Template::Processor to run the template data through Text::Xslate. In addition to allowing you to use the provided variables, it also provides some convenience macros to use when writing your templates:

format($name, $options)

Declares a named format, which can be used with the c helper. $name is the name to use for the format, and $options is a hashref to use as the value for the format entry in the cell.

c($contents, $format, $type, %args)

Returns the representation of a cell. $contents is the cell contents, $format is either the name of a format declared with the format helper, or a hashref of format options, $type is either "string", "number", or "date_time", and %args contains any other parameters (such as formula, for instance) to declare for the cell. $type is optional, and if not passed, defaults to "string".

merge($range, $content, $format, $type, %args)

Returns representation of a range of cells to be merged. $content, $format, $type, and %args are identical to the parameters listed above for the c helper, and $range describes the range of cells to be merged. The range can be specified either by an array of two arrays corresponding to the row and column indices of the top left and bottom right cell, or by an Excel-style range (like A1:C3).

true

Returns JSON::true.

false

Returns JSON::false.

ATTRIBUTES

syntax

Which Xslate syntax engine to use. Defaults to Metakolon.

AUTHOR

Jesse Luehrs <doy@tozt.net>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2015 by Jesse Luehrs.

This is free software, licensed under:

The MIT (X11) License