Changeset 2931
- Timestamp:
- 03/24/05 16:50:41 (8 years ago)
- File:
-
- 1 edited
-
trac/trunk/wiki-macros/TracNav.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trac/trunk/wiki-macros/TracNav.py
r2865 r2931 151 151 if (hdf.getValue('trac.acl.WIKI_MODIFY', '')): 152 152 msg += ' Click here to <a href="%s?edit=yes">edit</a>.' % env.href.wiki(name) 153 msg += '</strong></div> '153 msg += '</strong></div>\n' 154 154 return msg 155 155 156 156 html = '' 157 html += '<div class="wiki-toc trac-nav"> '157 html += '<div class="wiki-toc trac-nav">\n' 158 158 if (hdf.getValue('trac.acl.WIKI_MODIFY', '')): 159 html += '<div class="edit"><a href="%s?edit=yes">edit</a></div> ' % env.href.wiki(name)159 html += '<div class="edit"><a href="%s?edit=yes">edit</a></div>\n' % env.href.wiki(name) 160 160 (found, filtered) = filter(curpage, toc, 0) 161 161 if found: 162 html += display(env, curpage, filtered )162 html += display(env, curpage, filtered, 1) 163 163 else: 164 html += display(env, curpage, toc )165 html += '</div> '164 html += display(env, curpage, toc, 1) 165 html += '</div>\n' 166 166 return html 167 167 … … 189 189 return (found, result) 190 190 191 192 def display(env, curpage, toc): 193 html = '<ul>' 191 def indentation(col): 192 return ' ' * col 193 194 def display(env, curpage, toc, col): 195 html = '%s<ul>\n' % ( indentation(col) ) 196 col += 1 194 197 for name, title, sub in toc: 195 198 if sub == None: … … 198 201 else: 199 202 cls = '' 200 html += ' <li%s>' % ( cls)203 html += '%s<li%s>' % (indentation(col), cls) 201 204 if name == None: 202 205 html += title 203 206 else: 204 207 html += '<a href="%s">%s</a>' % (env.href.wiki(name), title) 205 html += '</li>' 206 else: 207 html += '<li>' 208 html += '</li>\n' 209 else: 210 html += '%s<li>\n' % indentation(col) 211 col += 1 208 212 if name == None or len(sub) > 0: 209 html += '<h4>%s</h4>' % title 210 else: 211 html += '<h4><a href="%s">%s...</a></h4>' % (env.href.wiki(name), title) 212 html += display(env, curpage, sub) 213 html += '</li>' 214 html += '</ul>' 213 html += '%s<h4>%s</h4>\n' % (indentation(col), title) 214 else: 215 html += '%s<h4><a href="%s">%s...</a></h4>\n' % (indentation(col), env.href.wiki(name), title) 216 if len(sub) > 0: 217 html += display(env, curpage, sub, col) 218 col -= 1 219 html += '%s</li>\n' % indentation(col) 220 col -= 1 221 html += '%s</ul>\n' % indentation(col) 215 222 return html 216 223
Note: See TracChangeset
for help on using the changeset viewer.
