Commit e8633cf3 authored by Henrik Tramberend's avatar Henrik Tramberend
Browse files

Refactor some inefficencies

parent aae4e056
......@@ -39,6 +39,7 @@ isDevelopmentVersion =
-- | Tool specific exceptions
data DeckerException
= MustacheException String
| InternalException String
| ResourceException String
| GitException String
| PandocException String
......@@ -53,6 +54,7 @@ data DeckerException
instance Exception DeckerException
instance Show DeckerException where
show (InternalException e) = e
show (MustacheException e) = e
show (ResourceException e) = e
show (GitException e) = e
......
......@@ -29,7 +29,7 @@ import Data.List
import Data.List.Split
import Data.Maybe
import Development.Shake (Action)
import Network.HTTP.Conduit
import Network.HTTP.Conduit hiding (InternalException)
import Network.HTTP.Simple
import qualified Network.URI as U
import Network.URI (parseURI, uriScheme)
......@@ -285,23 +285,24 @@ mapSlides func (Pandoc meta blocks) =
makeSlides :: Pandoc -> Decker Pandoc
makeSlides pandoc = do
disp <- gets disposition
let chain =
case disp of
Disposition Deck Html ->
return $
walk (mapSlides layoutSlides) $
walk (mapSlides splitJoinColumns) $
walk (mapSlides setSlideBackground) $
walk (mapSlides wrapBoxes) $ walk (mapSlides wrapNoteRevealjs) pandoc
layoutSlides .
splitJoinColumns . setSlideBackground . wrapBoxes . wrapNoteRevealjs
-- TODO: Maybe we need some handout specific structure
Disposition Handout Html ->
layoutSlides . splitJoinColumns . wrapBoxes . wrapNoteRevealjs
-- TODO: Maybe we need some latex specific structure
Disposition Handout Pdf -> Prelude.id
-- TODO: Probably not much to do here
Disposition Page Html -> Prelude.id
-- TODO: Probably not much to do here
Disposition Page Pdf -> Prelude.id
Disposition Deck Pdf ->
return $
walk (mapSlides layoutSlides) $
walk (mapSlides splitJoinColumns) $
walk (mapSlides setSlideBackground) $ walk (mapSlides wrapBoxes) pandoc
Disposition _ _ -> return pandoc
-- TODO: Do this for pages
-- walk (mapSlides splitJoinColumns) $
-- walk (mapSlides setSlideBackground) $
-- walk (mapSlides wrapBoxes) pandoc
throw $
InternalException "PDF slide decks via LaTeX are not supported"
return $ mapSlides chain pandoc
makeBoxes :: Pandoc -> Pandoc
makeBoxes = walk (mapSlides wrapBoxes)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment