From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30652 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Felix SOEDJEDE Newsgroups: gmane.text.pandoc Subject: Re: Pandoc 2.18 - Custom writer working example Date: Thu, 2 Jun 2022 01:10:55 -0700 (PDT) Message-ID: References: <8528d41a-d6dd-4ca7-b38a-13955a9d1eabn@googlegroups.com> <87fskn6345.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_388_562250286.1654157455617" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2744"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC4JXJU7UYGRBEXB4GKAMGQEB3SYK6Q-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 02 10:11:02 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-ot1-f64.google.com ([209.85.210.64]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nwfv3-0000WN-8Y for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Jun 2022 10:11:01 +0200 Original-Received: by mail-ot1-f64.google.com with SMTP id i1-20020a056830402100b0060aedabf08dsf1188388ots.14 for ; Thu, 02 Jun 2022 01:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=SJ9se0DkV70GWqHm0TanHLjNW4ua/NQOyZfxRMb1O+0=; b=HQkmghWV2IpubrduLJ99mFHLrT7OMuVarYMA6pHHNJ6e0NbLsetnVpCE/jOg0evdwx v8hPBjwI/35Q9giPh29rBUvsHtbYsbC1p5s5KZXbkHl8c4cVwPdkLha4J4wsv0pCJFXu UbH6j/0zzXWb9aQ1M7U72NgMIEyu500cNYsX2SiTE9appPtcRCCLAkPqkl/wXljJfElr 1rjT6YYiG0eqi89hML+ATXNGOWLN6EKQU9R4UxweMQfaAwnxxSQMlthlgvQpNmRxQPru mscGMjsIv1RWb9ofLvXwRczUNaMHhZFfuY1mqNkwMA7ikhY5srwlfl1wGWThR1IXHtcu CR1w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=SJ9se0DkV70GWqHm0TanHLjNW4ua/NQOyZfxRMb1O+0=; b=iZ16X82Lx05Q7Q0mVx2SuFj5Xg/JuH7eIu1eiJoLIXWEnnQq0yeT+0+JfiFUpJXfZS SAAKVnTHT6NsdqHj5UB99rW4uFl6fHI+38Si6iAMUXsFFfClzu29aZIGXHXBbTldvxAd cRnSN9WtRQpAn5RKr0AxAid+yUnlnrHb52mxhALkVZ3nEMky5FAuaEbczicGJTNkLbMY tQ8Bk6zeJmESwU/b9jrcD5UaScOLv4SLXjN3CaNjw/JX0aFAOd91NdXFb1zpA0UVAx7l Xk3oLhpUNoN0VQ7JfYSeEOOr6zGRlwWxqD/+bAcuWNm5P1Fq7UfI7Mqy49qlrc0fHMtN lSaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=SJ9se0DkV70GWqHm0TanHLjNW4ua/NQOyZfxRMb1O+0=; b=pUzQ9eRddZku5RJvx6JHjE+wnZauB3gM89f/Y+AdcffnGbiw1Ch8RHNXKvmAGHdUcP /6LqoS+KwjydosraECMpoOZPHeHqa5KOszdgaRFhnZE18SqIaEIo5KOnGNzu79h7kVYU s6oBVm2DpOre18XTruYstWc5iriU/YLtzAo6lSRki9BTK+3D7UCE4VyoYwyw7/gvFT2c Q+R31tteQWecdwb+0FmSyIjog3HBVeRxmJkoWGCO0vqYMAwj1zSoW/d9e1FLeYlNsm6S eO2Hm3EzjL1vS5Q/Qh/9rjBr+1Qb/fyO9+pHUwmGSJfkcZc9U0U3y0izLMwxhlkbIJmS Bs2A== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM532kM4O6DUF85Vbs5nezkEQL62VTXTL7Y9XPscOhs2EOgNduZmdq Jqk9+miDeKw8HfimiBl/XcM= X-Google-Smtp-Source: ABdhPJwbpAapxSpLrY1xmyTvC5ULBKmCg3jpdAgpHF6bU3po5MAkkDP/SMK5uY8gQ6RRMbz5GYRtYA== X-Received: by 2002:a05:6870:2042:b0:f2:a4c1:b696 with SMTP id l2-20020a056870204200b000f2a4c1b696mr1993197oad.15.1654157460108; Thu, 02 Jun 2022 01:11:00 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6808:16a9:b0:32e:4091:d608 with SMTP id bb41-20020a05680816a900b0032e4091d608ls138835oib.4.gmail; Thu, 02 Jun 2022 01:10:56 -0700 (PDT) X-Received: by 2002:a05:6808:f88:b0:32b:bebb:c9e9 with SMTP id o8-20020a0568080f8800b0032bbebbc9e9mr1868542oiw.206.1654157456260; Thu, 02 Jun 2022 01:10:56 -0700 (PDT) In-Reply-To: <87fskn6345.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org> X-Original-Sender: soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30652 Archived-At: ------=_Part_388_562250286.1654157455617 Content-Type: multipart/alternative; boundary="----=_Part_389_1787459046.1654157455617" ------=_Part_389_1787459046.1654157455617 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable @Albert 1/ Writer Using *--to=3Dsample.lua* works when *--standalone* is not present and . Otherwise I have this error: *Could not find data file=20 templates/default.sample.lua* Using *--writer=3Dsample.lua* does not work.=20 Error: "Unknown option --writer." I now know why using "--to" did not work. 2/ Accessing variables in lua filter I would like to have access to "variables" in lua filter. Currently I have access to "metadata" when I use "*function Pandoc(doc) ...= =20 end*" In the doc: https://pandoc.org/custom-writers.html#a-custom-html-writer, I= =20 saw this "*function Doc(body, meta, vars) ... end*" but it's never called= =20 in my tests. I prefer not to use "*function Writer*" for now if possible. Do you have any tips or working examples for that one? Thanks Le jeudi 2 juin 2022 =C3=A0 07:33:54 UTC+2, Albert Krewinkel a =C3=A9crit : > > Felix SOEDJEDE writes: > > > In Pandoc 2.18, custom writers were added: > > https://pandoc.org/custom-writers.html#new-style > > > > I tried to use it but it's not working and I don't know if it's an > > error or I'm using it the wrong way. > > > > [...] > > > > Command used "pandoc --standalone --verbose --lua-filter=3Dsample.lua > > --output=3Doutput.md sample.md" > > Pandoc expects the custom writer to be given as the argument of > `-t`/`--to`/`-w`/`--write`. > > pandoc --standalone --verbose --to=3Dsample.lua ... > > > Does anyone have a minimal working example for "Doc" or "Writer" I > > could use? > > Here's a custom Markdown writer. It's an experiment designed to show how > a new writer might be structured. It's a bit slow though. > https://gist.github.com/tarleb/5a9c3fbfa47b0e6d3643efd8af2994b9 > > > --=20 > Albert Krewinkel > GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 > --=20 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 e= mail 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/cde6d369-8813-41ed-a1ea-253901014b46n%40googlegroups.com. ------=_Part_389_1787459046.1654157455617 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
@Albert

1/ Writer
=
Using --to=3Dsample.lua works when --standalone i= s not present and .
Otherwise I have this error: <= i>Could not find data file templates/default.sample.lua
<= br>
Using --writer=3Dsample.lua does not work.
= Error: "Unknown option --writer."

I now know why u= sing "--to" did not work.

2/ Accessing v= ariables in lua filter
I would like to have access to = "variables" in lua filter.
Currently I have access to "metadata" = when I use "function Pandoc(doc) ... end"
In the doc: http= s://pandoc.org/custom-writers.html#a-custom-html-writer, I saw this "fun= ction Doc(body, meta, vars) ... end" but it's never called in my tests.=
I prefer not to use "function Writer" for now if possible= .
Do you have any tips or working examples for that one?

Thanks

Le jeudi 2 juin 2022 =C3=A0 07:33:54 UTC+2, = Albert Krewinkel a =C3=A9crit=C2=A0:

Felix SOEDJEDE <soef...@g= mail.com> writes:

> In Pandoc 2.18, custom writers were added:
> https://pandoc.org/custom-writers.html#new-style
>
> I tried to use it but it's not working and I don't know if= it's an
> error or I'm using it the wrong way.
>
> [...]
>
> Command used "pandoc --standalone --verbose --lua-filter=3Dsa= mple.lua
> --output=3Doutput.md sample.md"

Pandoc expects the custom writer to be given as the argument of
`-t`/`--to`/`-w`/`--write`.

pandoc --standalone --verbose --to=3Dsample.lua ...

> Does anyone have a minimal working example for "Doc" or = "Writer" I
> could use?

Here's a custom Markdown writer. It's an experiment designed to= show how
a new writer might be structured. It's a bit slow though.
https://gist.github.com/tarleb/5a9c3fbfa47= b0e6d3643efd8af2994b9


--=20
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 &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/cde6d369-8813-41ed-a1ea-253901014b46n%40googlegroups.= com.
------=_Part_389_1787459046.1654157455617-- ------=_Part_388_562250286.1654157455617--