Description

When using the TableOfContents macro in a parser region such as an admonition, the table is not expanded.

Steps to reproduce

  1. Make a page containing the example given below.
  2. Preview and/or save the page.
  3. Observe that the info region contains an empty table of contents.
  4. Extract the macro from the info region.
  5. Preview and/or save the page again.
  6. Observe that the macro is now expanded correctly.

Example

See /Test for an example that shows this is not a bug.

Component selection

Details

MoinMoin Version

1.9.7

OS and Version

Ubuntu 8.04

Python Version

2.5

Server Setup

Apache

Server Details

CGI

Language you are using the wiki in (set in the browser/UserPreferences)

English

Workaround

To fix this, the following should be removed or commented out:

    # this is so we get a correctly updated TOC if we just preview in the editor -
    # the new content is not stored on disk yet, but available as macro.parser.raw:
    format = '#format %s\n' % p.pi['format']
    p.set_raw_body(format + macro.parser.raw, modified=1)

Unfortunately, this workaround prevents the expansion of the table in previews.

Discussion

What would be best here is if the entire text of the page (being edited or otherwise) could be obtained from the macro. Currently, the macro object can only ask the parser that created it for its knowledge of the page, but in a parser region this knowledge is limited to the region, not the entire page.

/!\ A parser section is intended to operate only on its contents and not on the entire page. See /Test for an example.

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/TableOfContentsInsideParserRegion (last edited 2014-01-07 14:07:14 by PaulBoddie)