on master help sign in
Don't cache pandocCompilerWithTransform, refactor
commit251c019e9e11e99142109a3235d71cc605a14232 authorJasper Van der Jeugt <m@jaspervdj.be> dateTue 28 Jan 2014, 11:04 (13 years ago) parentca20400
1 file changed+9−10
src/Hakyll/Web/Pandoc.hs+9−10
src/Hakyll/Web/Pandoc.hs+9−10
@@ -101,7 +101,9 @@ pandocCompiler =
101101-- | A version of 'pandocCompiler' which allows you to specify your own pandoc
102102-- options
103103pandocCompilerWith :: ReaderOptions -> WriterOptions -> Compiler (Item String)
104−pandocCompilerWith ropt wopt = pandocCompilerWithTransform ropt wopt id
104+pandocCompilerWith ropt wopt =
105+ cached "Hakyll.Web.Pandoc.pandocCompilerWith" $
106+ pandocCompilerWithTransform ropt wopt id
105107
106108
107109--------------------------------------------------------------------------------
@@ -110,10 +112,9 @@ pandocCompilerWith ropt wopt = pandocCompilerWithTransform ropt wopt id
110112pandocCompilerWithTransform :: ReaderOptions -> WriterOptions
111113 -> (Pandoc -> Pandoc)
112114 -> Compiler (Item String)
113−pandocCompilerWithTransform ropt wopt f = cached cacheName $
114− writePandocWith wopt . fmap f . readPandocWith ropt <$> getResourceBody
115− where
116− cacheName = "Hakyll.Web.Page.pageCompilerWithPandoc"
115+pandocCompilerWithTransform ropt wopt f =
116+ pandocCompilerWithTransformM ropt wopt (return . f)
117+
117118
118119--------------------------------------------------------------------------------
119120-- | Similar to 'pandocCompilerWithTransform', but the transformation
@@ -123,12 +124,10 @@ pandocCompilerWithTransform ropt wopt f = cached cacheName $
123124pandocCompilerWithTransformM :: ReaderOptions -> WriterOptions
124125 -> (Pandoc -> Compiler Pandoc)
125126 -> Compiler (Item String)
126−pandocCompilerWithTransformM ropt wopt f = cached cacheName $
127+pandocCompilerWithTransformM ropt wopt f =
127128 writePandocWith wopt <$>
128− (traverse f
129− =<< readPandocWith ropt <$> getResourceBody)
130− where
131− cacheName = "Hakyll.Web.Page.pageCompilerWithPandoc"
129+ (traverse f =<< readPandocWith ropt <$> getResourceBody)
130+
132131
133132--------------------------------------------------------------------------------
134133-- | The default reader options for pandoc parsing in hakyll