* Lua filter applied to a specific input file @ 2021-01-14 21:18 Peter [not found] ` <b921eb81-70fe-43c5-aba0-d4b9317c270dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Peter @ 2021-01-14 21:18 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1.1: Type: text/plain, Size: 850 bytes --] I have a working Lua filter and I'll be having pandoc iterate over multiple input files (for loop). However, I know in advance that my filter will only match on a specific file's data. Is it possible, within the AST model, to have the filter bail unless it's inspecting data associated with this specific file? Or do I need to deal with this at the pandoc invocation level (i.e. specify what filter to use based on the input files)? -- 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/b921eb81-70fe-43c5-aba0-d4b9317c270dn%40googlegroups.com. [-- Attachment #1.2: Type: text/html, Size: 1135 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <b921eb81-70fe-43c5-aba0-d4b9317c270dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>]
* Re: Lua filter applied to a specific input file [not found] ` <b921eb81-70fe-43c5-aba0-d4b9317c270dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> @ 2021-01-14 21:54 ` Albert Krewinkel 2021-01-14 21:57 ` John MacFarlane 1 sibling, 0 replies; 4+ messages in thread From: Albert Krewinkel @ 2021-01-14 21:54 UTC (permalink / raw) To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw Peter <pmatulis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > I have a working Lua filter and I'll be having pandoc iterate over multiple > input files (for loop). However, I know in advance that my filter will only > match on a specific file's data. Is it possible, within the AST model, to > have the filter bail unless it's inspecting data associated with this > specific file? Or do I need to deal with this at the pandoc invocation > level (i.e. specify what filter to use based on the input files)? One possibility would be to match the exact file name. You can do so by inspecting the `input_files` field of the global variable `PANDOC_STATE`: local input_files = pandoc.List(PANDOC_STATE.input_files) if not input_files:includes('my-special-file.md') then return {} end -- rest of the script begins here. Does that help? -- Albert Krewinkel GPG: 8eed e3e2 e8c5 6f18 81fe e836 388d c0b2 1f63 1124 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Lua filter applied to a specific input file [not found] ` <b921eb81-70fe-43c5-aba0-d4b9317c270dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-01-14 21:54 ` Albert Krewinkel @ 2021-01-14 21:57 ` John MacFarlane [not found] ` <m2r1mnfafv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: John MacFarlane @ 2021-01-14 21:57 UTC (permalink / raw) To: Peter, pandoc-discuss PANDOC_STATE.input_files should give you an array of the input files in the filter. Peter <pmatulis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > I have a working Lua filter and I'll be having pandoc iterate over multiple > input files (for loop). However, I know in advance that my filter will only > match on a specific file's data. Is it possible, within the AST model, to > have the filter bail unless it's inspecting data associated with this > specific file? Or do I need to deal with this at the pandoc invocation > level (i.e. specify what filter to use based on the input files)? > > -- > 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/b921eb81-70fe-43c5-aba0-d4b9317c270dn%40googlegroups.com. ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <m2r1mnfafv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org>]
* Re: Lua filter applied to a specific input file [not found] ` <m2r1mnfafv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org> @ 2021-01-15 2:29 ` Peter Matulis 0 siblings, 0 replies; 4+ messages in thread From: Peter Matulis @ 2021-01-15 2:29 UTC (permalink / raw) To: pandoc-discuss [-- Attachment #1: Type: text/plain, Size: 1615 bytes --] Awesome. Thank you both. On Thu, 14 Jan 2021 at 16:58, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote: > > PANDOC_STATE.input_files should give you an array of the input > files in the filter. > > Peter <pmatulis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes: > > > I have a working Lua filter and I'll be having pandoc iterate over > multiple > > input files (for loop). However, I know in advance that my filter will > only > > match on a specific file's data. Is it possible, within the AST model, > to > > have the filter bail unless it's inspecting data associated with this > > specific file? Or do I need to deal with this at the pandoc invocation > > level (i.e. specify what filter to use based on the input files)? > > > > -- > > 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/b921eb81-70fe-43c5-aba0-d4b9317c270dn%40googlegroups.com > . > -- 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/CAMxYqzGdmf05ObLdWrbwb%3DCdswtk_bELij2G8Ed0ewX5M1Ypvw%40mail.gmail.com. [-- Attachment #2: Type: text/html, Size: 2700 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-01-15 2:29 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-14 21:18 Lua filter applied to a specific input file Peter [not found] ` <b921eb81-70fe-43c5-aba0-d4b9317c270dn-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> 2021-01-14 21:54 ` Albert Krewinkel 2021-01-14 21:57 ` John MacFarlane [not found] ` <m2r1mnfafv.fsf-jF64zX8BO08an7k8zZ43ob9bIa4KchGshsV+eolpW18@public.gmane.org> 2021-01-15 2:29 ` Peter Matulis
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).