Domanda

I'm tring to generate html documentation by uml and all works fine. My issue is that I would enclose all report in:

<html>
  <body>
       //report
  </body>
</html>

How can I do this?

This is my acceleo report template that I would enclose:

[comment encoding = UTF-8 /]
[module useCase('http://www.eclipse.org/uml2/3.0.0/UML')]

[template public generateUseCase(uc : UseCase)]
[comment @main/]

[file (('useCases.html'), true)]

<h1>UseCase: [uc.name/]</h1>
[if (uc.ownedBehavior->notEmpty())]
<h5>Part of Activity: [uc.ownedBehavior.name/]</h5>
[/if]
<h3>Extension Points:</h3>
[if (uc.extensionPoint->isEmpty())]
<p>No Extension Points</p>
[/if]
<ul>
[for (e : ExtensionPoint | uc.extensionPoint)]
 <li>[e.name/]</li>
[/for]
</ul>
[/file]
[/template]
È stato utile?

Soluzione

Stefano,

It is always possible (and adviseable) to sub-divide your templates. Here, instead of appending in a file for every new UseCase you come across, you could use a loop :

[template public generate(p : Package)]
[comment @main/]

[file (('useCases.html'), false)]
<html>
  <body>
[for (uc : UseCase | p.eAllContents(UseCase))]
    [generateUseCase(uc)/]
[/for]
  </body>
</html>
[/file]
[/template]

[template public generateUseCase(uc : UseCase)]
<h1>UseCase: [uc.name/]</h1>
[if (uc.ownedBehavior->notEmpty())]
<h5>Part of Activity: [uc.ownedBehavior.name/]</h5>
[/if]
<h3>Extension Points:</h3>
[if (uc.extensionPoint->isEmpty())]
<p>No Extension Points</p>
[/if]
<ul>
[for (e : ExtensionPoint | uc.extensionPoint)]
 <li>[e.name/]</li>
[/for]
</ul>
[/template]

Please note that using "eAllContents" as I did here is far from efficient, you might want to manually navigate to your list of use cases instead.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top