cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: [jira] Commented: (COCOON-2110) Evaluate expressions defined in cocooon-expression-language-api in Sitemap engine
Date Fri, 17 Aug 2007 00:24:24 GMT
Daniel Fagerstrom pisze:
> Grzegorz Kossakowski skrev:
>> Vadim Gritsenko (JIRA) pisze:
>> Actually, such syntax is supported[1] in our code for almost two years 
>> now.
> The new syntax is supported but it is plugable and the default settings 
> is using the old syntax. I didn't find any detailed design discussion 
> about the design in the archives, the idea is suggested in 
> For the actual implementation, the parsing of a string with embedded 
> expression calls (a string template) is plugable using the interface 
> o.a.c.template.expression.StringTemplateParser. The current syntax is 
> handles by JXTGStringTemplateParser and the new one by 
> DefaultStringTemplateParser. The choice of string template parser is 
> done in 

> The whole string template mechanism (the package 
> o.a.c.template.expression) could preferably be reused in the sitemap as 
> well. To do this the package needs to be moved to the core 
> (cocoon-expression-language) and refactored a little bit, the 
> dependencies on o.a.c.template.environment.ParsingContext and 
> o.a.c.template.environment.ErrorHolder needs to be removed and a more 
> appropriate package name should be found.
> ...
>> To sum up, new syntax has been introduced during refactoring of 
>> Template block and since community already voted to switch to 
>> refactored code it also voted for new syntax.
> The vote was not about removing the current syntax. It was about 
> switching default implementation of the JXTG concept.
>> Speaking about myself I prefer much more language prefixes and I think 
>> we should go for it. The question that we need to answer is if we want 
>> to support #{} syntax in sitemap? Since it was never there I don't 
>> think it makes sense to do so.
> Using the string template mechanism in the sitemap we get the current 
> JXTG syntax for free, but I would advice users to not use it.

Daniel, I implemented what you proposed but not committed yet due to regression it introduces.

Basically, I implemented handling of sitemap expressions in LegacyStringTemplateParser 
(JXTGStringTemplateParser in the past) and it's seems to work ok with basic tests. However,

LegacyStringTemplateParser is also used in Template block so, as result of my changes, one
will be 
able to evaluate sitemap expressions in templates. It's not that bad but it introduces small

With old implementation of JXTGStringTemplateParser it was possible to escape "{" character
but not 
mandatory. With new implementation it's mandatory because it will be parsed as sitemap expression

otherwise. I tried to search for all occurrences of such unescaped "{" with this command:
find | xargs grep "" -l | xargs grep -E "<\?xml"
-l | xargs 
grep -E "[^#\$][{]" -l | grep -E --invert-match ".svn|target"

and got following results:

Not that much files to fix on our side but I'm wondering about our users. What do you think?
Can we 
go on with such regression?

Grzegorz Kossakowski
*** My Internet Service Provider breaks my internet connection                ***
*** incessantly so I'll not be able to respond to e-mails                     ***
*** regularly and my work will be somehow irregular.                          ***
*** I'm already trying to switch ISP but it will take handful amount of time. ***

View raw message