Changeset 3257


Ignore:
Timestamp:
10/02/08 14:06:52 (5 years ago)
Author:
moschny
Message:

Create a tree for the toc instead of using a flat list with indented
elements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trac/plugins/tracnav-0.11/tracnav/tracnav.py

    r3249 r3257  
    253253                    tag.a("edit", href="%s?action=edit" % self.req.href.wiki(name)), 
    254254                    class_="edit")) 
    255         ul = tag.ul() 
    256         self.display(toc, 0, ul) 
    257         out.append(ul) 
    258  
    259     def display(self, toc, depth, ul): 
     255        out.append(self.display(toc, tag.ul())) 
     256 
     257    def display(self, toc, ul): 
    260258        for name, title, sub in toc: 
    261             style = "padding-left: %dem;" % (depth + 1) 
    262259            if sub == None: 
    263260                ul.append(tag.li( 
    264261                        Markup(title), 
    265                         style=style, 
    266262                        class_= (name == self.curpage) and "active" or None)) 
    267263            else: 
    268264                ul.append(tag.li( 
    269                         tag.h4(Markup(title), (name == None or sub) and "..." or None), 
    270                         style=style)) 
     265                        tag.h4(Markup(title), (name == None or sub) and "..." or None))) 
    271266                if len(sub) > 0: 
    272                     self.display(sub, depth + 1, ul) 
     267                    ul.append(self.display(sub, tag.ul())) 
     268        return ul 
    273269 
    274270 
Note: See TracChangeset for help on using the changeset viewer.