PowerPoint writer: write math input verbatim in speaker notes.
OMML in speaker notes would lead to corrupt PowerPoint output. We now output the OMML verbatim as LaTeX in the speaker notes. Closes #6301.
This commit is contained in:
parent
9c2b659eeb
commit
9e7572da1f
1 changed files with 12 additions and 6 deletions
|
@ -106,6 +106,7 @@ data WriterEnv = WriterEnv { envRefArchive :: Archive
|
||||||
-- are no notes for a slide, there will be
|
-- are no notes for a slide, there will be
|
||||||
-- no entry in the map for it.
|
-- no entry in the map for it.
|
||||||
, envSpeakerNotesIdMap :: M.Map Int Int
|
, envSpeakerNotesIdMap :: M.Map Int Int
|
||||||
|
, envInSpeakerNotes :: Bool
|
||||||
}
|
}
|
||||||
deriving (Show)
|
deriving (Show)
|
||||||
|
|
||||||
|
@ -123,6 +124,7 @@ instance Default WriterEnv where
|
||||||
, envContentType = NormalContent
|
, envContentType = NormalContent
|
||||||
, envSlideIdMap = mempty
|
, envSlideIdMap = mempty
|
||||||
, envSpeakerNotesIdMap = mempty
|
, envSpeakerNotesIdMap = mempty
|
||||||
|
, envInSpeakerNotes = False
|
||||||
}
|
}
|
||||||
|
|
||||||
data ContentType = NormalContent
|
data ContentType = NormalContent
|
||||||
|
@ -803,11 +805,14 @@ paraElemToElements (Run rpr s) = do
|
||||||
, mknode "a:t" [] $ T.unpack s
|
, mknode "a:t" [] $ T.unpack s
|
||||||
]]
|
]]
|
||||||
paraElemToElements (MathElem mathType texStr) = do
|
paraElemToElements (MathElem mathType texStr) = do
|
||||||
res <- convertMath writeOMML mathType (unTeXString texStr)
|
isInSpkrNotes <- asks envInSpeakerNotes
|
||||||
case res of
|
if isInSpkrNotes
|
||||||
Right r -> return [mknode "a14:m" [] $ addMathInfo r]
|
then paraElemToElements $ Run def $ unTeXString texStr
|
||||||
Left (Str s) -> paraElemToElements (Run def s)
|
else do res <- convertMath writeOMML mathType (unTeXString texStr)
|
||||||
Left _ -> throwError $ PandocShouldNeverHappenError "non-string math fallback"
|
case res of
|
||||||
|
Right r -> return [mknode "a14:m" [] $ addMathInfo r]
|
||||||
|
Left (Str s) -> paraElemToElements (Run def s)
|
||||||
|
Left _ -> throwError $ PandocShouldNeverHappenError "non-string math fallback"
|
||||||
paraElemToElements (RawOOXMLParaElem str) = return [ x | Elem x <- parseXML str ]
|
paraElemToElements (RawOOXMLParaElem str) = return [ x | Elem x <- parseXML str ]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1231,7 +1236,8 @@ spaceParas = intersperse (Paragraph def [])
|
||||||
|
|
||||||
speakerNotesBody :: PandocMonad m => [Paragraph] -> P m Element
|
speakerNotesBody :: PandocMonad m => [Paragraph] -> P m Element
|
||||||
speakerNotesBody paras = do
|
speakerNotesBody paras = do
|
||||||
elements <- mapM paragraphToElement $ spaceParas $ map removeParaLinks paras
|
elements <- local (\env -> env{envInSpeakerNotes = True}) $
|
||||||
|
mapM paragraphToElement $ spaceParas $ map removeParaLinks paras
|
||||||
let txBody = mknode "p:txBody" [] $
|
let txBody = mknode "p:txBody" [] $
|
||||||
[mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
|
[mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] <> elements
|
||||||
return $
|
return $
|
||||||
|
|
Loading…
Add table
Reference in a new issue