[Templates] subtracting one

Thomas, Mark - BLS CTR Thomas.Mark at bls.gov
Mon Jul 21 14:25:57 BST 2008


Strange... it seems to have been a problem involving interaction with
the surrounding template. Chisel's simple example worked. Yet the TT
error specified the subtraction as the problem, and removing it caused
the template to work. Weird. We've reworked the template and the parse
error no longer occurs on the subtraction.

 

- Mark.

 

From: templates-bounces at template-toolkit.org
[mailto:templates-bounces at template-toolkit.org] On Behalf Of Thomas,
Mark - BLS CTR
Sent: Saturday, July 19, 2008 10:42 AM
To: templates at template-toolkit.org
Subject: [Templates] subtracting one

 

I get a parse error with [% series.year - 1 %]. According to the thread
at
http://www.mail-archive.com/templates@template-toolkit.org/msg05821.html
, it is because it is being interpreted as a negative 1 instead of an
operator.

 

What's the workaround? I've tried:

 

[% series.year - (1) %]

[% series.year + -1 %]

[% one = 1; series.year - one %]

 

all to no avail.

 

-- Mark.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.template-toolkit.org/pipermail/templates/attachments/20080721/eb8a5f41/attachment.htm 


More information about the templates mailing list