* RFC: compiling lpeg into pandoc @ 2021-11-01 13:38 Albert Krewinkel [not found] ` <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Albert Krewinkel @ 2021-11-01 13:38 UTC (permalink / raw) To: pandoc-discuss Hi all, I'd like to request views and opinions on the inclusion of a Lua library into pandoc: the LPeg library is a small parsing library written in C to be used with Lua. http://www.inf.puc-rio.br/~roberto/lpeg/ The motivation is that this library could be used to extend pandoc to deal with new formats. A good example is jgm's "lunamark", which could be modified to support custom syntax extensions that might otherwise be difficult to implement with current filters. https://github.com/jgm/lunamark/blob/master/lunamark/reader/markdown.lua On the other hand, this is yet another library and could be considered bloat. Most users, esp. on Mac and Linux, should not find it too difficult to install the library on their system should they need it. The question is therefore if you think whether including lpeg into pandoc would make is worth it; e.g., do you believe you'd write such LPeg-based parsers? Would you share them with people who wouldn't immediately know how to install the library themselves? Thanks in advance, Albert PS: The corresponding pull request is https://github.com/jgm/pandoc/pull/7649 -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>]
* AW: compiling lpeg into pandoc [not found] ` <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> @ 2021-11-01 22:06 ` denis.maier-NSENcxR/0n0 [not found] ` <83dbc2c6dcbe49e49e00dac40b73eb65-NSENcxR/0n0@public.gmane.org> 2021-11-01 23:14 ` RFC: " BPJ 2021-11-08 15:38 ` Albert Krewinkel 2 siblings, 1 reply; 10+ messages in thread From: denis.maier-NSENcxR/0n0 @ 2021-11-01 22:06 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Hi Albert, well, the last time I've tried it I struggled with luarocks on windows. So, I'd welcome the addition of some libraries. Best, Denis > -----Ursprüngliche Nachricht----- > Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc- > discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Albert Krewinkel > Gesendet: Montag, 1. November 2021 14:38 > An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Betreff: RFC: compiling lpeg into pandoc > > Hi all, > > I'd like to request views and opinions on the inclusion of a Lua library into > pandoc: the LPeg library is a small parsing library written in C to be used with > Lua. http://www.inf.puc-rio.br/~roberto/lpeg/ > > The motivation is that this library could be used to extend pandoc to deal > with new formats. A good example is jgm's "lunamark", which could be > modified to support custom syntax extensions that might otherwise be > difficult to implement with current filters. > https://github.com/jgm/lunamark/blob/master/lunamark/reader/markdow > n.lua > > On the other hand, this is yet another library and could be considered bloat. > Most users, esp. on Mac and Linux, should not find it too difficult to install > the library on their system should they need it. > > The question is therefore if you think whether including lpeg into pandoc > would make is worth it; e.g., do you believe you'd write such LPeg-based > parsers? Would you share them with people who wouldn't immediately > know how to install the library themselves? > > Thanks in advance, > Albert > > > PS: The corresponding pull request is > https://github.com/jgm/pandoc/pull/7649 > > -- > 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/87ee806loe.fsf%40zeitkraut.de. -- 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/83dbc2c6dcbe49e49e00dac40b73eb65%40unibe.ch. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <83dbc2c6dcbe49e49e00dac40b73eb65-NSENcxR/0n0@public.gmane.org>]
* AW: compiling lpeg into pandoc [not found] ` <83dbc2c6dcbe49e49e00dac40b73eb65-NSENcxR/0n0@public.gmane.org> @ 2021-11-02 11:44 ` denis.maier-NSENcxR/0n0 [not found] ` <ec915ee445b6471fb1f252d98a727e3d-NSENcxR/0n0@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: denis.maier-NSENcxR/0n0 @ 2021-11-02 11:44 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Ok, I've tried again. Installing luarocks on linux was easy, but I've had no success on Windows. Anyone knows how to install luarocks on Windows? Anyway, so if I install modules via luarocks they become usable in filters? (That is, pandoc's lua will find those modules?) Denis > -----Ursprüngliche Nachricht----- > Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc- > discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von denis.maier-NSENcxR/0n0@public.gmane.org > Gesendet: Montag, 1. November 2021 23:06 > An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Betreff: AW: compiling lpeg into pandoc > > Hi Albert, > > well, the last time I've tried it I struggled with luarocks on windows. So, I'd > welcome the addition of some libraries. > > Best, > Denis > > > -----Ursprüngliche Nachricht----- > > Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc- > > discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Im Auftrag von Albert Krewinkel > > Gesendet: Montag, 1. November 2021 14:38 > > An: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > > Betreff: RFC: compiling lpeg into pandoc > > > > Hi all, > > > > I'd like to request views and opinions on the inclusion of a Lua > > library into > > pandoc: the LPeg library is a small parsing library written in C to be > > used with Lua. http://www.inf.puc-rio.br/~roberto/lpeg/ > > > > The motivation is that this library could be used to extend pandoc to > > deal with new formats. A good example is jgm's "lunamark", which could > > be modified to support custom syntax extensions that might otherwise > > be difficult to implement with current filters. > > > https://github.com/jgm/lunamark/blob/master/lunamark/reader/markdow > > n.lua > > > > On the other hand, this is yet another library and could be considered > bloat. > > Most users, esp. on Mac and Linux, should not find it too difficult to > > install the library on their system should they need it. > > > > The question is therefore if you think whether including lpeg into > > pandoc would make is worth it; e.g., do you believe you'd write such > > LPeg-based parsers? Would you share them with people who wouldn't > > immediately know how to install the library themselves? > > > > Thanks in advance, > > Albert > > > > > > PS: The corresponding pull request is > > https://github.com/jgm/pandoc/pull/7649 > > > > -- > > 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/87ee806loe.fsf%40zeitkraut.de. > > -- > 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/83dbc2c6dcbe49e49e00dac40b73eb65%40unibe.ch. -- 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/ec915ee445b6471fb1f252d98a727e3d%40unibe.ch. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <ec915ee445b6471fb1f252d98a727e3d-NSENcxR/0n0@public.gmane.org>]
* Re: AW: compiling lpeg into pandoc [not found] ` <ec915ee445b6471fb1f252d98a727e3d-NSENcxR/0n0@public.gmane.org> @ 2021-11-02 11:52 ` Albert Krewinkel [not found] ` <878ry67p0o.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: Albert Krewinkel @ 2021-11-02 11:52 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw denis.maier-NSENcxR/0n0@public.gmane.org writes: > Anyway, so if I install modules via luarocks they become usable in > filters? (That is, pandoc's lua will find those modules?) The locations in which Lua searches for libraries are controlled via the LUA_PATH and LUA_CPATH environment variables. There is a convenient `luarocks path` command which shows the necessary settings and can be used to set them: eval "$(luarocks path)" After that, the Lua interpreter in pandoc should be able to find all modules installed via luarocks. Just make sure that luarocks uses Lua 5.3, which is the version included in pandoc. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <878ry67p0o.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>]
* Re: AW: compiling lpeg into pandoc [not found] ` <878ry67p0o.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> @ 2021-11-02 12:38 ` BPJ 2021-11-02 13:28 ` AW: " denis.maier-NSENcxR/0n0 1 sibling, 0 replies; 10+ messages in thread From: BPJ @ 2021-11-02 12:38 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 2069 bytes --] Note that if you use the static binaries from the release page you can not use modules which use external (non-Lua) libraries. I have heard that if you download the first nightly from after each release that can use external libraries, but I'd rather not rely on that. Note also that the environment variables LUA_PATH_5_3 and LUA_CPATH_5_3 will override those without the version suffix. See https://web.archive.org/web/20210127030419/http://www.thijsschreijer.nl/blog/?p=1025 Den tis 2 nov. 2021 12:53Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> skrev: > > denis.maier-NSENcxR/0n0@public.gmane.org writes: > > > Anyway, so if I install modules via luarocks they become usable in > > filters? (That is, pandoc's lua will find those modules?) > > The locations in which Lua searches for libraries are controlled via the > LUA_PATH and LUA_CPATH environment variables. There is a convenient > `luarocks path` command which shows the necessary settings and can be > used to set them: > > eval "$(luarocks path)" > > After that, the Lua interpreter in pandoc should be able to find all > modules installed via luarocks. Just make sure that luarocks uses > Lua 5.3, which is the version included in pandoc. > > -- > 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/878ry67p0o.fsf%40zeitkraut.de > . > -- 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/CADAJKhC0WWR%2BwYpw%2BhFXTCS0BWeyeRLZ285HrQUtqARXq4auLw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 3347 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* AW: AW: compiling lpeg into pandoc [not found] ` <878ry67p0o.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-11-02 12:38 ` BPJ @ 2021-11-02 13:28 ` denis.maier-NSENcxR/0n0 [not found] ` <a4454aeb346b404ba248ee962bacd7cd-NSENcxR/0n0@public.gmane.org> 1 sibling, 1 reply; 10+ messages in thread From: denis.maier-NSENcxR/0n0 @ 2021-11-02 13:28 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw The installed lua version is already 5.4.x Ist that a problem? ________________________________________ Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im Auftrag von Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> Gesendet: Dienstag, 2. November 2021 12:52:55 An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Betreff: Re: AW: compiling lpeg into pandoc denis.maier-NSENcxR/0n0@public.gmane.org writes: > Anyway, so if I install modules via luarocks they become usable in > filters? (That is, pandoc's lua will find those modules?) The locations in which Lua searches for libraries are controlled via the LUA_PATH and LUA_CPATH environment variables. There is a convenient `luarocks path` command which shows the necessary settings and can be used to set them: eval "$(luarocks path)" After that, the Lua interpreter in pandoc should be able to find all modules installed via luarocks. Just make sure that luarocks uses Lua 5.3, which is the version included in pandoc. -- 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/878ry67p0o.fsf%40zeitkraut.de. ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <a4454aeb346b404ba248ee962bacd7cd-NSENcxR/0n0@public.gmane.org>]
* Re: AW: compiling lpeg into pandoc [not found] ` <a4454aeb346b404ba248ee962bacd7cd-NSENcxR/0n0@public.gmane.org> @ 2021-11-02 13:37 ` BPJ [not found] ` <CADAJKhD=XdoUF6cg06uNqdGRXW1tdOzidv82=m84n9gSHR-LjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 10+ messages in thread From: BPJ @ 2021-11-02 13:37 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 2798 bytes --] I believe the Lua version bundled with Pandoc is still 5.3 so that will be the one filters will use, and that may be a problem if some module uses 5.4 only features. IIIRC it is possible to have luarocks install different versions of packages in different locations. Google is your friend. Also for Linux look for luaver on GitHub. In a hurry, /bpj Den tis 2 nov. 2021 14:29 <denis.maier-NSENcxR/0n0@public.gmane.org> skrev: > The installed lua version is already 5.4.x Ist that a problem? > ________________________________________ > Von: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im > Auftrag von Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> > Gesendet: Dienstag, 2. November 2021 12:52:55 > An: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > Betreff: Re: AW: compiling lpeg into pandoc > > denis.maier-NSENcxR/0n0@public.gmane.org writes: > > > Anyway, so if I install modules via luarocks they become usable in > > filters? (That is, pandoc's lua will find those modules?) > > The locations in which Lua searches for libraries are controlled via the > LUA_PATH and LUA_CPATH environment variables. There is a convenient > `luarocks path` command which shows the necessary settings and can be > used to set them: > > eval "$(luarocks path)" > > After that, the Lua interpreter in pandoc should be able to find all > modules installed via luarocks. Just make sure that luarocks uses > Lua 5.3, which is the version included in pandoc. > > -- > 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/878ry67p0o.fsf%40zeitkraut.de > . > > -- > 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/a4454aeb346b404ba248ee962bacd7cd%40unibe.ch > . > -- 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/CADAJKhD%3DXdoUF6cg06uNqdGRXW1tdOzidv82%3Dm84n9gSHR-LjA%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 4610 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <CADAJKhD=XdoUF6cg06uNqdGRXW1tdOzidv82=m84n9gSHR-LjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: AW: compiling lpeg into pandoc [not found] ` <CADAJKhD=XdoUF6cg06uNqdGRXW1tdOzidv82=m84n9gSHR-LjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2021-11-03 9:41 ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 0 siblings, 0 replies; 10+ messages in thread From: krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org @ 2021-11-03 9:41 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 3221 bytes --] Eventhough I am using mostly Linux, on some occasions I am on Windows and even on Linux it might be more convenient (from purely user perspective) to have LPeg included in pandoc because of different Lua versions, so I am 100 % for such addition. Regards Tomas Dne úterý 2. listopadu 2021 v 14:37:55 UTC+1 uživatel BP napsal: > I believe the Lua version bundled with Pandoc is still 5.3 so that will be > the one filters will use, and that may be a problem if some module uses 5.4 > only features. IIIRC it is possible to have luarocks install different > versions of packages in different locations. Google is your friend. Also > for Linux look for luaver on GitHub. > > In a hurry, > > /bpj > > Den tis 2 nov. 2021 14:29 <denis...-NSENcxR/0n0@public.gmane.org> skrev: > >> The installed lua version is already 5.4.x Ist that a problem? >> ________________________________________ >> Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> im >> Auftrag von Albert Krewinkel <albert...-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> >> Gesendet: Dienstag, 2. November 2021 12:52:55 >> An: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org >> Betreff: Re: AW: compiling lpeg into pandoc >> >> denis...-NSENcxR/0n0@public.gmane.org writes: >> >> > Anyway, so if I install modules via luarocks they become usable in >> > filters? (That is, pandoc's lua will find those modules?) >> >> The locations in which Lua searches for libraries are controlled via the >> LUA_PATH and LUA_CPATH environment variables. There is a convenient >> `luarocks path` command which shows the necessary settings and can be >> used to set them: >> >> eval "$(luarocks path)" >> >> After that, the Lua interpreter in pandoc should be able to find all >> modules installed via luarocks. Just make sure that luarocks uses >> Lua 5.3, which is the version included in pandoc. >> >> -- >> 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/878ry67p0o.fsf%40zeitkraut.de >> . >> >> -- >> 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/a4454aeb346b404ba248ee962bacd7cd%40unibe.ch >> . >> > -- 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/fb0b07de-cd47-4178-ae19-0585a030cdcfn%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 5356 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFC: compiling lpeg into pandoc [not found] ` <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-11-01 22:06 ` AW: " denis.maier-NSENcxR/0n0 @ 2021-11-01 23:14 ` BPJ 2021-11-08 15:38 ` Albert Krewinkel 2 siblings, 0 replies; 10+ messages in thread From: BPJ @ 2021-11-01 23:14 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 4397 bytes --] I would like it, especially if it could be used from inside Lua filters. One could then embed snippets of a DSL in code blocks/spans with some identifying attribute or raw blocks/spans with an identifying pseudo-format or inside attribute values, parse the DSL inside the Lua filter and take different paths based on the result. For example my string interpolation DSL which I currently use a very slow and very verbose parser written in pure Lua (well actually MoonScript :-) where everything is enclosed in various brackets because balanced brackets are easy to match in Lua patterns with the `%b()` construct. Since Lua patterns don't support alternations or quantified groups I have to simulate alternations with huge arrays of maps which specify patterns to try in succession, along with the labels for the captures. An example of an alternative in the table with possible interpolation forms: ``````moon [40]: { labels: { [1]: "path" [2]: "truth" [3]: "then_expr" [4]: "else_expr" } name: "path_if_non_empty_then_else" pat: "^%$%(%s*(%b<>)%s*(%&)%?%s*(%$?%b())%s*%&%!%s*(%$?%b())%s*%)$" strip: { else_expr: "()" path: "<>" then_expr: "()" } } `````` This matches something which when embedded in Markdown looks something like this: ``````markdown `$( <var/foo> &? $(<var/bar>) &! $(<var/baz>) )`{.sic} `````` where `<var/foo>` etc. each references a value in a mapping of `key: string` pairs obtained from the metadata, and the whole inserts the value of one of two such variables into the document depending on whether a third variable is non-empty or not (basically a ternary). The table with such alternatives is built programmatically in nested loops over lists of subpatterns, so being able to use lpeg (probably even the re module[^1] since I have already written a Perl implementation in Pegex[^2]) would both speed things up and reduce the volume of the code, so it would be most welcome! [^1]: http://www.inf.puc-rio.br/~roberto/lpeg/re.html [^2]: https://metacpan.org/dist/Pegex/view/lib/Pegex/Syntax.pod Den mån 1 nov. 2021 14:39Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> skrev: > Hi all, > > I'd like to request views and opinions on the inclusion of a Lua library > into pandoc: the LPeg library is a small parsing library written in C to > be used with Lua. http://www.inf.puc-rio.br/~roberto/lpeg/ > > The motivation is that this library could be used to extend pandoc to > deal with new formats. A good example is jgm's "lunamark", which could > be modified to support custom syntax extensions that might otherwise be > difficult to implement with current filters. > https://github.com/jgm/lunamark/blob/master/lunamark/reader/markdown.lua > > On the other hand, this is yet another library and could be considered > bloat. Most users, esp. on Mac and Linux, should not find it too > difficult to install the library on their system should they need it. > > The question is therefore if you think whether including lpeg into > pandoc would make is worth it; e.g., do you believe you'd write such > LPeg-based parsers? Would you share them with people who wouldn't > immediately know how to install the library themselves? > > Thanks in advance, > Albert > > > PS: The corresponding pull request is > https://github.com/jgm/pandoc/pull/7649 > > -- > 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/87ee806loe.fsf%40zeitkraut.de > . > -- 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/CADAJKhC%2BEgzr_LAD1BHNYv_ne0Lv3NLXUu1Pftrg9H1pHwXK8w%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 6803 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: RFC: compiling lpeg into pandoc [not found] ` <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-11-01 22:06 ` AW: " denis.maier-NSENcxR/0n0 2021-11-01 23:14 ` RFC: " BPJ @ 2021-11-08 15:38 ` Albert Krewinkel 2 siblings, 0 replies; 10+ messages in thread From: Albert Krewinkel @ 2021-11-08 15:38 UTC (permalink / raw) To: pandoc-discuss Thank you all for the answers! It seemed that there were many proponents and few arguments against including lpeg, so the decision was made to ship lpeg (and re) with future pandoc versions. Cheers, Albert Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> writes: > Hi all, > > I'd like to request views and opinions on the inclusion of a Lua library > into pandoc: the LPeg library is a small parsing library written in C to > be used with Lua. http://www.inf.puc-rio.br/~roberto/lpeg/ > > The motivation is that this library could be used to extend pandoc to > deal with new formats. A good example is jgm's "lunamark", which could > be modified to support custom syntax extensions that might otherwise be > difficult to implement with current filters. > https://github.com/jgm/lunamark/blob/master/lunamark/reader/markdown.lua > > On the other hand, this is yet another library and could be considered > bloat. Most users, esp. on Mac and Linux, should not find it too > difficult to install the library on their system should they need it. > > The question is therefore if you think whether including lpeg into > pandoc would make is worth it; e.g., do you believe you'd write such > LPeg-based parsers? Would you share them with people who wouldn't > immediately know how to install the library themselves? > > Thanks in advance, > Albert > > > PS: The corresponding pull request is > https://github.com/jgm/pandoc/pull/7649 -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-11-08 15:38 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-11-01 13:38 RFC: compiling lpeg into pandoc Albert Krewinkel [not found] ` <87ee806loe.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-11-01 22:06 ` AW: " denis.maier-NSENcxR/0n0 [not found] ` <83dbc2c6dcbe49e49e00dac40b73eb65-NSENcxR/0n0@public.gmane.org> 2021-11-02 11:44 ` denis.maier-NSENcxR/0n0 [not found] ` <ec915ee445b6471fb1f252d98a727e3d-NSENcxR/0n0@public.gmane.org> 2021-11-02 11:52 ` Albert Krewinkel [not found] ` <878ry67p0o.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> 2021-11-02 12:38 ` BPJ 2021-11-02 13:28 ` AW: " denis.maier-NSENcxR/0n0 [not found] ` <a4454aeb346b404ba248ee962bacd7cd-NSENcxR/0n0@public.gmane.org> 2021-11-02 13:37 ` BPJ [not found] ` <CADAJKhD=XdoUF6cg06uNqdGRXW1tdOzidv82=m84n9gSHR-LjA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2021-11-03 9:41 ` krulis....-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org 2021-11-01 23:14 ` RFC: " BPJ 2021-11-08 15:38 ` Albert Krewinkel
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).