Edgewall Software

Ticket #4140 (new defect)

Opened 2 years ago

Last modified 20 months ago

Merge OutlineFormatter into Formatter

Reported by: jpereira@… Owned by: cboos
Priority: normal Milestone: 0.13
Component: wiki system Version: 0.10.1
Severity: normal Keywords: parser formatter macro outline
Cc:

Description (last modified by cboos) (diff)

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

Change History

follow-up: ↓ 2   Changed 2 years ago by mgood

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   Changed 2 years ago by anonymous

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?

  Changed 2 years ago by cboos

  • description modified (diff)
  • priority changed from low to normal
  • owner changed from jonas to cboos
  • milestone set to 0.11
  • keywords parser formatter macro outline added
  • severity changed from minor to normal

Related to #4431, but this ticket is about getting the specifics of PageOutline right in the case of the parser/formatter split.

  Changed 20 months ago by cboos

  • milestone changed from 0.11 to 0.12

WikiEngine refactoring and related fixes postponed.

Add/Change #4140 (Merge OutlineFormatter into Formatter)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from cboos. Next status will be 'new'
The owner will change from cboos to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.