Description
When using the TableOfContents macro in a parser region such as an admonition, the table is not expanded.
Steps to reproduce
- Make a page containing the example given below.
- Preview and/or save the page.
- Observe that the info region contains an empty table of contents.
- Extract the macro from the info region.
- Preview and/or save the page again.
- Observe that the macro is now expanded correctly.
Example
See /Test for an example that shows this is not a bug.
Component selection
MoinMoin.macro.TableOfContents
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.
It would be nice to be able to use the macro inside regions, though, even if that was never the original intention. I've only needed such things when converting wiki syntax, however. -- PaulBoddie 2014-01-07 14:07:14
Plan
- Priority:
- Assigned to:
- Status: