public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Albert Krewinkel <albert+pandoc-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Cc: Felix SOEDJEDE <soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: Pandoc 2.18 - Custom writer working example
Date: Thu, 02 Jun 2022 18:40:50 +0200	[thread overview]
Message-ID: <87tu933tb0.fsf@zeitkraut.de> (raw)
In-Reply-To: <56920de7-922c-4491-86ee-c981beb37b78n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


Felix SOEDJEDE <soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> My real need is that I want to be able to access variables in my lua
> filters.

In that case there might be a simpler solution: The global
PANDOC_WRITER_OPTIONS became available in pandoc 2.17. With that you can
access variables in writers by indexing
`PANDOC_WRITER_OPTIONS.variables`.

To give a short example: if you call pandoc with

    pandoc --lua-filter=var-test.lua --variable foo=hello <<< ''

where `var-test.lua` contains

    print(PANDOC_WRITER_OPTIONS.variables.foo)

then you'll get `hello` printed to the terminal.

HTH,
Albert


-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124


  parent reply	other threads:[~2022-06-02 16:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 23:01 Felix SOEDJEDE
     [not found] ` <8528d41a-d6dd-4ca7-b38a-13955a9d1eabn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02  5:27   ` Albert Krewinkel
     [not found]     ` <87fskn6345.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-02  8:10       ` Felix SOEDJEDE
     [not found]         ` <cde6d369-8813-41ed-a1ea-253901014b46n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02  8:43           ` Albert Krewinkel
     [not found]             ` <87bkvb5tay.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-02 14:40               ` Felix SOEDJEDE
     [not found]                 ` <56920de7-922c-4491-86ee-c981beb37b78n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2022-06-02 16:40                   ` Albert Krewinkel [this message]
     [not found]                     ` <87tu933tb0.fsf-9EawChwDxG8hFhg+JK9F0w@public.gmane.org>
2022-06-03  7:31                       ` Felix SOEDJEDE

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tu933tb0.fsf@zeitkraut.de \
    --to=albert+pandoc-9eawchwdxg8hfhg+jk9f0w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=soefelix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).