Login  Register

Re: max depth for includes?

Posted by mojavelinux on Nov 06, 2013; 11:30pm
URL: https://discuss.asciidoctor.org/max-depth-for-includes-tp936p955.html

On Wed, Nov 6, 2013 at 2:17 PM, thomas [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi Dan, 

Thanks for the script. Fortunately your script ran fine in my environment. 

So I re-examined my earlier test, and I'm not sure why i didn't catch it last time around (probably a hasty mistake), it was the extension name that was the issue. Makes perfect sense in hindsight.

That's good news! I'm glad you got it worked out.

 
The confusing thing is that: 

A.ad can include content from B.no-ext but any includes in B.no-ext will fail to get processed.

Seems like if it must enforce the correct extension,  it could have thrown a friendly error on reading B.no-ext and not finding an appropriate extension? 

The tricky part here gets back to the reason I introduced this feature. While profiling Asciidoctor on various open source projects, I noticed a high call count to the preprocessor directive methods. I realized Asciidoctor was hitting all the lines in included sources such as JavaScript, HTML, etc. Not only is that unnecessary, it runs the risk of mangling those sources. Therefore, I decided to check the extension before running the preprocessor.

I think the right approach is:

a) Clearly state this behavior in the docs
b) Add an attribute override to the include directive that explicitly enables preprocessing (i.e., include::filename[preprocess=true])

Sound reasonable?

-Dan

--