public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Adding a reader for Cooklang and a question about Megaparsec
@ 2023-01-16  3:07 Isaac Van Doren
       [not found] ` <08647ee9-9616-482c-bae8-2657d16df33fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Isaac Van Doren @ 2023-01-16  3:07 UTC (permalink / raw)
  To: pandoc-discuss


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

Hello,

*About Cooklang:*
I am interested in adding a reader to Pandoc for the Cook 
<https://cooklang.org> markdown language. Cooklang is a concise, 
standardized way to format recipes. You write down the instructions for a 
recipe and whenever you mention a new ingredient or piece of cookware you 
annotate it and can specify the quantity and more. Then that document can 
be rendered by a variety of tools (e.g. a vscode extension 
<https://marketplace.visualstudio.com/items?itemName=isaacvando.cookrender> 
I wrote) into a consistent format. This language seems like a natural 
addition to Pandoc and one that the Cooklang community would benefit from 
greatly. 

I've written a parser <https://github.com/isaacvando/cooklang-hs> for Cook 
in Haskell which would be a good start. It complies with the official 
Cooklang canonical tests. 

*Questions:*
Currently my parser uses Megaparsec. Do I need to refactor it to use Parsec 
instead or is it okay to add Megaparsec as a dependency?

Currently my parser uses String instead of Text. Is it necessary for the 
parser to use Text to be used by Pandoc or could I get away with the reader 
converting its Text input to String when parsing?

Is there anything else I should know before I start working on a PR? Does 
this seem like a suitable addition to Pandoc?

Thanks!
Isaac Van Doren

-- 
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/08647ee9-9616-482c-bae8-2657d16df33fn%40googlegroups.com.

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

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

* Re: Adding a reader for Cooklang and a question about Megaparsec
       [not found] ` <08647ee9-9616-482c-bae8-2657d16df33fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2023-01-18 23:26   ` Albert Krewinkel
       [not found]     ` <87lelzmn0l.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Albert Krewinkel @ 2023-01-18 23:26 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw; +Cc: Isaac Van Doren

Hi Isaac,

Thanks for reaching out!

Isaac Van Doren <ivando5522-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> About Cooklang:
> I am interested in adding a reader to Pandoc for the Cook markdown
> language. Cooklang is a concise, standardized way to format recipes.

Very interesting! I took a look at Cooklang, it has an appealing
tool-chain.

> I've written a parser for Cook in Haskell which would be a good
> start. It complies with the official Cooklang canonical tests. 
>
> Questions:
> Currently my parser uses Megaparsec. Do I need to refactor it to use
> Parsec instead or is it okay to add Megaparsec as a dependency?

I believe that pandoc might switch to megaparsec at some point in the
future. But I'm afraid that as of now, the parser library should be
plain ol' parsec.

> Currently my parser uses String instead of Text. Is it necessary for
> the parser to use Text to be used by Pandoc or could I get away with
> the reader converting its Text input to String when parsing?

That's probably ok (and not too difficult to change/fix later on).

> Is there anything else I should know before I start working on a PR?
> Does this seem like a suitable addition to Pandoc?

I think it would be great to have this, but jgm will have to decide.

If you don't want to wait and also like to play with new tools, then one
way to get fast results would be to write a parser with the LPeg Lua
library. Pandoc comes with a LPeg and a Lua interpreter included, and
those can be used to write custom parsers. We've improved support for
this in pandoc 3, see <https://pandoc.org/custom-readers>.

Cheers,
Albert

-- 
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/87lelzmn0l.fsf%40zeitkraut.de.


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

