public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Learning how Lua filters work through Debugging?
@ 2019-06-26 11:29 iandol
       [not found] ` <cffd9ff2-b19b-45e0-8529-43ddfa26582d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: iandol @ 2019-06-26 11:29 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1153 bytes --]

Hi,

I currently use Ruby + paru to write filters, and I like the workflow (I 
can trigger remote debugging from with Pandoc's run and step debug with a 
console to evaluate/change variables in-situ etc). But I wanted to write a 
new filter in Lua, and wondered if I can do something similar? Do Lua 
coders here have any recommendations for this? I currently use Visual 
Studio Code, which does have a Lua debug extension, but saw ZeroBrane 
Studio is a specialised Lua IDE with a remote debugger. Also any 
recommendations for a very simple Lua for beginners tutorial?

Thanks!


-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cffd9ff2-b19b-45e0-8529-43ddfa26582d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1639 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found] ` <cffd9ff2-b19b-45e0-8529-43ddfa26582d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-06-26 19:32   ` Albert Krewinkel
       [not found]     ` <871rzgywgd.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Albert Krewinkel @ 2019-06-26 19:32 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

iandol writes:

> I currently use Ruby + paru to write filters, and I like the workflow (I
> can trigger remote debugging from with Pandoc's run and step debug with a
> console to evaluate/change variables in-situ etc). But I wanted to write a
> new filter in Lua, and wondered if I can do something similar? Do Lua
> coders here have any recommendations for this? I currently use Visual
> Studio Code, which does have a Lua debug extension, but saw ZeroBrane
> Studio is a specialised Lua IDE with a remote debugger.

This would be great. I never tried ZeroBrane, but reading about its
debugging feature makes me believe that debugging should be possible.
One problem might be that pandoc is not (yet) available as a Lua module:
you would have to setup pandoc as the Lua interpreter in ZeroBrane, and
I don't know how easy that is.

> Also any recommendations for a very simple Lua for beginners tutorial?

I started out by reading "[Programming in Lua]". The first version is
freely available online and I found it to be very approachable. After
that, I switched to the [Lua reference manual], which is surprisingly
readable for a reference.


[Programming in Lua]: https://www.lua.org/pil/
[Lua reference manual]: https://www.lua.org/manual/5.3/manual.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]     ` <871rzgywgd.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2019-06-27  2:49       ` iandol
       [not found]         ` <620bb703-64b0-43e3-b4b5-0c0ce34181e0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: iandol @ 2019-06-27  2:49 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2190 bytes --]

On Thursday, 27 June 2019 03:32:13 UTC+8, Albert Krewinkel wrote:
>
>
> This would be great. I never tried ZeroBrane, but reading about its 
> debugging feature makes me believe that debugging should be possible. 
> One problem might be that pandoc is not (yet) available as a Lua module: 
> you would have to setup pandoc as the Lua interpreter in ZeroBrane, and 
> I don't know how easy that is. 
>

 Thanks Albert! I tried ZeroBrane, using environment variables to access 
mobdebug and socket files to the path before running, and putting `
*require("mobdebug").start()*` in the script. Running pandoc normally from 
the commandline did trigger the Zerobrane Debug server, however although A 
could put a breakpoint in the main top-level code, I couldn't put a 
breakpoint within a function call nor step into the function from outside 
it (e.g. *function Emph(elem)*). I assumed Lua is V5.3 in Pandoc, is that 
correct? As I understand it, the remote debugger does not need to know 
Pandoc is hosting Lua, as the debugger communicates via a socket to the 
process. ZeroBrane is really nice, extremely fast and great documentation! 
So TLDR; is that the remote debugger does trigger without needing to 
specify Pandoc, but there was an issue with stepping into functions. 
ZeroBrane is close to being an ideal solution...

I also tried using Visual Studio Code and an extension that supports remote 
debug: https://github.com/actboy168/lua-debug — but instructions are in 
Chinese and I didn't have enough time to get it to work…

Thanks for the links to learning materials.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/620bb703-64b0-43e3-b4b5-0c0ce34181e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 3192 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]         ` <620bb703-64b0-43e3-b4b5-0c0ce34181e0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-28  3:04           ` iandol
       [not found]             ` <5c926b63-e3fc-4fd5-ab4a-77b3bafc5273n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: iandol @ 2020-09-28  3:04 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 2775 bytes --]

A recent wishlist request <https://github.com/jgm/pandoc/issues/6654> for a 
REPL for Lua filters on the Issues list made me revisit the option of using 
Zerobrane's debugger. I can now get the debugger to trigger a debug session 
initiated from a Pandoc run, and Zerobrane offers a Lua console and other 
tools to inspect and manipulate the code running in a filter, greatly 
aiding those of us who are not proficient in Lua or do not understand how 
the Pandoc AST is represented in Lua. Some brief instructions can be found 
here: filters/luatest.lua 
<https://github.com/iandol/dotpandoc/blob/master/filters/luatest.lua> 

On Thursday, 27 June 2019 at 10:49:12 UTC+8 iandol wrote:

