From: BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Type of the `filter' argument to traversal functions
Date: Wed, 12 Aug 2020 10:22:02 +0200 [thread overview]
Message-ID: <CADAJKhDhPnbCr-_qyb=n3odtCneVnhsgPHo1wJXXm1nOuF=Ssg@mail.gmail.com> (raw)
In-Reply-To: <CADAJKhCR8ZQwWhEW2x_b9sUAyMikaFEySXnQCFVtFWq6VOdRKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 4335 bytes --]
I wrote:
> why it is useful that a filter script can return an array of filters
That should obviously have been "must return"! Sorry for any confusion!
--
Better --help|less than helpless
Den ons 12 aug. 2020 10:19BPJ <melroch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
> I suppose that it might be worth pointing out that the reason why it is
> useful that a filter script can return an array of filters is explained
> here:
>
> https://pandoc.org/lua-filters.html#execution-order
>
> A note on terminology: Since "table" on its own is rather ambiguous in Lua may
> be a good idea to clarify what kind of data a it given table is supposed
> to contain by using the terms "array table" and "map table" and possibly
> "mixed table" for a table with both array and map data, which are sometimes
> convenient in Lua code, e.g. to tag an array.
>
> --
> Better --help|less than helpless
>
> Den ons 12 aug. 2020 02:27John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> skrev:
>
>> Anton Shepelev <anton.txt-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>
>> > John MacFarlane to Anton Shepelev:
>> >
>> >> > The documentation to walk_block() and walk_fil-
>> >> > ter() states that the second parameter is "a Lua
>> >> > filter (table of functions) to be applied within
>> >> > the block element".
>> >> > [...]
>> >> > Is the documentation incorrect or do I misinter-
>> >> > pret it? For aught I know, {Span = OnSpan} is
>> >> > not a "table of functions".
>> >>
>> >> { } makes a table. OnSpan is a function. So, a
>> >> table of functions.
>> >
>> > Please, bear with me. A table in Lua is the one-to-
>> > rule-them-all complex type, that can represent many
>> > sturctures, including array, associative array, or
>> > structure. On the other hand, the generally used
>> > meaning of `table' in programming and mathematics is
>> > a two-dimensional sturcture with columns and any
>> > number of rows from zero up, which, too, can be rep-
>> > resented as a table in Lua, although it would be a
>> > compound one.
>>
>> I would have thought that in the context of documenting a Lua
>> function 'table' would be naturally interpreted as 'Lua table'.
>>
>> > But since the parameter is described as "a Lua fil-
>> > ter" and "a table of functions", the only way to in-
>> > terpret it is as describing the structure of the Lua
>> > filter itself, which is a table of functions in both
>> > Lua and general terminology:
>> >
>> > { { Id1 = Func1 }
>> > { Id2 = Func2 }
>> > { Id3 = Func3 } }
>>
>> According to the docs, "Lua filters are tables with element names
>> as keys and values consisting of functions acting on those
>> elements." So yes, the parameter to walk_block is a Lua filter as
>> defined in the documentation.
>>
>> If you had
>>
>> { { Id1 = Funct1,
>> Id2 = Funct2 } }
>>
>> that would be an array of Lua filters. But now, I see where you
>> may be getting confused. Reading on in the docs: "Pandoc expects
>> each Lua file to return a list of filters. The filters in that
>> list are called sequentially, each on the result of the previous
>> filter." It may be confusing that one often uses the term
>> "lua filter" for the file itself. But the file can return
>> a list (technically an array, implemented as a Lua table) of
>> filters. I suspect you are confusing an array of Lua filters --
>> which can be defined in a single Lua file -- with a Lua filter.
>>
>> --
>> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/pandoc-discuss/m2o8nghfs7.fsf%40johnmacfarlane.net
>> .
>>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhDhPnbCr-_qyb%3Dn3odtCneVnhsgPHo1wJXXm1nOuF%3DSsg%40mail.gmail.com.
[-- Attachment #2: Type: text/html, Size: 6683 bytes --]
next prev parent reply other threads:[~2020-08-12 8:22 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
[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 [this message]
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='CADAJKhDhPnbCr-_qyb=n3odtCneVnhsgPHo1wJXXm1nOuF=Ssg@mail.gmail.com' \
--to=melroch-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).