mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-27 09:55:57 +00:00
Remove workaround that had been needed for older ghc versions.
This commit is contained in:
@@ -176,11 +176,6 @@ runPres :: WriterEnv -> WriterState -> Pres a -> (a, [LogMessage])
|
||||
runPres env st p = (pres, reverse $ stLog finalSt)
|
||||
where (pres, finalSt) = runState (runReaderT p env) st
|
||||
|
||||
-- GHC 7.8 will still complain about concat <$> mapM unless we specify
|
||||
-- Functor. We can get rid of this when we stop supporting GHC 7.8.
|
||||
concatMapM :: (Monad m) => (a -> m [b]) -> [a] -> m [b]
|
||||
concatMapM f xs = liftM concat (mapM f xs)
|
||||
|
||||
type Pixels = Integer
|
||||
|
||||
data Presentation = Presentation DocProps [Slide]
|
||||
@@ -348,7 +343,7 @@ instance Default PicProps where
|
||||
--------------------------------------------------
|
||||
|
||||
inlinesToParElems :: [Inline] -> Pres [ParaElem]
|
||||
inlinesToParElems = concatMapM inlineToParElems
|
||||
inlinesToParElems = fmap mconcat . mapM inlineToParElems
|
||||
|
||||
inlineToParElems :: Inline -> Pres [ParaElem]
|
||||
inlineToParElems (Str s) = do
|
||||
@@ -484,7 +479,7 @@ blockToParagraphs (BlockQuote blks) =
|
||||
, pPropIndent = Just 0
|
||||
}
|
||||
, envRunProps = (envRunProps r){rPropForceSize = Just blockQuoteSize}})$
|
||||
concatMapM blockToParagraphs blks
|
||||
mconcat <$> mapM blockToParagraphs blks
|
||||
-- TODO: work out the format
|
||||
blockToParagraphs blk@(RawBlock _ _) = do addLogMessage $ BlockNotRendered blk
|
||||
return []
|
||||
@@ -508,7 +503,7 @@ blockToParagraphs (BulletList blksLst) = do
|
||||
, pPropIndent = Nothing
|
||||
, pPropIncremental = incremental
|
||||
}}) $
|
||||
concatMapM multiParList blksLst
|
||||
mconcat <$> mapM multiParList blksLst
|
||||
blockToParagraphs (OrderedList listAttr blksLst) = do
|
||||
pProps <- asks envParaProps
|
||||
incremental <- listShouldBeIncremental
|
||||
@@ -518,7 +513,7 @@ blockToParagraphs (OrderedList listAttr blksLst) = do
|
||||
, pPropIndent = Nothing
|
||||
, pPropIncremental = incremental
|
||||
}}) $
|
||||
concatMapM multiParList blksLst
|
||||
mconcat <$> mapM multiParList blksLst
|
||||
blockToParagraphs (DefinitionList entries) = do
|
||||
incremental <- listShouldBeIncremental
|
||||
let go :: ([Inline], [[Block]]) -> Pres [Paragraph]
|
||||
@@ -526,11 +521,12 @@ blockToParagraphs (DefinitionList entries) = do
|
||||
term <-blockToParagraphs $ Para [Strong ils]
|
||||
-- For now, we'll treat each definition term as a
|
||||
-- blockquote. We can extend this further later.
|
||||
definition <- concatMapM (blockToParagraphs . BlockQuote) blksLst
|
||||
definition <-
|
||||
mconcat <$> mapM (blockToParagraphs . BlockQuote) blksLst
|
||||
return $ term ++ definition
|
||||
local (\env -> env {envParaProps =
|
||||
(envParaProps env) {pPropIncremental = incremental}})
|
||||
$ concatMapM go entries
|
||||
$ mconcat <$> mapM go entries
|
||||
blockToParagraphs (Div (_, classes, _) blks) = let
|
||||
hasIncremental = "incremental" `elem` classes
|
||||
hasNonIncremental = "nonincremental" `elem` classes
|
||||
@@ -538,7 +534,7 @@ blockToParagraphs (Div (_, classes, _) blks) = let
|
||||
| hasNonIncremental -> Just InNonIncremental
|
||||
| otherwise -> Nothing
|
||||
addIncremental env = env { envInIncrementalDiv = incremental }
|
||||
in local addIncremental (concatMapM blockToParagraphs blks)
|
||||
in local addIncremental (mconcat <$> mapM blockToParagraphs blks)
|
||||
blockToParagraphs (Figure attr capt blks) = -- This never seems to be used:
|
||||
blockToParagraphs (Shared.figureDiv attr capt blks)
|
||||
blockToParagraphs hr@HorizontalRule = notRendered hr
|
||||
@@ -563,7 +559,7 @@ multiParList (b:bs) = do
|
||||
, pPropLevel = level + 1
|
||||
}
|
||||
})
|
||||
$ concatMapM blockToParagraphs bs
|
||||
$ mconcat <$> mapM blockToParagraphs bs
|
||||
return $ p ++ ps
|
||||
|
||||
cellToParagraphs :: Alignment -> SimpleCell -> Pres [Paragraph]
|
||||
@@ -824,7 +820,7 @@ blocksToSlide' lvl blks spkNotes = bodyBlocksToSlide lvl blks spkNotes
|
||||
blockToSpeakerNotes :: Block -> Pres SpeakerNotes
|
||||
blockToSpeakerNotes (Div (_, ["notes"], _) blks) =
|
||||
local (\env -> env{envInSpeakerNotes=True}) $
|
||||
SpeakerNotes <$> concatMapM blockToParagraphs blks
|
||||
SpeakerNotes . mconcat <$> mapM blockToParagraphs blks
|
||||
blockToSpeakerNotes _ = return mempty
|
||||
|
||||
handleSpeakerNotes :: Block -> Pres ()
|
||||
|
||||
Reference in New Issue
Block a user