> On Thursday, 27 June 2019 03:32:13 UTC+8, Albert Krewinkel wrote:
>>
>>
>> This would be great. I never tried ZeroBrane, but reading about its 
>> debugging feature makes me believe that debugging should be possible. 
>> One problem might be that pandoc is not (yet) available as a Lua module: 
>> you would have to setup pandoc as the Lua interpreter in ZeroBrane, and 
>> I don't know how easy that is. 
>>
>
>  Thanks Albert! I tried ZeroBrane, using environment variables to access 
> mobdebug and socket files to the path before running, and putting `
> *require("mobdebug").start()*` in the script. Running pandoc normally 
> from the commandline did trigger the Zerobrane Debug server, however 
> although A could put a breakpoint in the main top-level code, I couldn't 
> put a breakpoint within a function call nor step into the function from 
> outside it (e.g. *function Emph(elem)*). I assumed Lua is V5.3 in Pandoc, 
> is that correct? As I understand it, the remote debugger does not need to 
> know Pandoc is hosting Lua, as the debugger communicates via a socket to 
> the process. ZeroBrane is really nice, extremely fast and great 
> documentation! So TLDR; is that the remote debugger does trigger without 
> needing to specify Pandoc, but there was an issue with stepping into 
> functions. ZeroBrane is close to being an ideal solution...
>
> I also tried using Visual Studio Code and an extension that supports 
> remote debug: https://github.com/actboy168/lua-debug — but instructions 
> are in Chinese and I didn't have enough time to get it to work…
>
> Thanks for the links to learning materials.
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5c926b63-e3fc-4fd5-ab4a-77b3bafc5273n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4092 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]             ` <5c926b63-e3fc-4fd5-ab4a-77b3bafc5273n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-28  5:29               ` Albert Krewinkel
       [not found]                 ` <87pn66jwol.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Albert Krewinkel @ 2020-09-28  5:29 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

iandol writes:

> A recent wishlist request <https://github.com/jgm/pandoc/issues/6654> for a
> REPL for Lua filters on the Issues list made me revisit the option of using
> Zerobrane's debugger. I can now get the debugger to trigger a debug session
> initiated from a Pandoc run, and Zerobrane offers a Lua console and other
> tools to inspect and manipulate the code running in a filter, greatly
> aiding those of us who are not proficient in Lua or do not understand how
> the Pandoc AST is represented in Lua. Some brief instructions can be found
> here: filters/luatest.lua
> <https://github.com/iandol/dotpandoc/blob/master/filters/luatest.lua>

Wow, this is awesome! (I thought this wouldn't be possible; sometimes
it's so nice to be wrong.)

Would you like to add this to the pandoc Lua filter documentation? I'm
sure many would appreciate having that info in there.


--
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]                 ` <87pn66jwol.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2020-09-28 11:13                   ` iandol
       [not found]                     ` <c327601e-964d-48b3-a00f-edc417a2911bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: iandol @ 2020-09-28 11:13 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1901 bytes --]

