Discussion:
[hakyll] Could someone provide me an example how to use Pandoc Filter within Hakyll?
Yun
2015-04-25 16:25:47 UTC
Permalink
I am sorry to ask such question. But I am really new to Haskell. I searched
the Internet for a whole day but didn't find any example.

I have a pandoc filter written in python (`tikzcd.py`). I want to use that
filter to process my blog posts.

I guess I need to use `unixFilter` or `pandocCompileWithTransform` but my
knowledge to Haskell is really not enough to find a solution myself.

So, could someone provide me an example?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Kyle Marek-Spartz
2015-04-25 21:16:39 UTC
Permalink
Not sure exactly, but I import some stuff from Text.Pandoc.Options in my
site.hs to change how Pandoc writes its output:

https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L15
https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L238

It may be possible to chain a filter in there somehow. Pandoc's
scripting documentation isn't too clear about how to chain filters into
readers and/or writers:

http://pandoc.org/scripting.html

Hopefully that can get you started.
Post by Yun
I am sorry to ask such question. But I am really new to Haskell. I searched
the Internet for a whole day but didn't find any example.
I have a pandoc filter written in python (`tikzcd.py`). I want to use that
filter to process my blog posts.
I guess I need to use `unixFilter` or `pandocCompileWithTransform` but my
knowledge to Haskell is really not enough to find a solution myself.
So, could someone provide me an example?
--
Kyle Marek-Spartz
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yun
2015-04-25 22:44:50 UTC
Permalink
Thanks for your reply!

But I have looked up Pandoc's API and didn't find out how to do this using
Options. In fact, I have already used some options as you did.

As far as I understand,

pandoc --filter foobar.py

is equivalent to

pandoc -t json | ./foobar.py | pandoc -f json

So I think I should use some `unixFilter` to do this.

I don't think it will be too hard, but I do need to learn some Haskell so
to make it easy.


--
Yun
Post by Kyle Marek-Spartz
Not sure exactly, but I import some stuff from Text.Pandoc.Options in my
https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L15
https://github.com/zeckalpha/kyle.marek-spartz.org/blob/master/site.hs#L238
It may be possible to chain a filter in there somehow. Pandoc's
scripting documentation isn't too clear about how to chain filters into
http://pandoc.org/scripting.html
Hopefully that can get you started.
Post by Yun
I am sorry to ask such question. But I am really new to Haskell. I
searched
Post by Yun
the Internet for a whole day but didn't find any example.
I have a pandoc filter written in python (`tikzcd.py`). I want to use
that
Post by Yun
filter to process my blog posts.
I guess I need to use `unixFilter` or `pandocCompileWithTransform` but
my
Post by Yun
knowledge to Haskell is really not enough to find a solution myself.
So, could someone provide me an example?
--
Kyle Marek-Spartz
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Yun
2015-04-27 00:31:04 UTC
Permalink
For those who need an answer to this question, please visit
http://stackoverflow.com/questions/29868096/how-to-use-pandoc-filter-within-hakyll
.
Post by Yun
I am sorry to ask such question. But I am really new to Haskell. I
searched the Internet for a whole day but didn't find any example.
I have a pandoc filter written in python (`tikzcd.py`). I want to use that
filter to process my blog posts.
I guess I need to use `unixFilter` or `pandocCompileWithTransform` but my
knowledge to Haskell is really not enough to find a solution myself.
So, could someone provide me an example?
--
You received this message because you are subscribed to the Google Groups "hakyll" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hakyll+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...