* Pass parameters to filter?
@ 2015-03-01 14:37 Ranjit Jhala
[not found] ` <c5f4274d-e2f4-4e77-91c2-798996bdcb10-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-01 14:37 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 886 bytes --]
Hi,
Is there an easy way to pass parameters to a filter? For example,
suppose I want to pass in a path to some file that will be used as
a template by the filter. Is there an easy way to pass this path along?
I tried
pandoc --filter codeblock.hs path
but that doesn't work. Any clues?
Thanks!
Ranjit.
--
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/c5f4274d-e2f4-4e77-91c2-798996bdcb10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 1718 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <c5f4274d-e2f4-4e77-91c2-798996bdcb10-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-02 0:40 ` 'Jason Seeley' via pandoc-discuss
[not found] ` <93845016-5a7f-4dfc-928c-d0a740205933-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: 'Jason Seeley' via pandoc-discuss @ 2015-03-02 0:40 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 1281 bytes --]
You could pass parameters as Metadata variables using "-M param=value" or
'--metadata=param:value". The metadata is available to filters. (I'm not
too familiar with how to access it with Haskell, but I know it is in the
"unMeta" dictionary at the top of the json format of the document.)
Jason
On Sunday, March 1, 2015 at 8:37:00 AM UTC-6, Ranjit Jhala wrote:
>
> Hi,
>
> Is there an easy way to pass parameters to a filter? For example,
> suppose I want to pass in a path to some file that will be used as
> a template by the filter. Is there an easy way to pass this path along?
>
> I tried
>
> pandoc --filter codeblock.hs path
>
> but that doesn't work. Any clues?
>
> Thanks!
>
> Ranjit.
>
>
--
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/93845016-5a7f-4dfc-928c-d0a740205933%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 2249 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <93845016-5a7f-4dfc-928c-d0a740205933-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-02 17:35 ` John MacFarlane
[not found] ` <20150302173526.GA63436-bi+AKbBUZKbivNSvqvJHCtPlBySK3R6THiGdP5j34PU@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: John MacFarlane @ 2015-03-02 17:35 UTC (permalink / raw)
To: 'Jason Seeley' via pandoc-discuss
Another possibility is to set an environment variable and read it in
your filter.
+++ 'Jason Seeley' via pandoc-discuss [Mar 01 15 16:40 ]:
>You could pass parameters as Metadata variables using "-M param=value" or
>'--metadata=param:value". The metadata is available to filters. (I'm not
>too familiar with how to access it with Haskell, but I know it is in the
>"unMeta" dictionary at the top of the json format of the document.)
>
>Jason
>
>On Sunday, March 1, 2015 at 8:37:00 AM UTC-6, Ranjit Jhala wrote:
>>
>> Hi,
>>
>> Is there an easy way to pass parameters to a filter? For example,
>> suppose I want to pass in a path to some file that will be used as
>> a template by the filter. Is there an easy way to pass this path along?
>>
>> I tried
>>
>> pandoc --filter codeblock.hs path
>>
>> but that doesn't work. Any clues?
>>
>> Thanks!
>>
>> Ranjit.
>>
>>
>
>--
>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/93845016-5a7f-4dfc-928c-d0a740205933%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <20150302173526.GA63436-bi+AKbBUZKbivNSvqvJHCtPlBySK3R6THiGdP5j34PU@public.gmane.org>
@ 2015-03-02 19:22 ` Ranjit Jhala
2015-03-02 23:28 ` Ranjit Jhala
1 sibling, 0 replies; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-02 19:22 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 649 bytes --]
Great, Thanks! both of these would work (somehow missed the unMeta thing...)
--
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/e1ff19ba-e827-432a-bc23-6002145db1d3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 1061 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <20150302173526.GA63436-bi+AKbBUZKbivNSvqvJHCtPlBySK3R6THiGdP5j34PU@public.gmane.org>
2015-03-02 19:22 ` Ranjit Jhala
@ 2015-03-02 23:28 ` Ranjit Jhala
[not found] ` <521e983e-91b5-4c48-a91a-e6216bcb0c28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-02 23:28 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 849 bytes --]
Hmm. Can you give a concrete example of using the environment variables?
My attempts end up failing with the odd error:
pandoc: Failed reading: satisfy
I get this no matter what `IO` action I try (including just reading some
random file before calling toJsonFilter)
>
>
--
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/521e983e-91b5-4c48-a91a-e6216bcb0c28%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 1644 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <521e983e-91b5-4c48-a91a-e6216bcb0c28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-02 23:30 ` Ranjit Jhala
[not found] ` <c6e82242-10ae-4a61-a9b3-ca9aa4e645c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-02 23:30 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 1201 bytes --]
To be precise: I get the below error when my code is:
main :: IO ()
main = do tgt <- readFile "dist/PANDOC"
putStrLn $ "Pandoc TARGET: " ++ tgt
txFigHtml
but everything works fine if I remove the first two lines (i.e. just use
`txFigHtml`) ?
On Monday, March 2, 2015 at 3:28:12 PM UTC-8, Ranjit Jhala wrote:
>
> Hmm. Can you give a concrete example of using the environment variables?
>
> My attempts end up failing with the odd error:
>
> pandoc: Failed reading: satisfy
>
> I get this no matter what `IO` action I try (including just reading some
> random file before calling toJsonFilter)
>
>
>>
>>
--
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/c6e82242-10ae-4a61-a9b3-ca9aa4e645c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 3457 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <c6e82242-10ae-4a61-a9b3-ca9aa4e645c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2015-03-02 23:32 ` Ranjit Jhala
2015-03-02 23:46 ` Tillmann Rendel
1 sibling, 0 replies; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-02 23:32 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 1499 bytes --]
The problem is with `putStrLn` -- if I instead use `trace` from Debug.Trace
its fine...
main :: IO ()
main = do tgt <- readFile "dist/PANDOC"
trace ("Pandoc TARGET: " ++ tgt) txFigHtml
On Monday, March 2, 2015 at 3:30:01 PM UTC-8, Ranjit Jhala wrote:
>
> To be precise: I get the below error when my code is:
>
> main :: IO ()
> main = do tgt <- readFile "dist/PANDOC"
> putStrLn $ "Pandoc TARGET: " ++ tgt
> txFigHtml
>
> but everything works fine if I remove the first two lines (i.e. just use
> `txFigHtml`) ?
>
> On Monday, March 2, 2015 at 3:28:12 PM UTC-8, Ranjit Jhala wrote:
>>
>> Hmm. Can you give a concrete example of using the environment variables?
>>
>> My attempts end up failing with the odd error:
>>
>> pandoc: Failed reading: satisfy
>>
>> I get this no matter what `IO` action I try (including just reading some
>> random file before calling toJsonFilter)
>>
>>
>>>
>>>
--
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/02d879c0-8ac5-427f-b5b9-d265ceb9ead0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 4732 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <c6e82242-10ae-4a61-a9b3-ca9aa4e645c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-02 23:32 ` Ranjit Jhala
@ 2015-03-02 23:46 ` Tillmann Rendel
[not found] ` <54F4F650.6060209-jNDFPZUTrfQQDnmTUQnR1uqEdJ8o/OS0G9Ur7JDdleE@public.gmane.org>
1 sibling, 1 reply; 9+ messages in thread
From: Tillmann Rendel @ 2015-03-02 23:46 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Hi,
Ranjit Jhala wrote:
> To be precise: I get the below error when my code is:
>
> main ::IO ()
> main = do tgt <-readFile "dist/PANDOC"
> putStrLn $ "Pandoc TARGET: "++tgt
> txFigHtml
>
> but everything works fine if I remove the first two lines (i.e. just use
> `txFigHtml`) ?
Your program is run as a filter by pandoc, so everything your program
prints to the the standard output stream (stdout) will get redirected to
pandoc. Including whatever `putStrLn $ "Pandoc TARGET: "++tgt` prints.
Pandoc doesn't know how to understand that information, of course, so
you get a (not really satisfying) error message.
To print some debugging information to the user, try the standard error
stream (stderr):
> import System.IO (hPutStrLn, stderr);
> ...
> hPutStrLn stderr $ "Pandoc TARGET: " ++ tgt
Tillmann
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Pass parameters to filter?
[not found] ` <54F4F650.6060209-jNDFPZUTrfQQDnmTUQnR1uqEdJ8o/OS0G9Ur7JDdleE@public.gmane.org>
@ 2015-03-04 3:58 ` Ranjit Jhala
0 siblings, 0 replies; 9+ messages in thread
From: Ranjit Jhala @ 2015-03-04 3:58 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
[-- Attachment #1.1: Type: text/plain, Size: 1603 bytes --]
Terrific, thanks for the explanation Tillmann! Ranjit.
On Monday, March 2, 2015 at 3:46:59 PM UTC-8, Tillmann Rendel wrote:
>
> Hi,
>
> Ranjit Jhala wrote:
> > To be precise: I get the below error when my code is:
> >
> > main ::IO ()
> > main = do tgt <-readFile "dist/PANDOC"
> > putStrLn $ "Pandoc TARGET: "++tgt
> > txFigHtml
> >
> > but everything works fine if I remove the first two lines (i.e. just use
> > `txFigHtml`) ?
>
> Your program is run as a filter by pandoc, so everything your program
> prints to the the standard output stream (stdout) will get redirected to
> pandoc. Including whatever `putStrLn $ "Pandoc TARGET: "++tgt` prints.
> Pandoc doesn't know how to understand that information, of course, so
> you get a (not really satisfying) error message.
>
> To print some debugging information to the user, try the standard error
> stream (stderr):
>
> > import System.IO (hPutStrLn, stderr);
> > ...
> > hPutStrLn stderr $ "Pandoc TARGET: " ++ tgt
>
> Tillmann
>
--
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/0b8d1006-92e0-493b-82bd-74c79c8487fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 2314 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-03-04 3:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-01 14:37 Pass parameters to filter? Ranjit Jhala
[not found] ` <c5f4274d-e2f4-4e77-91c2-798996bdcb10-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-02 0:40 ` 'Jason Seeley' via pandoc-discuss
[not found] ` <93845016-5a7f-4dfc-928c-d0a740205933-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-02 17:35 ` John MacFarlane
[not found] ` <20150302173526.GA63436-bi+AKbBUZKbivNSvqvJHCtPlBySK3R6THiGdP5j34PU@public.gmane.org>
2015-03-02 19:22 ` Ranjit Jhala
2015-03-02 23:28 ` Ranjit Jhala
[not found] ` <521e983e-91b5-4c48-a91a-e6216bcb0c28-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-02 23:30 ` Ranjit Jhala
[not found] ` <c6e82242-10ae-4a61-a9b3-ca9aa4e645c3-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2015-03-02 23:32 ` Ranjit Jhala
2015-03-02 23:46 ` Tillmann Rendel
[not found] ` <54F4F650.6060209-jNDFPZUTrfQQDnmTUQnR1uqEdJ8o/OS0G9Ur7JDdleE@public.gmane.org>
2015-03-04 3:58 ` Ranjit Jhala
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).