Changeset 3060
- Timestamp:
- 11/26/05 13:19:26 (7 years ago)
- File:
-
- 1 edited
-
trac/trunk/wiki-macros/TracNav.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trac/trunk/wiki-macros/TracNav.py
r3059 r3060 108 108 OneLinerFormatter.__init__(self, env) 109 109 self.link = None 110 self.myenv = env111 110 112 111 def _make_link(self, namespace, target, match, label): … … 127 126 def get_toc_entry(toc_text, env): 128 127 """ 129 Filter the toc_text for toc entries.128 Parse and format the entries in toc_text. 130 129 """ 131 130 for match in LISTRULE.finditer(toc_text): 132 131 indent = len(match.group('indent')) 133 132 label, link = format_toc_entry(match.group('rest'), env) 134 # env.log.debug("link is '%s'" % link)135 133 yield indent, link, label 136 134 … … 138 136 def get_toc_entry_and_indent(gen): 139 137 """ 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. 144 141 """ 145 142 while True: … … 161 158 else: # broken indentation structure 162 159 toclist.append((None, None, sublist)) 163 while 1:160 while True: 164 161 if next_indent == level: 165 162 (link, label), next_indent = gen.next(), gen.next() … … 175 172 176 173 def parse_toc(toc_text, env): 174 """ 175 Recursively construct the toc tree using _parse_toc(). 176 """ 177 177 gen = get_toc_entry_and_indent(get_toc_entry(toc_text, env)) 178 178 toclist, _ = _parse_toc(gen, gen.next()) … … 181 181 182 182 def execute(hdf, args, env): 183 """ 184 Main routine of the wiki macro. 185 """ 183 186 preview = hdf.getValue('args.preview', "") 184 187 curpage = hdf.getValue('wiki.page_name', "")
Note: See TracChangeset
for help on using the changeset viewer.
