Details
- Applies to
- moin-1.6.1
- Purpose
- automatically add a table-of-contents to pages
- Description
- if a (new) option is set in the wiki config file, then any page that has a level-1 or level-2 heading will automatically show a table-of-contents
Patch
1 --- Page.py.orig Fri Jan 18 21:42:47 2008
2 +++ Page.py Wed Mar 26 08:53:50 2008
3 @@ -1161,6 +1161,16 @@
4 elif not request.user.may.read(self.page_name):
5 request.write("<strong>%s</strong><br>" % _("You are not allowed to view this page.", formatted=False))
6 else:
7 + # if the config file has the "auto_toc" setting, insert a table
8 + # of contents if the page has any headings
9 + want_toc = True
10 + try:
11 + want_toc = self.cfg.auto_toc
12 + except:
13 + pass
14 + if want_toc and pi['format'] == 'wiki' and not send_missing_page and (body.find("\n= ") >= 0 or body.find("\n== ") >= 0):
15 + body = "<<TableOfContents>>\n" + body
16 +
17 # start wiki content div
18 request.write(self.formatter.startContent(content_id))
Discussion
see FeatureRequests/AutoToc. I've only just started using moinmoin so maybe this isn't the best place to patch this feature in, and I don't know if it has side effects, but it "works-for-me"
Plan
- Priority:
- Assigned to:
- Status:
localhost wiki