It should be something like this:
match "what" $ do
route idRoute
compile $ do
ident <- getUnderlying
toc <- getMetadataFeild identifier "toc"
let writerSettings = case toc of
Just "yes" -> myWriterOptionsToc
Nothing -> myWriterOptions
pandocCompilerWith myReaderOptions writerSettings
...
In my config [1] I have the following settings:
myWriterOptions :: WriterOptions
myWriterOptions = defaultHakyllWriterOptions {
writerReferenceLinks = True
, writerHtml5 = True
, writerHighlight = True
}
myWriterOptionsToc :: WriterOptions
myWriterOptionsToc = myWriterOptions {
writerTableOfContents = True
, writerTOCDepth = 2
, writerTemplate = "$if(toc)$<div id=\"toc\">$toc$</div>$endif$\n$body$"
, writerStandalone = True
}
[1] http://hub.darcs.net/co-dan/website/browse/site.hs#207
hope this helps
Post by k***@public.gmane.orgWith this I get
Couldn't match type `Compiler' with `Rules'
Expected type: Rules Identifier
Actual type: Compiler Identifier
Post by Jasper Van der Jeugtidentifier <- getUnderlying
toc <- getMetadataField identifier "toc"
case toc of
Just "yes" -> -- do something
_ -> -- do something else
Hope this helps,
Peace,
Jasper
Post by k***@public.gmane.orgIt would be nice, if 'table of contents' could be specified in the meta
tag eg
----
title: Funky Friday
toc: yes
----
Post by Qi QiHi,
I want a table of contents for each of my post. Based on the new
version of Hakyll, I assume it has something to with the
pageRenderPandocWith, and the WriterOptions should be set for it.
Could anyone give an example about it?
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
For more options, visit https://groups.google.com/groups/opt_out.
--
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
For more options, visit https://groups.google.com/groups/opt_out.
--
Sincerely yours,
-- Daniil
--
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+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.