From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30668 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 07:40:37 -0700 (PDT) Message-ID: <56920de7-922c-4491-86ee-c981beb37b78n@googlegroups.com> References: <8528d41a-d6dd-4ca7-b38a-13955a9d1eabn@googlegroups.com> <87fskn6345.fsf@zeitkraut.de> <87bkvb5tay.fsf@zeitkraut.de> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1246_48217453.1654180837033" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40531"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBC4JXJU7UYGRBZUX4OKAMGQE567AFAQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 02 16:40:41 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-oo1-f57.google.com ([209.85.161.57]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nwm09-000AP3-B3 for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 02 Jun 2022 16:40:41 +0200 Original-Received: by mail-oo1-f57.google.com with SMTP id z81-20020a4a4954000000b0040eafb31c81sf2517096ooa.18 for ; Thu, 02 Jun 2022 07:40:41 -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=cJV4sfPzykbfZrBBZqsn3smK1TkBDgmLQ1grZ34Nlxw=; b=F3e9JdlVzNBxsssCm3sDdh3LR+iyioOVeGVFmTLrLzjA6ldi+56MCjj3v4GAkfAmtz 5b2o9pPTpu9DqZCwESF+V+tJKZGm1sSFWPtGVCMMxhS5Zukyq/kdeE3ZcQYNxpGQ9c/m pVbW0Uyl8M2ZgcUvCxTIyF8cBRI0VwSkwigbnA3XjiB7wnOX7foVb6iKvicpVTqF8hVB M5lXueLuDQxt9/32SPWfb0zc2jD4AVszTN+VvRq3fvTuWD/mqLG6SH3oXdY5F6AWeyPz CqnYHzQ/w2ZJMpl4ZgHG9tS0ORIMeXX6g/YO6OWPdnschakRF7PpPch1vNw+eewLqMk5 wSPw== 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=cJV4sfPzykbfZrBBZqsn3smK1TkBDgmLQ1grZ34Nlxw=; b=n8D8WMd79kBzrSYLUXypomP8JoeXDzZ8TIj3QEbz/qt8iCrk0bhAYQCVRQPH5T3iix 2JpAAondaMxa5wc+5A0UTkbxEQKbMauGLow3tanxsCoYeF4zySal4Kf1IZVibicF6eBz AiYKVpsmi8/5jEOu4qzBE4KVTK2RyvlcvJhISti8bSUNxaZPqx+e5kQ5JUeO0BV4YUY2 PQstMUzuidcaCznO2lSOR02S7r+ZjM9qaHQ61Nh5Lf/KejzqOZ8CwO2izK3tpvMIpEhd yA+f3t80DHYLQFK1QZnXH0avCh8sbbuo63ygqIZNkRtRx7kDtH/MT3bczfZequF+l126 jp3g== 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=cJV4sfPzykbfZrBBZqsn3smK1TkBDgmLQ1grZ34Nlxw=; b=C6pi3Om75tKT97P9IfJPA7Ov/3Lt8cSeX7ZQhiQzr9B6Ti2vq7C6bYnPRb0VtgS1re Q6yT2Zw+VemDawButwkwCQ69HMdPIcLelSO7h2aEUuUEkm7tUqGhmMqYlA1k1GpeQ/Pa 9kJ9t8uuixRIcCF8ALffVUualicprI0nola0lZBGqF5jdnhzJwNc6MKyJdUwhamAYFV2 C9pt+qeKJVVwWnVdCnBqHklKKPpZxlCcp56+ZhZeIF8x8TzN55i3LJe5XjFhM/ZHtGS/ yspLA8NPbmoOfCNTF2CtPZONobLRzo8M/wwqG0gzqKYvKAzdDE11A9rWymetGdoPDsTa YF4Q== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AOAM531e2bwc06uTLlIs36k4snurt0bS7BhoVsnD0jd7ImiYKTMoxTBK TOOmgkqhWAOhC/KPTOIDg6c= X-Google-Smtp-Source: ABdhPJwDaX8K/sxESSl3ezQDfmAm1v75KCZfs1avJam4frQUPwivYwEOHES09n8iKmRzbP7n31pH/w== X-Received: by 2002:a05:6830:905:b0:60b:1d8f:e6dd with SMTP id v5-20020a056830090500b0060b1d8fe6ddmr2107230ott.221.1654180840293; Thu, 02 Jun 2022 07:40:40 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a05:6870:6005:b0:e6:15d1:1154 with SMTP id t5-20020a056870600500b000e615d11154ls2791347oaa.11.gmail; Thu, 02 Jun 2022 07:40:38 -0700 (PDT) X-Received: by 2002:a05:6871:7a1:b0:ee:4c48:bfff with SMTP id o33-20020a05687107a100b000ee4c48bfffmr2986329oap.118.1654180837721; Thu, 02 Jun 2022 07:40:37 -0700 (PDT) In-Reply-To: <87bkvb5tay.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:30668 Archived-At: ------=_Part_1246_48217453.1654180837033 Content-Type: multipart/alternative; boundary="----=_Part_1247_796700052.1654180837033" ------=_Part_1247_796700052.1654180837033 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Albert, > If you use `function Writer(doc, opts)`, then the variables are available= =20 via `opts.variables`.=20 I will see if I can use it > Do you mean an example of a classic custom writers? Pandoc has an example= =20 built-in, it's available via=20 > pandoc --print-default-data-file=3Dsample.lua=20 In the output of this command, I have "function Doc(body, metadata,=20 variables) ..." but I've not found how to use it. My real need is that I want to be able to access variables in my lua=20 filters. > Out of curiosity, what output format are planning to generate?=20 Nothing extra. It's just markdown but with some formatting on header,=20 images, etc. The markdown is used to keep documents contents in a readable while also=20 keeping the styles which are relevant. The markdown can then be converted to pdf (via Lualatex), epub, and maybe= =20 any other format in the future. Thanks for your replies. I will take a step back and come back to it after= =20 few days. Le jeudi 2 juin 2022 =C3=A0 11:05:50 UTC+2, Albert Krewinkel a =C3=A9crit : > Hi Felix, > > Felix SOEDJEDE writes: > > > 1/ Writer > > Using --to=3Dsample.lua works when --standalone is not present and . > > Otherwise I have this error: Could not find data file > > templates/default.sample.lua > > Ah, right. With `--standalone` pandoc is looking for a template that > matches the writer name. There isn't one of course. Just omit it. > > > Using --writer=3Dsample.lua does not work. > > Error: "Unknown option --writer." > > Whoops, should have been `--write`. I'm cutting down on coffee, I guess > it shows. =F0=9F=98=AC > > > 2/ Accessing variables in lua filter > > I would like to have access to "variables" in lua filter. > > If you use `function Writer(doc, opts)`, then the variables are > available via `opts.variables`. > > > I prefer not to use "function Writer" for now if possible. > > Do you have any tips or working examples for that one? > > Do you mean an example of a classic custom writers? Pandoc has an > example built-in, it's available via > > pandoc --print-default-data-file=3Dsample.lua > > Classic writers are generally a bit easier (IMHO). I'd recommend new- > style writers if you either base the new writer on one that's already > included in pandoc, or if you want to make use of the `pandoc.layout` > module to get nicer looking output. Other than those cases, classic > writers are frequently the better choice. > > Out of curiosity, what output format are planning to generate? > > Cheers, > Albert > > --=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/56920de7-922c-4491-86ee-c981beb37b78n%40googlegroups.com. ------=_Part_1247_796700052.1654180837033 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Albert,

> If you use `function Writ= er(doc, opts)`, then the variables are available via `opts.variables`.
I will see if I can use it

> Do = you mean an example of a classic custom writers? Pandoc has an example built-in, it's available via
> pandoc --print-default-data-file=3Dsample.lua
In the output of this command, I have "function Doc(= body, metadata, variables) ..." but I've not found how to use= it.
My real need is that I want to be able to access variables i= n my lua filters.

> Out of curiosity, what outp= ut format are planning to generate?
Nothing extra. It's just= markdown but with some formatting on header, images, etc.
The ma= rkdown is used to keep documents contents in a readable while also keeping = the styles which are relevant.
The markdown can then be converted= to pdf (via Lualatex), epub, and maybe any other format in the future.

Thanks for your replies. I will tak= e a step back and come back to it after few days.
<= /div>



Le jeudi 2 juin 2022 =C3=A0 11:05:= 50 UTC+2, Albert Krewinkel a =C3=A9crit=C2=A0:
Hi Felix,

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

> 1/ Writer
> Using --to=3Dsample.lua works when --standalone is not present and= .
> Otherwise I have this error: Could not find data file
> templates/default.sample.lua

Ah, right. With `--standalone` pandoc is looking for a template that
matches the writer name. There isn't one of course. Just omit it.

> Using --writer=3Dsample.lua does not work.
> Error: "Unknown option --writer."

Whoops, should have been `--write`. I'm cutting down on coffee, I g= uess
it shows. =F0=9F=98=AC

> 2/ Accessing variables in lua filter
> I would like to have access to "variables" in lua filter= .

If you use `function Writer(doc, opts)`, then the variables are
available via `opts.variables`.

> I prefer not to use "function Writer" for now if possibl= e.
> Do you have any tips or working examples for that one?

Do you mean an example of a classic custom writers? Pandoc has an
example built-in, it's available via

pandoc --print-default-data-file=3Dsample.lua

Classic writers are generally a bit easier (IMHO). I'd recommend ne= w-
style writers if you either base the new writer on one that's alrea= dy
included in pandoc, or if you want to make use of the `pandoc.layout`
module to get nicer looking output. Other than those cases, classic
writers are frequently the better choice.

Out of curiosity, what output format are planning to generate?

Cheers,
Albert

--=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/56920de7-922c-4491-86ee-c981beb37b78n%40googlegroups.= com.
------=_Part_1247_796700052.1654180837033-- ------=_Part_1246_48217453.1654180837033--