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

Sandro Martini commented on PIVOT-960:
--------------------------------------

Hi Roger, to me the patch looks good ... only some questions:
- without variables inside json files, macros will be triggered the same ?
- in case something goes wrong during reading variables/processing it, how 
exceptions are handled ?
- variable referencing, will it be possible to use a litle simplified form, 
like $TWO_HUNDRED instead of $(TWO_HUNDRED) ? Many others does something 
similar, for example:
http://groovy.codehaus.org/Strings+and+GString
http://docs.scala-lang.org/overviews/core/string-interpolation.html
So the rule here (as in Scala) could be: $variablename in standard cases, and 
${variablename etc} for more complex cases (not handled here, at least not for 
now), but I understand that {} chars are not the best inside a json file ...

Anyway, go with the commit (and the little change if it's ok for you :-) ) ...


> Implement simple macro system in JSONSerializer
> -----------------------------------------------
>
>                 Key: PIVOT-960
>                 URL: https://issues.apache.org/jira/browse/PIVOT-960
>             Project: Pivot
>          Issue Type: Improvement
>          Components: core-json
>    Affects Versions: 2.0.4
>         Environment: All
>            Reporter: Roger Whitcomb
>            Assignee: Roger Whitcomb
>            Priority: Minor
>             Fix For: 2.1
>
>         Attachments: 960.patch
>
>
> It occurred to me since we are using JSON style sheets to style our 
> application, and it is getting quite big, that a macro system (maybe similar 
> to C/C++ with #define or something similar) would be useful, especially for 
> repeated colors, and other constants (like padding values, fonts, etc.)  This 
> would enable using custom values consistently while avoiding inconsistencies 
> due to typos or changes introduced one place and not others.
> I was thinking of a simple
> #define NAME value
> as in C/C++, and then using $(NAME) as the substitution token.  This is 
> easily implemented in JSONSerializer.
> I'm open to suggestions for the syntax, but I believe the feature will be 
> very useful, especially for the JSON stylesheet.



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

Reply via email to