We need to put together documentation on what the expr:xxx values are. Sorry about that. The front end engineers had a look over the problem you are having and gave the following insights.
The problem here is due to '%'. The current numerical expression parser is a very simple one, and doesn't support any operator precedence. So
"post-" + data:i % 2
is the same as
("post-" + data:i) % 2
, which is trying to get the modulo 2 of a string and fails.
Hope that helps.
On Wed, Jan 5, 2011 at 4:01 PM, shumash <shumash@gmail.com> wrote:
I'm having a hard time understanding exactly what expressions are
supported within the expr:xxx value. What "language" are these in and
exactly what operations are supported? I have failed to find official
documentation on this, and any pointers would be appreciated.
In particular, the problem I face is trying to concatenate what I
believe to be a string to what is probably an integer in order to
create alternating styles for an array of objects, as follows:
1: <b:loop index='i' values='data:posts' var='post'>
2: <div expr:class='"post-" + data:i % 2'>
3: <b:include data='post' name='post'/>
4: </div>
5: </b:loop>
However, this does not work: the widget within which this is located
fails to show.
Substituting line 2 with <div expr:class='"post-" + data:i'>
causes the code to work as expected.
What's going on? I have checked that the modulo operator is supported.
Parentheses do not fix this.
Thanks.
--
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.
--
Brett Morgan
Developer Programs Engineer, Blogger
You received this message because you are subscribed to the Google Groups "Blogger Developer Group" group.
To post to this group, send email to bloggerdev@googlegroups.com.
To unsubscribe from this group, send email to bloggerdev+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/bloggerdev?hl=en.
No comments:
Post a Comment