* Re: Adding a reader for Cooklang and a question about Megaparsec
       [not found]     ` <87lelzmn0l.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
@ 2023-01-19 10:19       ` BPJ
  2023-01-19 16:44       ` John MacFarlane
  1 sibling, 0 replies; 5+ messages in thread
From: BPJ @ 2023-01-19 10:19 UTC (permalink / raw)
  To: pandoc-discuss; +Cc: Isaac Van Doren

[-- Attachment #1: Type: text/plain, Size: 2890 bytes --]

Den tors 19 jan. 2023 10:47Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
skrev:

> Hi Isaac,
>
> Thanks for reaching out!
>
> Isaac Van Doren <ivando5522-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > About Cooklang:
> > I am interested in adding a reader to Pandoc for the Cook markdown
> > language. Cooklang is a concise, standardized way to format recipes.
>
> Very interesting! I took a look at Cooklang, it has an appealing
> tool-chain.
>
> > I've written a parser for Cook in Haskell which would be a good
> > start. It complies with the official Cooklang canonical tests.
> >
> > Questions:
> > Currently my parser uses Megaparsec. Do I need to refactor it to use
> > Parsec instead or is it okay to add Megaparsec as a dependency?
>
> I believe that pandoc might switch to megaparsec at some point in the
> future. But I'm afraid that as of now, the parser library should be
> plain ol' parsec.
>
> > Currently my parser uses String instead of Text. Is it necessary for
> > the parser to use Text to be used by Pandoc or could I get away with
> > the reader converting its Text input to String when parsing?
>
> That's probably ok (and not too difficult to change/fix later on).
>
> > Is there anything else I should know before I start working on a PR?
> > Does this seem like a suitable addition to Pandoc?
>
> I think it would be great to have this, but jgm will have to decide.
>
> If you don't want to wait and also like to play with new tools, then one
> way to get fast results would be to write a parser with the LPeg Lua
> library. Pandoc comes with a LPeg and a Lua interpreter included,


For quick stuff the lpeg.re library may be easier than Lpeg proper. It
supports grammars and is also included with pandoc.

http://www.inf.puc-rio.br/~roberto/lpeg/re.html

and
> those can be used to write custom parsers. We've improved support for
> this in pandoc 3, see <https://pandoc.org/custom-readers>.
>
> Cheers,
> Albert
>
> --
> 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/87lelzmn0l.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/CADAJKhDv%2BS4he3Kr4sh4tUrw4CCmL6r1PJhLyUWazfx1-%3D0kJQ%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4562 bytes --]

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

* Re: Adding a reader for Cooklang and a question about Megaparsec
       [not found]     ` <87lelzmn0l.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
  2023-01-19 10:19       ` BPJ
@ 2023-01-19 16:44       ` John MacFarlane
       [not found]         ` <CC6D5774-540D-4B62-B087-AD01C40CC502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  1 sibling, 1 reply; 5+ messages in thread
From: John MacFarlane @ 2023-01-19 16:44 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

I think that cooklang may be a bit too specialized to add as a regular reader.  We try to cover commonly used formats that are general purpose.

However, this is a perfect use case for a custom reader, as Albert suggests.

There is some helpful documentation on the website, including examples:

https://pandoc.org/custom-readers.html


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

* Re: Adding a reader for Cooklang and a question about Megaparsec
       [not found]         ` <CC6D5774-540D-4B62-B087-AD01C40CC502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2023-01-19 16:50           ` Isaac Van Doren
  0 siblings, 0 replies; 5+ messages in thread
From: Isaac Van Doren @ 2023-01-19 16:50 UTC (permalink / raw)
  To: pandoc-discuss


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

Alright, thanks!

On Thursday, January 19, 2023 at 10:44:25 AM UTC-6 fiddlosopher wrote:

> I think that cooklang may be a bit too specialized to add as a regular 
> reader. We try to cover commonly used formats that are general purpose.
>
> However, this is a perfect use case for a custom reader, as Albert 
> suggests.
>
> There is some helpful documentation on the website, including examples:
>
> https://pandoc.org/custom-readers.html
>
>

-- 
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/fec9d677-eb00-4da1-9199-2b480c67f1e4n%40googlegroups.com.

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

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

end of thread, other threads:[~2023-01-19 16:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16  3:07 Adding a reader for Cooklang and a question about Megaparsec Isaac Van Doren
     [not found] ` <08647ee9-9616-482c-bae8-2657d16df33fn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2023-01-18 23:26   ` Albert Krewinkel
     [not found]     ` <87lelzmn0l.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2023-01-19 10:19       ` BPJ
2023-01-19 16:44       ` John MacFarlane
     [not found]         ` <CC6D5774-540D-4B62-B087-AD01C40CC502-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2023-01-19 16:50           ` Isaac Van Doren

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).