k***@gmail.com
2017-04-02 22:49:28 UTC
I've got some org-mode files that I'd like to include in my site. They're
used outside of my hakyll project, (indeed, they're a sub module in my
site's repo) so I'd like to avoid adding the yaml metadata header. Instead
I whipped up function to scrape the #+TITLE: and #+AUTHOR lines off the
file, but I'm not sure how to actually utilize that.
Here's what I've got so far:
match "dotfiles/*.org" $ do
route $ setExtension "html"
compile $ do
body <- getResourceBody
metadata <- return $ (fmap metadataFrom body)
-- metadataFrom :: String -> [(String, String)]
-- metadataFrom scrapes #+TITLE:, #+AUTHOR: keywords from org
files
-- [(String, String)] is a list of keys/values
-- that should end up as fields in the context.
--
-- But how? I don't understand monads well enough yet.
renderPandoc body
this, I didn't realize I was going to be jumping ahead of where I was
learning Haskell. I've inched that forward a bit this weekend trying to
solve this, but would really appreciate some help. Be it of the "here's
some code that does something similar" variety, or "maybe you should read
$learning_resource$". Sorry if is this a redundant question. I did some
searching but didn't see anything that seemed particularly related.
Thanks!
used outside of my hakyll project, (indeed, they're a sub module in my
site's repo) so I'd like to avoid adding the yaml metadata header. Instead
I whipped up function to scrape the #+TITLE: and #+AUTHOR lines off the
file, but I'm not sure how to actually utilize that.
Here's what I've got so far:
match "dotfiles/*.org" $ do
route $ setExtension "html"
compile $ do
body <- getResourceBody
metadata <- return $ (fmap metadataFrom body)
-- metadataFrom :: String -> [(String, String)]
-- metadataFrom scrapes #+TITLE:, #+AUTHOR: keywords from org
files
-- [(String, String)] is a list of keys/values
-- that should end up as fields in the context.
--
-- But how? I don't understand monads well enough yet.
renderPandoc body
= loadAndApplyTemplate "templates/post.html" postCtx
= loadAndApplyTemplate "templates/default.html" postCtx
= relativizeUrls
Does it look like I'm on the right track so far? When I set out to do= loadAndApplyTemplate "templates/default.html" postCtx
= relativizeUrls
this, I didn't realize I was going to be jumping ahead of where I was
learning Haskell. I've inched that forward a bit this weekend trying to
solve this, but would really appreciate some help. Be it of the "here's
some code that does something similar" variety, or "maybe you should read
$learning_resource$". Sorry if is this a redundant question. I did some
searching but didn't see anything that seemed particularly related.
Thanks!
--
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.
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.