public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Anton Shepelev <anton.txt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Type of the `filter' argument to traversal functions
Date: Wed, 12 Aug 2020 01:47:15 +0300	[thread overview]
Message-ID: <20200812014715.1c4ddc723344d9fb5f9c92e9@gmail.com> (raw)
In-Reply-To: <ab7d1128-cb98-466c-9f8c-35cd6b63422bo@googlegroups.com>

EBkysko:

> From the Lua filter page:
>
> > Lua  filters  are  tables  with element names as
> > keys and values consisting of  functions  acting
> > on those elements.
>
>
> `{Span  =  OnSpan}`  is a table in which `Span` is
> the key, `OnSpan` is the value, a function  acting
> on `Span` element.

OK.

> You  could  put  more key-values in the filter you
> send for a that walk_block:
>
> `{ Span = OnSpan, BulletList = MyBulletList, Para = HerPara }`
>
> which is a table of functions, each function being
> key-value  "indexed"  so  to say by a key which is
> necessarily one Pandoc element. This would  be  an
> example of a filter containing more than one func-
> tion.

Thank you for the explanation, I was wrong.

> Independently of pandoc, `{ Id1  =  Func1,  Id2  =
> Func2,  Id3 = Func3 }`, to take your last example,
> is a table of functions, each accessible by  their
> respective key.

No, it is not my example. My example was an array of
tables:
                { { Id1 = Func1 }
                  { Id2 = Func2 }
                  { Id3 = Func3 } }

A Lua filter is such an array of tables, whereas the
`filter' argument to the `walk_' functions is a sin-
gle table as in your examples above. They  are  dif-
ferent  and  incompatible stuctures. The entire .lua
script must return the one whereas the `walk_'  fun-
cions accept the other.

For examle, when a filter end with:

   return { Header=OnHeader }

it does not work. But when it ends with

   return { { Header=OnHeader } }

it  works.  This  is  the difference between the two
structures.


  reply	other threads:[~2020-08-11 22:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-11 19:09 Anton Shepelev
     [not found] ` <20200811220909.e97f97ce8e8dad5d575d90f6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-08-11 19:21   ` John MacFarlane
2020-08-11 21:46     ` Anton Shepelev
     [not found]       ` <20200812004617.ec382d94b849e234bbaa6762-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-08-11 22:15         ` EBkysko
2020-08-11 22:47           ` Anton Shepelev [this message]
     [not found]             ` <20200812014715.1c4ddc723344d9fb5f9c92e9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-08-11 23:02               ` EBkysko
     [not found]                 ` <996602a6-8c95-406c-b569-f381f517af31o-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-08-11 23:36                   ` EBkysko
2020-08-12  0:24         ` John MacFarlane
     [not found]           ` <m2o8nghfs7.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2020-08-12  8:19             ` BPJ
     [not found]               ` <CADAJKhCR8ZQwWhEW2x_b9sUAyMikaFEySXnQCFVtFWq6VOdRKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-08-12  8:22                 ` BPJ
2020-08-12  9:32               ` Anton Shepelev
     [not found]                 ` <20200812123257.14be2d659f808e89ecb7e7f9-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-08-12 11:40                   ` EBkysko
2020-08-12  9:17           ` Anton Shepelev

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=20200812014715.1c4ddc723344d9fb5f9c92e9@gmail.com \
    --to=anton.txt-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@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).