Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
5 posts
|
I would like to be able to interactively debug a template modification I am trying to make instead of putting puts statements all over the place and trying to reach the proper object.
Using the slim template engine. In python this would look like this: - import ipdb; ipdb.set_trace() Then running the program from a shell I would get an interactive debugger in the context of where the line executed. Ideally the debugger/REPL would have tab completion to make object hierarchy discovery faster. |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
The debugger you're looking for is PRY. It's pretty amazing, though I have to admit I don't have much experience using it. I'd be thrilled to learn from your experience. On Sun, Mar 13, 2016 at 1:26 PM, obilodeau [via Asciidoctor :: Discussion] <[hidden email]> wrote: I would like to be able to interactively debug a template modification I am trying to make instead of putting puts statements all over the place and trying to reach the proper object. ... [show rest of quote] Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
5 posts
|
Awesome! I'll try and report back here. On Sun, Mar 13, 2016 at 3:58 PM mojavelinux [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen 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-tp4498p4499.html
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
354 posts
|
You should be able to do this by starting PRY and requiring asciidoctor then run the necessary convert methods with the correct template options. You may also want to look into pry-byebug which will add gdb style debugging commands to pry.
On Sunday, March 13, 2016, obilodeau [via Asciidoctor :: Discussion] <[hidden email]> wrote:
... [show rest of quote] -- Sent from Gmail Mobile |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
5 posts
|
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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Administrator
2681 posts
|
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). ... [show rest of quote] Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen |
Free forum by Nabble | Edit this page |