Opened 18 years ago
Last modified 9 years ago
#4140 new defect
Merge OutlineFormatter into Formatter
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | topic-wikiengine |
Component: | wiki system | Version: | 0.10.1 |
Severity: | normal | Keywords: | parser formatter macro outline |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description (last modified by )
Hi,
Macros like the PageOutline make use of the OutlineFormatter to build a table of contents. But it seems awfully inefficient that you'll have to run through the page twice in order to do just that. How about having the standard Formatter build the outline[] array just like the OutlineFormatter does, so that one could refer to it at anytime during a macro? It'd be a really simple change too, merging both behaviours into one class. Then you'd just call the macros at the end of the wiki pages wherever you wanted an outline to be generated.
I'd be glad to submit this, if you require an extra hand,
- Jorge Pereira
Attachments (0)
Change History (7)
follow-up: 2 comment:1 by , 18 years ago
comment:2 by , 18 years ago
Parsing the page first and then outputting would remove part of the problem. But it still doesn't deal with "priorities". For instance, content generated by macros (like Include) still should be included in the outline, so it has to be parsed first.
In the case of the outline, it's a special case in which the result of the macro depends on the whole page, so there's only a couple limited ways to do it in one pass.
The simplest way would be to output the text at the end of the page, then use div positioning to put it somewhere else, but that's a presentation trick.
Just for the PageOutline macro, it'd probably make sense to parse the page normally while storing the headers in outline[] (just like OutlineFormatter does) and then at the end of the processing just treat PageOutline as a special case and run just that macro.
A more generic solution, maybe make it so macros were specified as either "inline" or "post" and then be ran at the appropriate step? We could ignore "post" macros and only store their index in the output text (post_macros[]) for processing after the whole document has been generated. Then at the end of the page we'de iterate the array of post_macros and execute them.
Any thoughts on this?
comment:3 by , 18 years ago
Description: | modified (diff) |
---|---|
Keywords: | parser formatter macro outline added |
Milestone: | → 0.11 |
Owner: | changed from | to
Priority: | low → normal |
Severity: | minor → normal |
Related to #4431, but this ticket is about getting the specifics of PageOutline right in the case of the parser/formatter split.
comment:4 by , 17 years ago
Milestone: | 0.11 → 0.12 |
---|
WikiEngine refactoring and related fixes postponed.
comment:5 by , 15 years ago
Milestone: | next-major-0.1X → 0.13 |
---|
comment:6 by , 14 years ago
Milestone: | 0.13 → 0.14-wikiengine |
---|
comment:7 by , 9 years ago
Owner: | removed |
---|
Normally the macros are used to insert an outline near the beginning of the page, so I'm not sure I follow how you'll process the page, then go back and insert the outline at the beginning. But if you've got an idea how that would work and would like to submit a patch we'd be happy to see it. Eventually the plan is to separate the parsing from the formatting, so the it would just require iterating over the parse tree, instead of fully reparsing the page twice.