Skip to content

Commit

Permalink
Sort category children, except for categories
Browse files Browse the repository at this point in the history
  • Loading branch information
jessevdk committed Aug 14, 2014
1 parent 6cbdc24 commit ce6cd9c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cldoc/nodes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ def is_unlabeled(self):
return True

def sorted_children(self):
return list(self.children)
schildren = list(Node.sorted_children(self))

# Keep categories in order though
c = [x for x in self.children if isinstance(x, Category)]
c.reverse()

if len(c) == 0:
return schildren

for i in range(0, len(schildren)):
if isinstance(schildren[i], Category):
schildren[i] = c.pop()

return schildren

# vi:ts=4:et

0 comments on commit ce6cd9c

Please sign in to comment.