ObeoNetwork / M2Doc

The M2Doc technology enables the generation of Office Open XML documents from models.
http://obeonetwork.github.io/M2Doc/
Eclipse Public License 2.0
39 stars 22 forks source link

Add support for multiple variable declarations in a single m:let block #434

Open flatombe opened 3 years ago

flatombe commented 3 years ago

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please have a look to the support pages of our website : http://m2doc.org/support/

Current behavior

When setting up variables based on complex navigations where we also need to keep track of intermediary results, we may end up with a lot of {m:let ... and {m:endlet} blocks. Besides making the template larger, it is also error-prone when modifying the variables : removing a block requires identifying the right {m:endlet} block to remove, modifying the value of a variable may end up invalidating a subsequent variable that is defined several template pages later, etc.

Expected behavior

m:let blocks should allow declaring and defining several variables. The syntax for m:let blocks: {m:let variable = AQL expression} ...let block... {m:endlet} could be changed to something akin to e.g.: {m:let v1 = exp1 v2 = exp2(exp1) v3 = exp3(exp2, exp1)} ...let block... {m:endlet}

What is the motivation / use case for changing the behavior?

In a metamodel like Capella, it is not uncommon to have long navigations where we also want to keep track and/or reuse some of the intermediary results: Project > Physical Architecture > Root PhysicalComponentPkg > Root PhysicalComponent and Project > Physical Architecture > Root PhysicalFunctionPkg > Root PhysicalFunction share the first segments of their navigation, and we may want to exploit the intermediary results (Physical Architecture, Root PhysicalComponentPkg and Root PhysicalFunctionPkg) in the template.