It would work but it would need to be `-F myfilter --filter-option myfilter='-foo'` so that pandoc sends the right options to the right filter when running multiple filters. I still think '-M myfilter_foo=bar` is not only sufficient but better. What we need is a way to specify non-markdown metadata, e.g. that values of keys beginning with an underscore are non-markdown. That's no big deal though. Filters can convert their metadata options to plain data themselves. /bpj fre 6 jan. 2017 kl. 19:43 skrev Matthew Pickering < matthewtpickering-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > Communicating arguments though env vars is very ad-hoc, an option > > "--filter-arguments" (like Joost suggests) which took a string and > > passed it to the filter when invoked would be sufficient. > > > > pandoc --filter myfilter --filter-options="--foo --baz --bar" > > > > results in pandoc calling > > > > myfilter csv --foo --baz --bar > > > > I investigated reimplementing pandoc-lit as a filter but it was not > > possible because the program has a lot of command line arguments you > > need to specify. > > > > The worry about passing the format as the first argument being > > confusing could be overcome by embedding more metadata into the JSON > > input. > > > > Matt > > > > On Fri, Jan 6, 2017 at 6:32 PM, BPJ wrote: > > > The best way to pass options to filters is through metadata. That gets > > > considerably easier if the filter can use a function which converts a > > > structure of metadata objects into a plain data structure so that > `MetsMap`s > > > get converted to plain associative arrays, `MetaList`s to plain arrays > and > > > other `Meta` elements to plain strings or booleans. It is easy to write > such > > > a function using existing walking and steingification functions. > > > > > > Once you get the hang of that you don't feel any need to pass custom > > > arguments to filters because it is so convenient to do filter config in > the > > > document. A useful way to avoid a lot of metadata keys prefixed with > filter > > > names is to have a single key equal to the filter name with a mapping as > > > value which contains the options for that filter. Nothing hinders you > from > > > also checking environment variables if metadata options are undefined and > > > use hardcoded defaults only if the env vars are also undefined. I do so > > > often enough to have written a helper function. > > > > > > /bpj > > > > > > fre 6 jan. 2017 kl. 14:00 skrev John MacFarlane : > > >> > > >> +++ Joost Kremers [Jan 06 17 13:27 ]: > > >> > > >> > > > >> > > >> >On Fri, Jan 06 2017, John MacFarlane wrote: > > >> > > >> >>This is a pretty common request. A couple of complications: > > >> > > >> >> > > >> > > >> >>1. Pandoc calls each filter with one argument, the name of > > >> > > >> >>the output format. (Filters thus have access to this.) > > >> > > >> >>If we allowed `-F "pantable -t csv"`, how would this work? > > >> > > >> >>Would pandoc call `pantable latex -t csv`? Would the filter > > >> > > >> >>be expecting this? > > >> > > >> > > > >> > > >> >For a properly written filter that shouldn't be a problem, should it? > > >> > > >> >You just need to decide on one way of doing it and stick to it. > > >> > > >> >Filters then need to be updated accordingly. Or are you worried about > > >> > > >> >backward compatibility? > > >> > > >> > > >> > > >> Well, I'm anticipating people getting confused. "I said to > > >> > > >> run --filter 'myfilter myarg', and for some reason 'myarg' > > >> > > >> isn't the first argument!" > > >> > > >> > > >> > > >> What's wrong with communicating options to filters through > > >> > > >> environment variables, which you can already do? > > >> > > >> > > >> > > >> PANTABLE_OUTPUT="csv" pandoc --filter pantable > > >> > > >> > > >> > > >> >pandoc --filter "My Cool Filter.py" --filter-args "-t csv" > > >> > > >> > > > >> > > >> >with each --filter-args referring to the immediately preceding > > >> > > >> >--filters option. Depending on how Pandoc calls filters, it may even > > >> > > >> >be possible to just pass it the literal string argument of > > >> > > >> >--filter-args without having to parse it into different options. > > >> > > >> > > >> > > >> I think this is too complex, with --filter-args affecting > > >> > > >> the immediately preceding --filter option. > > >> > > >> > > >> > > >> Again, I'd have to be convinced that environment variables > > >> > > >> don't already provide a perfectly adequate way to do this. > > >> > > >> > > >> > > >> -- > > >> > > >> 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > >> > > >> To view this discussion on the web visit > > >> > https://groups.google.com/d/msgid/pandoc-discuss/20170106125852.GA1662%40Administrateurs-iMac-3.local > . > > >> > > >> For more options, visit https://groups.google.com/d/optout. > > >> > > > -- > > > 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > > To view this discussion on the web visit > > > > https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCPn81DsWpzWSQHv59ii%2BSLXmz4Ww5ru1mSmP4eRQozow%40mail.gmail.com > . > > > > > > For more options, visit https://groups.google.com/d/optout. > > > > -- > > 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/CALuQ0m8Jx2N_nKKOL5i5pNM9houf_iUe2Z54uWeajm2oVEZW5w%40mail.gmail.com > . > > For more options, visit https://groups.google.com/d/optout. > > -- 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 post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCf3X7ETGQ2DJpZ3Y5gWQid2mUGWJCrpdmpJKWXWb6XBw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.