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

Refactor some inefficencies

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