Hi Bastien,

Thanks, that's a bit more like what I'm looking for.

However, when I try to compile in Powershell using `pandoc -L build.lua` I get no output and the command prompt just kind of hangs there until I press Ctrl+C.

Pretty sure I'm doing something wrong but I'm not sure what....

Regards,

Amine

On Thu, 16 Jun 2022 at 17:34, Bastien DUMONT <bastien.dumont-VwIFZPTo/vqsTnJN9+BGXg@public.gmane.org> wrote:
I don't think that you can do this directly from a Lua interpreter. This is how I would build a document programmatically:

```build.lua
function Pandoc(_)
  return pandoc.Pandoc(
    pandoc.Para({
        pandoc.Str('Hello'),
        pandoc.Space(),
        pandoc.Emph(pandoc.Str('World')),
        pandoc.Str('!')
    })
  )
end
```

pandoc -L build.lua <<< '' outputs `<p>Hello <em>World</em>!</p>`.


Le Thursday 16 June 2022 à 05:28:29PM, A A a écrit :
> Hi Bastien,
>
> I'm afraid that doesn't really show me how I can build a document from scratch
> similar to what is done in Haskell using a `Builder`.
>
> I really would like to avoid learning Haskell and stick to the Lua API. But I'm
> getting the impression that use of the Lua API requires understanding of how
> the underlying Haskell objects interact.
>
> Regards,
>
> Amine
>
> On Thu, 16 Jun 2022 at 17:20, A A <[1]amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>     I guess a better way to phrase my question is the following:
>
>     Is there a way to generate a document from scratch and programmatically
>     using Lua and without using Haskell?
>
>     There is mention [2]here of a pandoc Builder class but I don’t see its Lua
>     equivalent [3]here.
>
>
>
>     ---------- Forwarded message ---------
>     From: A A <[4]amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>     Date: Thu, 16 Jun 2022 at 16:51
>     Subject: Experimenting with pandoc module using just Lua
>     To: <[5]pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
>
>
>
>     Dear All,
>
>     Is there a way to experiment with the objects pandoc module using Lua
>     without having to write a filter/writer and go through the pandoc CLI? I
>     would really like to just experiment with generating documents and getting
>     familiar with the Lua API using just a Lua interpreter.
>
>     Regards,
>
>     Amine
>
> --
> 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 [6]pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit [7]https://groups.google.com/d/msgid/
> pandoc-discuss/
> CAMwawgOHE5QEeHJbO%2BNF8QvViKas3P6Q6G7F%3DdS4YecTda1z1w%40mail.gmail.com.
>
> References:
>
> [1] mailto:amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> [2] https://pandoc.org/using-the-pandoc-api.html#builder
> [3] https://pandoc.org/lua-filters.html#module-pandoc
> [4] mailto:amine.aboufirass-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
> [5] mailto:pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [6] mailto:pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> [7] https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgOHE5QEeHJbO%2BNF8QvViKas3P6Q6G7F%3DdS4YecTda1z1w%40mail.gmail.com?utm_medium=email&utm_source=footer

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/YqtNZpy71u2Ud39K%40localhost.

--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAMwawgMt32uLCRXDqwxpudMF92sBQVg_f2cNXvzV0T3rsyy5xA%40mail.gmail.com.