Problem with getting docinfo_processor to be used in jekyll asciidoctor

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

Problem with getting docinfo_processor to be used in jekyll asciidoctor

maxandersen
Hi,

I initially created https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/112
and it is working great in standalone asciidoctor.

Now I created a simple gem to use in a site using jekyll asciidoctor.

https://github.com/maxandersen/asciidoctor-tabbed-code


What is now weird is that the extension registration does happen (verified by adding logging),
but the extension is never actually called/applied.

Is there a chance that in jekyll docprocessors are not called or am I doing something completely wrong ?

You can see what I did in this jekyll asciidoctor enabled project to try and get it integrated:

https://github.com/quarkusio/quarkusio.github.io/compare/develop...maxandersen:tabbed-code?expand=1


Any tips/pointers to what can cause docinfo processor extensions not to be called would be very appreciated!

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

mojavelinux
Administrator
The docinfo processor doesn't run for embedded documents (which is the mode Asciidoctor uses inside a site generator like Jekyll). As to whether it should, that's an open discussion.

But don't despair. You can use a postprocessor instead. When producing an embedded document, the two are effectively the same.

(The other solution would be to create a liquid tag that can be used in the page template, or just add the additional resources to the page template directly. Though I realize that's not as encapsulated).

Cheers,

-Dan

On Wed, Nov 6, 2019 at 4:11 PM maxandersen [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I initially created https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/112
and it is working great in standalone asciidoctor.

Now I created a simple gem to use in a site using jekyll asciidoctor.

https://github.com/maxandersen/asciidoctor-tabbed-code


What is now weird is that the extension registration does happen (verified by adding logging),
but the extension is never actually called/applied.

Is there a chance that in jekyll docprocessors are not called or am I doing something completely wrong ?

You can see what I did in this jekyll asciidoctor enabled project to try and get it integrated:

https://github.com/quarkusio/quarkusio.github.io/compare/develop...maxandersen:tabbed-code?expand=1


Any tips/pointers to what can cause docinfo processor extensions not to be called would be very appreciated!

Thanks!


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Problem-with-getting-docinfo-processor-to-be-used-in-jekyll-asciidoctor-tp7326.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

mojavelinux
Administrator
In reply to this post by maxandersen

On Wed, Nov 6, 2019 at 4:15 PM Dan Allen <[hidden email]> wrote:
The docinfo processor doesn't run for embedded documents (which is the mode Asciidoctor uses inside a site generator like Jekyll). As to whether it should, that's an open discussion.

But don't despair. You can use a postprocessor instead. When producing an embedded document, the two are effectively the same.

(The other solution would be to create a liquid tag that can be used in the page template, or just add the additional resources to the page template directly. Though I realize that's not as encapsulated).

Cheers,

-Dan

On Wed, Nov 6, 2019 at 4:11 PM maxandersen [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I initially created https://github.com/asciidoctor/asciidoctor-extensions-lab/pull/112
and it is working great in standalone asciidoctor.

Now I created a simple gem to use in a site using jekyll asciidoctor.

https://github.com/maxandersen/asciidoctor-tabbed-code


What is now weird is that the extension registration does happen (verified by adding logging),
but the extension is never actually called/applied.

Is there a chance that in jekyll docprocessors are not called or am I doing something completely wrong ?

You can see what I did in this jekyll asciidoctor enabled project to try and get it integrated:

https://github.com/quarkusio/quarkusio.github.io/compare/develop...maxandersen:tabbed-code?expand=1


Any tips/pointers to what can cause docinfo processor extensions not to be called would be very appreciated!

Thanks!


If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Problem-with-getting-docinfo-processor-to-be-used-in-jekyll-asciidoctor-tp7326.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

maxandersen
In reply to this post by mojavelinux
Thanks for the fast answer Dan ! :)

Changing to postprocessor does definitely gets called - which is good means I was not going crazy.

But I reckon for this particular usecase that is about adding style/css to the header postprocessor wouldn't be enough as it does not have access to the head elements to inject css/js.

Your proposal for simply adding it directly in via jekyll mechanics will in this specific case probably be better.

Well, oh well - I won't be able to use this tabbed-code extension then but those using "raw" asciidoctor can if they want to :)
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

mojavelinux
Administrator
On Wed, Nov 6, 2019 at 4:28 PM maxandersen wrote:
Thanks for the fast answer Dan ! :)

👍


But I reckon for this particular usecase that is about adding style/css to the header postprocessor wouldn't be enough as it does not have access to the head elements to inject css/js.

That would be true even if the docinfo gets called. The scope of the AsciiDoc processing in a site generator is typically inside the main content area of the page. Here the docinfo (and even the postprocessor to a degree) doesn't apply.
 

Your proposal for simply adding it directly in via jekyll mechanics will in this specific case probably be better.

That's typically what I do.
 

Well, oh well - I won't be able to use this tabbed-code extension then but those using "raw" asciidoctor can if they want to :)

You could get the extension to detect the environment. If the attribute env-site is set, the extension could store the docinfo into a page attribute (e.g., page-javascripts). That attribute is then available to the template to echo.


Best,

-Dan

--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

mojavelinux
Administrator
Oh, I almost forgot. The parsed document is exported to the page template too. So in the template (via a liquid tag) you can invoke the docinfo method.

document.docinfo :footer

docinfo could be a good liquid tag to include in the gem.

-Dan

--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Problem with getting docinfo_processor to be used in jekyll asciidoctor

maxandersen
In reply to this post by mojavelinux
mojavelinux wrote
>
> Well, oh well - I won't be able to use this tabbed-code extension then but
> those using "raw" asciidoctor can if they want to :)
>

You could get the extension to detect the environment. If the attribute
env-site is set, the extension could store the docinfo into a page
attribute (e.g., page-javascripts). That attribute is then available to the
template to echo.

Here's how I do it in Awestruct:
https://github.com/asciidoctor/asciidoctor.org/blob/master/_layouts/base.html.slim#L103-L104
hmm - do you have an example/link of that matching asciidoctor extension for doing the environment detction and page attribute setup ?