Attachment 'TableOfContents-startdepth.diff'

Download

   1 --- TableOfContents.py	2002-12-03 22:15:28.000000000 +0100
   2 +++ NewTableOfContents.py	2003-12-04 16:27:13.000000000 +0100
   3 @@ -6,6 +6,8 @@
   4  
   5      Optional integer argument: maximal depth of listing.
   6  
   7 +    DN: Optional second integer argument: start listing at this depth
   8 +
   9      $Id: TableOfContents.py,v 1.6 2002/12/03 22:15:28 jhermann Exp $
  10  """
  11  
  12 @@ -21,16 +23,27 @@
  13      lineno = 0
  14      titles = {}
  15  
  16 +    # parse args
  17 +    if args:
  18 +        arglist = args.split(',')
  19 +    else:
  20 +        arglist = ''
  21 +
  22      try:
  23          mindepth = int(macro.request.getPragma('section-numbers', 1))
  24      except (ValueError, TypeError):
  25          mindepth = 1
  26  
  27      try:
  28 -        maxdepth = max(int(args), 1)
  29 -    except (ValueError, TypeError):
  30 +        maxdepth = max(int(arglist[0]), 1)
  31 +    except (IndexError, ValueError, TypeError):
  32          maxdepth = 99
  33  
  34 +    try:
  35 +        startdepth = min(int(arglist[1]),maxdepth)
  36 +    except (IndexError, ValueError, TypeError):
  37 +        startdepth = 1
  38 +
  39      for line in macro.parser.lines:
  40          # Filter out the headings
  41          lineno = lineno + 1
  42 @@ -43,6 +56,7 @@
  43          # Get new indent level
  44          newindent = len(match.group(1))
  45          if newindent > maxdepth: continue
  46 +        if newindent < startdepth: continue
  47          if newindent < mindepth: continue
  48          if not indent:
  49              baseindent = newindent - 1

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2005-07-12 02:26:49, 6.3 KB) [[attachment:NewTableOfContents-1.3.4.py]]
  • [get | view] (2005-05-01 18:12:47, 2.6 KB) [[attachment:README]]
  • [get | view] (2003-12-07 18:15:55, 1.3 KB) [[attachment:TableOfContents-startdepth.diff]]
  • [get | view] (2005-06-25 14:38:34, 4.3 KB) [[attachment:moin-1.3.4-rss_rc.py-per_page_feeds.patch]]
  • [get | view] (2005-06-09 20:25:52, 10.1 KB) [[attachment:moin-cache-friendly.diff]]
  • [get | view] (2005-04-27 17:22:13, 2.3 KB) [[attachment:moin-negotiate-auth.diff]]
  • [get | view] (2005-04-04 05:12:33, 18.0 KB) [[attachment:moinmoin-1.3.4-editor-insert-patch.diff]]
  • [get | view] (2005-04-04 05:50:16, 43.3 KB) [[attachment:moinmoin-1.3.4-editor-insert-screenshot.png]]
  • [get | view] (2005-08-17 20:24:31, 18.1 KB) [[attachment:moinmoin-1.3.5-editor-insert-patch.diff]]
  • [get | view] (2003-12-07 18:15:55, 13.0 KB) [[attachment:multisearch.diff]]
  • [get | view] (2005-06-14 14:45:06, 0.8 KB) [[attachment:vary-cookie.diff]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.