97 self.func_line=inspect.formatargspec(args, varargs, keywords, defaults) |
98 self.func_line=inspect.formatargspec(args, varargs, keywords, defaults) |
98 self.description = m.__doc__.split("\n")[0].decode("utf8") |
99 self.description = m.__doc__.split("\n")[0].decode("utf8") |
99 self.args=[Arg(a,m) for a in args] |
100 self.args=[Arg(a,m) for a in args] |
100 _, self.rets=ret(m) |
101 _, self.rets=ret(m) |
101 |
102 |
|
103 class Table(Link): |
|
104 def __init__(self,cls): |
|
105 name=cls.__name__ |
|
106 self.tablename=cls.__tablename__ |
|
107 title=self.tablename[0].upper()+self.tablename[1:] |
|
108 Link.__init__(self,name,title) |
|
109 self.description = cls.__doc__.split("\n")[0].decode("utf8") |
|
110 |
102 |
111 |
103 def main(): |
112 def main(): |
104 sites=[Site("index.html","Iro"), |
113 sites=[Site("index.html","Iro"), |
105 Site("current.html","API Documentation"), |
114 Site("current.html","API Documentation"), |
106 Site("new.html","geplante API Documentation"), |
115 Site("new.html","geplante API Documentation"), |
|
116 Site("database.html","Datenbank Schema"), |
107 Site("impressum.html","Impressum"), |
117 Site("impressum.html","Impressum"), |
108 ] |
118 ] |
109 |
119 |
110 current_methods = dict(inspect.getmembers(Current(None,None))) |
120 current_methods = dict(inspect.getmembers(Current(None,None))) |
111 current=[ |
121 current=[ |
130 Method("stop",new_methods), |
140 Method("stop",new_methods), |
131 |
141 |
132 Method("routes",new_methods), |
142 Method("routes",new_methods), |
133 Method("defaultRoute",new_methods), |
143 Method("defaultRoute",new_methods), |
134 ] |
144 ] |
135 |
145 |
|
146 t = [Table(f.class_) for f in tables] |
|
147 createSchemaPlot('doc/images/db-schema.svg') |
136 |
148 |
137 for site in sites: |
149 for site in sites: |
138 print("generiere %s" % site.name) |
150 print("generiere %s" % site.name) |
139 tmpl = loader.load(site.name) |
151 tmpl = loader.load(site.name) |
140 def a(s): |
152 def a(s): |
141 if s == site: |
153 if s == site: |
142 return {"class":"menu active"} |
154 return {"class":"menu active"} |
143 stream = tmpl.generate(sites=sites,active=a,current=current,new=newm) |
155 stream = tmpl.generate(sites=sites,active=a,current=current,new=newm,tables=t) |
144 with open('doc/'+site.name, "w") as g: |
156 with open('doc/'+site.name, "w") as g: |
145 g.write(stream.render('html', doctype='html')) |
157 g.write(stream.render('html', doctype='html')) |
146 |
158 |
147 if __name__ == '__main__': |
159 if __name__ == '__main__': |
148 main() |
160 main() |