Edgewall Software

Opened 18 years ago

Last modified 9 years ago

#4140 new defect

Merge OutlineFormatter into Formatter

Reported by: jpereira@… 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 Christian Boos)


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)

comment:1 by Matthew Good, 18 years ago

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.

in reply to:  1 comment:2 by anonymous, 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 Christian Boos, 17 years ago

Description: modified (diff)
Keywords: parser formatter macro outline added
Milestone: 0.11
Owner: changed from Jonas Borgström to Christian Boos
Priority: lownormal
Severity: minornormal

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 Christian Boos, 17 years ago

Milestone: 0.110.12

WikiEngine refactoring and related fixes postponed.

comment:5 by Christian Boos, 14 years ago

Milestone: next-major-0.1X0.13

comment:6 by Christian Boos, 13 years ago

Milestone: 0.130.14-wikiengine

comment:7 by Ryan J Ollos, 9 years ago

Owner: Christian Boos removed

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.