Modify ↓
Opened 18 years ago
Closed 18 years ago
#642 closed defect (fixed)
titleindex, inline combination produces strange lists
Reported by: | Ryan Witt | Owned by: | Christian Boos |
---|---|---|---|
Priority: | normal | Component: | TocMacro |
Severity: | normal | Keywords: | |
Cc: | Ryan Witt | Trac Release: | 0.11 |
Description
When you use the "titlelist" option along with "inline", each title appears in it's own ordered list.
This is probably not what users want, since it results in something like:
- FooPage : A very nice page
- BarPage : Another nice page
- BazPage : Yet a third nice page
See all the 1's? Anyways, the blatantly obvious fix is to place the <ol> tag outside the whole thing. Here's a patch for the simple case:
-
macro.py
159 159 out.write("<div class='wiki-toc'>\n") 160 160 if heading: 161 161 out.write("<h4>%s</h4>\n" % heading) 162 if params['title_index']: 163 out.write('<ol>') 162 164 for pagename in pagenames: 163 165 if params['title_index']: 164 166 li_class = pagename.startswith(current_page) and ' class="active"' or '' … … 167 169 all_pages = list(WikiSystem(self.env).get_pages(prefix)) 168 170 if all_pages: 169 171 all_pages.sort() 170 out.write('<ol>') 172 if not params['title_index']: 173 out.write('<ol>') 171 174 for page in all_pages: 172 175 page_text, _ = get_page_text(page) 173 176 … … 178 181 title = re.sub('<[^>]*>','', title) # Strip all tags 179 182 header = ': ' + wiki_to_oneliner(title, self.env) 180 183 out.write('<li%s> <a href="%s">%s</a> %s</li>\n' % (li_class, self.env.href.wiki(page), page, header)) 181 out.write('</ol>') 184 if not params['title_index']: 185 out.write('</ol>') 182 186 else : 183 187 out.write('<div class="system-message"><strong>Error: No page matching %s found</strong></div>' % prefix) 184 188 else: … … 188 192 formatter.format(current_page, page, page_text, out, params['min_depth'], params['max_depth']) 189 193 else: 190 194 out.write('<div class="system-message"><strong>Error: Page %s does not exist</strong></div>' % pagename) 195 if params['title_index']: 196 out.write('</ol>') 191 197 if not inline: 192 198 out.write("</div>\n") 193 199 return out.getvalue()
This is the fix I'm running on my own trac installation.
Attachments (0)
Change History (2)
comment:1 Changed 18 years ago by
Owner: | changed from Alec Thomas to Christian Boos |
---|---|
Status: | new → assigned |
Trac Release: | 0.9 → 0.11 |
comment:2 Changed 18 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.
Ok. See also #2.