Yes, I'd be happy to add this there. As my Lua knowledge barely rises to 
the level of neophyte dabbler, I'd be happy if someone can confirm this 
works for them too and all makes sense (I've only tested on macOS). Perhaps 
I can make a pull request and it can be discussed there (though I won't 
have till till later this week)? I also thought I could add the test filter 
to the lua filters repository...

Ian

On Monday, 28 September 2020 at 13:29:56 UTC+8 Albert Krewinkel wrote:

> iandol writes:
>
> > A recent wishlist request <https://github.com/jgm/pandoc/issues/6654> 
> for a
> > REPL for Lua filters on the Issues list made me revisit the option of 
> using
> > Zerobrane's debugger. I can now get the debugger to trigger a debug 
> session
> > initiated from a Pandoc run, and Zerobrane offers a Lua console and other
> > tools to inspect and manipulate the code running in a filter, greatly
> > aiding those of us who are not proficient in Lua or do not understand how
> > the Pandoc AST is represented in Lua. Some brief instructions can be 
> found
> > here: filters/luatest.lua
> > <https://github.com/iandol/dotpandoc/blob/master/filters/luatest.lua>
>
> Wow, this is awesome! (I thought this wouldn't be possible; sometimes
> it's so nice to be wrong.)
>
> Would you like to add this to the pandoc Lua filter documentation? I'm
> sure many would appreciate having that info in there.
>
>
> --
> Albert Krewinkel
> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c327601e-964d-48b3-a00f-edc417a2911bn%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 3146 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]                     ` <c327601e-964d-48b3-a00f-edc417a2911bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2020-09-28 21:54                       ` John MacFarlane
       [not found]                         ` <m2eeml1sap.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: John MacFarlane @ 2020-09-28 21:54 UTC (permalink / raw)
  To: iandol, pandoc-discuss


A PR would be most welcome!

iandol <iandol-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Yes, I'd be happy to add this there. As my Lua knowledge barely rises to 
> the level of neophyte dabbler, I'd be happy if someone can confirm this 
> works for them too and all makes sense (I've only tested on macOS). Perhaps 
> I can make a pull request and it can be discussed there (though I won't 
> have till till later this week)? I also thought I could add the test filter 
> to the lua filters repository...
>
> Ian
>
> On Monday, 28 September 2020 at 13:29:56 UTC+8 Albert Krewinkel wrote:
>
>> iandol writes:
>>
>> > A recent wishlist request <https://github.com/jgm/pandoc/issues/6654> 
>> for a
>> > REPL for Lua filters on the Issues list made me revisit the option of 
>> using
>> > Zerobrane's debugger. I can now get the debugger to trigger a debug 
>> session
>> > initiated from a Pandoc run, and Zerobrane offers a Lua console and other
>> > tools to inspect and manipulate the code running in a filter, greatly
>> > aiding those of us who are not proficient in Lua or do not understand how
>> > the Pandoc AST is represented in Lua. Some brief instructions can be 
>> found
>> > here: filters/luatest.lua
>> > <https://github.com/iandol/dotpandoc/blob/master/filters/luatest.lua>
>>
>> Wow, this is awesome! (I thought this wouldn't be possible; sometimes
>> it's so nice to be wrong.)
>>
>> Would you like to add this to the pandoc Lua filter documentation? I'm
>> sure many would appreciate having that info in there.
>>
>>
>> --
>> Albert Krewinkel
>> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/c327601e-964d-48b3-a00f-edc417a2911bn%40googlegroups.com.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Learning how Lua filters work through Debugging?
       [not found]                         ` <m2eeml1sap.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
@ 2020-10-12  9:10                           ` iandol
  0 siblings, 0 replies; 8+ messages in thread
From: iandol @ 2020-10-12  9:10 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 3004 bytes --]

This information is now included in the lua-filters documentation — 
https://pandoc.org/lua-filters.html#debugging-lua-filters, and a sample 
filter with detailed instructions can be found 
here: https://github.com/pandoc/lua-filters/tree/master/lua-debug-example 

Happy stepping!


On Tuesday, 29 September 2020 at 05:54:23 UTC+8 John MacFarlane wrote:

>
> A PR would be most welcome!
>
> iandol <ian...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Yes, I'd be happy to add this there. As my Lua knowledge barely rises to 
> > the level of neophyte dabbler, I'd be happy if someone can confirm this 
> > works for them too and all makes sense (I've only tested on macOS). 
> Perhaps 
> > I can make a pull request and it can be discussed there (though I won't 
> > have till till later this week)? I also thought I could add the test 
> filter 
> > to the lua filters repository...
> >
> > Ian
> >
> > On Monday, 28 September 2020 at 13:29:56 UTC+8 Albert Krewinkel wrote:
> >
> >> iandol writes:
> >>
> >> > A recent wishlist request <https://github.com/jgm/pandoc/issues/6654> 
>
> >> for a
> >> > REPL for Lua filters on the Issues list made me revisit the option of 
> >> using
> >> > Zerobrane's debugger. I can now get the debugger to trigger a debug 
> >> session
> >> > initiated from a Pandoc run, and Zerobrane offers a Lua console and 
> other
> >> > tools to inspect and manipulate the code running in a filter, greatly
> >> > aiding those of us who are not proficient in Lua or do not understand 
> how
> >> > the Pandoc AST is represented in Lua. Some brief instructions can be 
> >> found
> >> > here: filters/luatest.lua
> >> > <https://github.com/iandol/dotpandoc/blob/master/filters/luatest.lua>
> >>
> >> Wow, this is awesome! (I thought this wouldn't be possible; sometimes
> >> it's so nice to be wrong.)
> >>
> >> Would you like to add this to the pandoc Lua filter documentation? I'm
> >> sure many would appreciate having that info in there.
> >>
> >>
> >> --
> >> Albert Krewinkel
> >> GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124
> >>
> >
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/pandoc-discuss/c327601e-964d-48b3-a00f-edc417a2911bn%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4bca826d-9cea-4cea-b517-e41bf9454efan%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 4968 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-12  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-26 11:29 Learning how Lua filters work through Debugging? iandol
     [not found] ` <cffd9ff2-b19b-45e0-8529-43ddfa26582d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-06-26 19:32   ` Albert Krewinkel
     [not found]     ` <871rzgywgd.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2019-06-27  2:49       ` iandol
     [not found]         ` <620bb703-64b0-43e3-b4b5-0c0ce34181e0-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-28  3:04           ` iandol
     [not found]             ` <5c926b63-e3fc-4fd5-ab4a-77b3bafc5273n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-28  5:29               ` Albert Krewinkel
     [not found]                 ` <87pn66jwol.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2020-09-28 11:13                   ` iandol
     [not found]                     ` <c327601e-964d-48b3-a00f-edc417a2911bn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-28 21:54                       ` John MacFarlane
     [not found]                         ` <m2eeml1sap.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>
2020-10-12  9:10                           ` iandol

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).