Skip to content

Commit

Permalink
gendoc.py: Support modules w/o functions and/or classes.
Browse files Browse the repository at this point in the history
I.e. don't assume that both are always present.
  • Loading branch information
pfalcon committed Jun 29, 2014
1 parent a234759 commit c10a440
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tools/gendoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,16 +228,18 @@ def dump(self):
s.append('# module {}'.format(self.name))
s.append('')
s.append(super().dump())
s.append('')
s.append('## Functions')
for f in sorted(self.functions.values(), key=lambda x:x.name):
if self.functions:
s.append('')
s.append(f.dump(self.name))
s.append('')
s.append('## Classes')
for c in sorted(self.classes.values(), key=lambda x:x.name):
s.append('## Functions')
for f in sorted(self.functions.values(), key=lambda x:x.name):
s.append('')
s.append(f.dump(self.name))
if self.classes:
s.append('')
s.append('[`{}.{}`]({}) - {}'.format(self.name, c.name, c.name, c.descr))
s.append('## Classes')
for c in sorted(self.classes.values(), key=lambda x:x.name):
s.append('')
s.append('[`{}.{}`]({}) - {}'.format(self.name, c.name, c.name, c.descr))
return '\n'.join(s)

def write(self, dir):
Expand Down

0 comments on commit c10a440

Please sign in to comment.