From 99567b586bd479405b1ea5ef8bac49d4838ccbad Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Tue, 28 Jul 2015 09:50:07 -0700 Subject: [PATCH] Try using pandoc? --- web/src/Within/DBMemorial/Post.hs | 8 +++++++- web/time-wasting-thread-memorial.cabal | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web/src/Within/DBMemorial/Post.hs b/web/src/Within/DBMemorial/Post.hs index 9be85a2..2a95c09 100644 --- a/web/src/Within/DBMemorial/Post.hs +++ b/web/src/Within/DBMemorial/Post.hs @@ -8,6 +8,7 @@ import Database.SQLite.Simple.FromRow import Text.Blaze.Html5 ((!)) import qualified Text.Blaze.Html5 as H import qualified Text.Blaze.Html5.Attributes as A +import Text.Pandoc data Post = Post { id :: Int @@ -26,4 +27,9 @@ render post = do H.div ! A.class_ "card blue-grey darken-1" $ do H.div ! A.class_ "card-content white-text" $ do H.span ! A.class_ "card-title" $ H.toHtml $ unpack (author post) - H.p $ H.toHtml $ unpack (markdown post) + + state <- case readTextile def (unpack $ body post) of + Right v -> return v + Left err -> error (show err) + + H.p $ writeHtml def state diff --git a/web/time-wasting-thread-memorial.cabal b/web/time-wasting-thread-memorial.cabal index 6becf59..42992b2 100644 --- a/web/time-wasting-thread-memorial.cabal +++ b/web/time-wasting-thread-memorial.cabal @@ -65,6 +65,8 @@ executable time-wasting-thread-memorial , blaze-markup >=0.7.0.2 , wai-middleware-static >=0.7.0.1 , wai-extra >=1.3.0 + , pandoc >=1.15.0.6 + , mtl >=2.2.1 -- Directories containing source files. hs-source-dirs: src