Created
October 21, 2017 15:10
-
-
Save aranega/df7645f8ef3dffc590ef8abf70140b75 to your computer and use it in GitHub Desktop.
Sample RDS to Documentation Acceleo Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[module rds2doc('http://com.genmymodel.rds.core/1.0')/] | |
[template public generate(d : Database)] | |
[comment @main/] | |
[file (d.name + '.txt', false, 'UTF-8')] | |
= [d.name/] Database Documentation | |
[d.getDoc()/] | |
[d.elements.generate()/] | |
[/file] | |
[/template] | |
[template public generate(a : ModelElement)/] | |
[template public generate(g : Group)] | |
[g.level('=')/] [g.name/] Group Documentation | |
[g.getDoc()/] | |
[g.elements.generate()/] | |
[/template] | |
[template public generate(t : Table)] | |
[t.level('=')/] [t.name/] Table Documentation | |
[t.getDoc()/] | |
[t.columns.generate()/] | |
[/template] | |
[template public generate(c : Column)] | |
[c.level('=')/] [c.name/] Column Documentation | |
[c.getDoc()/] | |
[/template] | |
[query public getDoc(a : ModelElement) : String = | |
if (a.getEAnnotation('genmymodel') = null | |
or not a.getEAnnotation('genmymodel').details->exists(key = 'gmm-documentation')) then | |
null | |
else | |
a.getEAnnotation('genmymodel').details->select(key = 'gmm-documentation')->first().value | |
endif | |
/] | |
[query public isNotEmpty(s : String) : Boolean = | |
s <> null and s <> '' | |
/] | |
[template public level(a : ModelElement, s : String)] | |
[for (i : Integer | Sequence{0..a.ancestors()->size()})][s/][/for] | |
[/template] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment