Login  Register

Re: Interactively debugging a template with a REPL

Posted by mojavelinux on Mar 14, 2016; 7:43am
URL: https://discuss.asciidoctor.org/Interactively-debugging-a-template-with-a-REPL-tp4498p4503.html

Olivier,

I can't tell you how excited I am to read this. It made my day. Thanks for sharing!

This is definitely key material for the guide that will cover how to create custom templates. I'll link to this thread from there.

Cheers,

-Dan

On Sun, Mar 13, 2016 at 9:20 PM, obilodeau [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I got this to work by invoking pry directly from the template I was working on. Let me tell you it is a wonderful and powerful way to poke around for someone not familiar with ruby or asciidoctor's core. I was able to implement what I intended to do much more quicker than by going through those huge "sections" printouts (which holds references to @document and so would scroll forever).

I documented the approach here: https://github.com/asciidoctor/asciidoctor-reveal.js/blob/master/HACKING.adoc#interactively-debug-a-template

Let me stress out how awesome this is for a non-rubyist nor asciidoctor contributor like me: It takes literally 2 minutes to setup and then I could do stuff like `(subsections = sections).empty?` (and understand what it meant, assignment or test!? oh both...) or `? find_by` which pulls out nicely formatted documentation of asciidoctor's AbstractBlock's find_by without me needing to hunt for where the source code was (was doing that before). When you quit the debugger, the processing resumes and debugger will fire again if the `binding.pry` is encountered again otherwise process completes with a rendered document. Marvellous.

Feel free to copy the stuff and improve this documentation as you see fit.

Cheers


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



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen