Skip to content

Instantly share code, notes, and snippets.

@co-dan
Created August 14, 2013 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save co-dan/6233372 to your computer and use it in GitHub Desktop.
Save co-dan/6233372 to your computer and use it in GitHub Desktop.
match "gallery/*.lhs" $ version "gallery" $ do
route $ setExtension "html"
compile $ do
getResourceBody >>= saveSnapshot "rawcontent"
withMathJax
>>= loadAndApplyTemplate "templates/exampleHi.html"
( mconcat
[ field "code" readSource
, setImgURL
, setHtmlURL
, markdownFieldsCtx ["description"]
, defaultContext
]
)
>>= mainCompiler defaultContext
-- export raw .lhs of examples for download
match "gallery/*.lhs" $ version "raw" $ do
route idRoute
compile getResourceBody
readSource :: Item String -> Compiler String
readSource item = itemBody <$> loadSnapshot metadata "rawcontent"
where
metadata = itemIdentifier item
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment