首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Acceleo文件问题

Acceleo文件问题
EN

Stack Overflow用户
提问于 2013-11-21 12:19:04
回答 1查看 100关注 0票数 0

我正在尝试用uml生成html文档,所有这些都很好。我的问题是,我谨随函附上以下所有报告:

代码语言:javascript
复制
<html>
  <body>
       //report
  </body>
</html>

我该怎么做?

这是我的acceleo报告模板,随函附上:

代码语言:javascript
复制
[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]
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-22 07:49:22

斯特凡诺

总是有可能(也是明智的)细分你的模板。在这里,您可以使用一个循环,而不是为遇到的每一个新UseCase在文件中追加:

代码语言:javascript
复制
[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]

请注意,像我在这里所做的那样,使用"eAllContents“是远远不够有效的,您可能希望手动导航到用例列表。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20120838

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档