Preprocessor phases

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Preprocessor phases

mojavelinux
Administrator

I keep thinking about when the Preprocessor is invoked. I want to run my thoughts by this list to see if anyone has any input on the matter.

Currently, the Preprocessor is invoked just before parsing begins. This is the most likely point the extension point will be used. However, it may also be useful to tap into the lifecycle after the header of the document has been read and parsed. After all, the header may contribute information/settings that can impact parsing internally.

Should the Preprocessor get invoked at this point as well?
- If so, should the same method be invoked (Preprocessor#process)?
In that case, how is the lifecycle phase communicated? (Perhaps the processor consults the existing Document#header? method)
- If not, should a separate method be called on the processor?

I look forward to any input you can provide!

-Dan

Reply | Threaded
Open this post in threaded view
|

Re: Preprocessor phases

LightGuardjp
Thinking out loud here. 

The same method makes sense. You could require a param for the method and pass an empty object or something for the first phase. That would be the easiest for Asciidoctor, however, slightly more work for the extension author. 

A separate method though is only slightly more work for the extension author and probably about the same for Asciidoctor (responds_to?). 

Is there even a point you'd want to do preprocessing without consulting the Document#header? Personally I would think not because you could very easily include variables in the file that you'd need to act on. Writing an extension without having much (any?) information about what you're extending (the document) seems a bit useless. 

Sent from Mailbox for iPhone


On Sun, Aug 25, 2013 at 1:12 PM, mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:

I keep thinking about when the Preprocessor is invoked. I want to run my thoughts by this list to see if anyone has any input on the matter.

Currently, the Preprocessor is invoked just before parsing begins. This is the most likely point the extension point will be used. However, it may also be useful to tap into the lifecycle after the header of the document has been read and parsed. After all, the header may contribute information/settings that can impact parsing internally.

Should the Preprocessor get invoked at this point as well?
- If so, should the same method be invoked (Preprocessor#process)?
In that case, how is the lifecycle phase communicated? (Perhaps the processor consults the existing Document#header? method)
- If not, should a separate method be called on the processor?

I look forward to any input you can provide!

-Dan




If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Preprocessor-phases-tp520.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML