Changeset 3060


Ignore:
Timestamp:
11/26/05 13:19:26 (7 years ago)
Author:
moschny
Message:
  • Cleanup of some doc strings.
  • Remove unused code.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trac/trunk/wiki-macros/TracNav.py

    r3059 r3060  
    108108        OneLinerFormatter.__init__(self, env) 
    109109        self.link = None 
    110         self.myenv = env 
    111110 
    112111    def _make_link(self, namespace, target, match, label): 
     
    127126def get_toc_entry(toc_text, env): 
    128127    """ 
    129     Filter the toc_text for toc entries. 
     128    Parse and format the entries in toc_text. 
    130129    """ 
    131130    for match in LISTRULE.finditer(toc_text): 
    132131        indent = len(match.group('indent')) 
    133132        label, link = format_toc_entry(match.group('rest'), env) 
    134         # env.log.debug("link is '%s'" % link) 
    135133        yield indent, link, label 
    136134 
     
    138136def get_toc_entry_and_indent(gen): 
    139137    """ 
    140     Filter for get_toc_entry().  Returns link and label of the current 
    141     toc entry and the indentation level of the next entry or -1 if 
    142     there are no more entries. The first call to next() returns the 
    143     indentation of the first entry. 
     138    Filter for get_toc_entry().  The first call to next() returns the 
     139    indentation level of the next entry (or -1 if there are no more 
     140    entries) and the second call returns the entry itself. 
    144141    """ 
    145142    while True: 
     
    161158        else:                   # broken indentation structure 
    162159            toclist.append((None, None, sublist)) 
    163     while 1: 
     160    while True: 
    164161        if next_indent == level: 
    165162            (link, label), next_indent = gen.next(), gen.next() 
     
    175172 
    176173def parse_toc(toc_text, env): 
     174    """ 
     175    Recursively construct the toc tree using _parse_toc(). 
     176    """ 
    177177    gen = get_toc_entry_and_indent(get_toc_entry(toc_text, env)) 
    178178    toclist, _ = _parse_toc(gen, gen.next()) 
     
    181181 
    182182def execute(hdf, args, env): 
     183    """ 
     184    Main routine of the wiki macro. 
     185    """ 
    183186    preview = hdf.getValue('args.preview', "") 
    184187    curpage = hdf.getValue('wiki.page_name', "") 
Note: See TracChangeset for help on using the changeset viewer.