Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Jemplate CPAN distribution.

Report information
The Basics
Id: 56965
Status: resolved
Priority: 0/
Queue: Jemplate

People
Owner: Nobody in particular
Requestors: agentzh [...] yahoo.cn
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.260
Fixed in: (no value)



Subject: The "div" operator in TT2 templates does not emit valid JS code
Consider the following TT2 template [% a = b `div` c %] it generates something like int($_[1] / $_[3]) I think it should be a simple fix in Parser.yp:358. Hopefully it can get fixed in the next release ;) Thanks!
On Tue Apr 27 06:27:38 2010, AGENT wrote: Show quoted text
> Consider the following TT2 template > > [% a = b `div` c %] > > it generates something like > > int($_[1] / $_[3]) >
I'm currently using the following quick patch against the 0.260 tarball: diff -r Jemplate-0.260/lib/Jemplate/Grammar.pm Jemplate-0.260-patched/lib/Jemplate/Grammar.pm 6013c6013 < { "int($_[1] / $_[3])" } --- Show quoted text
> { "Math.floor($_[1] / $_[3])" }
It's surely should be done in the original Parser.yp file instead :) Cheers, -agentzh
Agent Zhang, Fixed in 0.261, thanks for the report and patch. -Rob