You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by "Ondra Žižka (JIRA)" <ji...@apache.org> on 2015/12/15 15:19:46 UTC

[jira] [Comment Edited] (FREEMARKER-8) Adding to a hash (map)

    [ https://issues.apache.org/jira/browse/FREEMARKER-8?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15058114#comment-15058114 ] 

Ondra Žižka edited comment on FREEMARKER-8 at 12/15/15 2:19 PM:
----------------------------------------------------------------

I agree that freemarker is not a programming language. However, there are at least 2 scenarios where using it so to some extent helps a lot:

1) When you can't change the backend data - they are given and you are there to make the most of them.
2) When preparing the data in the background would actually take more computing than aggregating them in the template.

For that, a flexible maps would help a lot.
Thanks for the API workaround.


was (Author: pekarna):
I agree that freemarker is not a programming language. However, there are at least 2 scenarios where using it so to some extent helps a lot:

1) When you can't change the backend data - they are given and you are there to make the most of them.
2) When preparing the data in the background would actually take more computing than aggregating them in the template.

For that, a flexible maps would help a lot.


> Adding to a hash (map)
> ----------------------
>
>                 Key: FREEMARKER-8
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-8
>             Project: Apache Freemarker
>          Issue Type: New Feature
>          Components: engine
>    Affects Versions: 2.3.23
>            Reporter: Ondra Žižka
>
> It would be nice to assign to a map this way:
> {code}
> <#assign map["key"] = 1>
> {code}
> and also 
> {code}
> <#assign map["key"]++>
> {code}
> So far I think it's like this but can't get it work:
> {code}
> <#assign map += {classification.classification : map[classification.classification]!++}>
> {code}
> Thanks for considering.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)