Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] line feeds in templates
[Acceleo] line feeds in templates [message #503690] Tue, 15 December 2009 01:07 Go to next message
Fabien Giquel is currently offline Fabien Giquel
Messages: 138
Registered: July 2009
Senior Member
Hi,
I am nearly a Acceleo/MTL beginner,
i have a basic but important question about line feed management in templates,
assuming i have the following template :

[template myTemplate(...)]
[if (cond1)]part1[/if]
[if (cond2)]part2[/if]
[for (cond3)]part3[/for]
[if (cond4)]part4[/if]
...
[if (condN)]partN[/if]
[/template]

It works fine, but now i have the requirements :
- I do not want line feeds in output between parts (part1 part2 ...)
- I do not want to write sub-templates for maintenance reasons (too many templates in the same .mtl)

So the basic solution is to write again on a single line :

[template myTemplate(...)][if (cond1)]part1[/if][if (cond2)]part2[/if][for (cond3)]part3[/for][if (cond4)]part4[/if]...[if (condN)]partN[/if]
[/template]

--> Editing the template becomes difficult (line too long with real cases)

Is there a dedicated way to "escape" the line feeds in the template ?

Thanks.


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
4, rue du Château de l'Eraudiere
44324 NANTES CEDEX 03
----------------------------------------------------
Re: [Acceleo] line feeds in templates [message #503713 is a reply to message #503690] Tue, 15 December 2009 08:08 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1623
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050100010303020908000803
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Fabien,

There is no way to remove line feeds as you need for such a behavior.
The only way to have the results of distinct ifs on the same line is to
remove all line feeds in between as you've shown with your "basic solution".

There is no other way ATM, and I do not think there will be. If with a
template like you have there is no line feeds in-between the resulting
"part*", then how do we do if the need is to _have_ line feeds?

Laurent Goubet
Obeo

Fabien Giquel wrote:
> Hi,
> I am nearly a Acceleo/MTL beginner,
> i have a basic but important question about line feed management in
> templates,
> assuming i have the following template :
>
> [template myTemplate(...)]
> [if (cond1)]part1[/if]
> [if (cond2)]part2[/if]
> [for (cond3)]part3[/for]
> [if (cond4)]part4[/if]
> ..
> [if (condN)]partN[/if]
> [/template]
>
> It works fine, but now i have the requirements :
> - I do not want line feeds in output between parts (part1 part2 ...)
> - I do not want to write sub-templates for maintenance reasons (too many
> templates in the same .mtl)
>
> So the basic solution is to write again on a single line :
>
> [template myTemplate(...)][if (cond1)]part1[/if][if
> (cond2)]part2[/if][for (cond3)]part3[/for][if (cond4)]part4[/if]...[if
> (condN)]partN[/if]
> [/template]
>
> --> Editing the template becomes difficult (line too long with real cases)
>
> Is there a dedicated way to "escape" the line feeds in the template ?
>
> Thanks.


--------------050100010303020908000803
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------050100010303020908000803--
Re: [Acceleo] line feeds in templates [message #503731 is a reply to message #503713] Tue, 15 December 2009 04:42 Go to previous message
Fabien Giquel is currently offline Fabien Giquel
Messages: 138
Registered: July 2009
Senior Member
Hi Laurent,

ok, i will go on without it.
thanks for the answer.


----------------------------------------------------
Fabien GIQUEL
R&D Engineer
Mia-Software
4, rue du Château de l'Eraudiere
44324 NANTES CEDEX 03
----------------------------------------------------
Previous Topic:[Xtend] XtendComponent vs. XtendFacade
Next Topic:[Announce] M2T XPAND 0.8.0M4 is available
Goto Forum:
  


Current Time: Thu Aug 21 06:14:02 EDT 2014

Powered by FUDForum. Page generated in 0.02580 seconds