git.iko.soy/typeable/pandoc
on master help sign in
Powerpoint writer: Ignore links and (end)notes in speaker notes.

MS PowerPoint does not offer a way to insert links into speaker notes text, so we match that behavior, and make our lives easier. As for (end)notes, there is no clear solution to the question of wat that would *mean*. The default behavior would be to add it to the endnote slide, but that would put speaker note content into the public presentation. The best solution would be to put the content at the bottom of the notes page, but that would take some doing, and can be added to the speaker notes feature later.

commit07f3aa178be1dda44cd5477089d26c26b9460751 authorJesse Rosenthal <jrosenthal@jhu.edu> dateSun 18 Feb 2018, 15:58 (9 years ago) parent1126022
2 files changed+30−10
src/Text/Pandoc/Writers/Powerpoint/Output.hs+9−1 src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+21−9
src/Text/Pandoc/Writers/Powerpoint/Output.hs+9−1
@@ -1202,9 +1202,17 @@ speakerNotesSlideImage =
12021202 , mknode "p:spPr" [] ()
12031203 ]
12041204
1205+-- we want to wipe links from the speaker notes in the
1206+-- paragraphs. Powerpoint doesn't allow you to input them, and it
1207+-- would provide extra complications.
1208+removeLinks :: Paragraph -> Paragraph
1209+removeLinks paragraph = paragraph{paraElems = map f (paraElems paragraph)}
1210+ where f (Run rProps s) = Run rProps{rLink=Nothing} s
1211+ f pe = pe
1212+
12051213speakerNotesBody :: PandocMonad m => [Paragraph] -> P m Element
12061214speakerNotesBody paras = do
1207− elements <- mapM paragraphToElement paras
1215+ elements <- mapM paragraphToElement $ map removeLinks paras
12081216 let txBody = mknode "p:txBody" [] $
12091217 [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] ++ elements
12101218 return $
src/Text/Pandoc/Writers/Powerpoint/Presentation.hs+21−9
@@ -87,6 +87,7 @@ data WriterEnv = WriterEnv { envMetadata :: Meta
8787 , envInList :: Bool
8888 , envInNoteSlide :: Bool
8989 , envCurSlideId :: SlideId
90+ , envInSpeakerNotes :: Bool
9091 }
9192 deriving (Show)
9293
@@ -100,6 +101,7 @@ instance Default WriterEnv where
100101 , envInList = False
101102 , envInNoteSlide = False
102103 , envCurSlideId = SlideId "Default"
104+ , envInSpeakerNotes = False
103105 }
104106
105107
@@ -354,15 +356,24 @@ inlineToParElems (Code _ str) =
354356 inlineToParElems $ Str str
355357inlineToParElems (Math mathtype str) =
356358 return [MathElem mathtype (TeXString str)]
359+-- We ignore notes if we're in a speaker notes div. Otherwise this
360+-- would add an entry to the endnotes slide, which would put speaker
361+-- notes in the public presentation. In the future, we can entertain a
362+-- way of adding a speakernotes-specific note that would just add
363+-- paragraphs to the bottom of the notes page.
357364inlineToParElems (Note blks) = do
358− notes <- gets stNoteIds
359− let maxNoteId = case M.keys notes of
360− [] -> 0
361− lst -> maximum lst
362− curNoteId = maxNoteId + 1
363− modify $ \st -> st { stNoteIds = M.insert curNoteId blks notes }
364− local (\env -> env{envRunProps = (envRunProps env){rLink = Just $ InternalTarget endNotesSlideId}}) $
365− inlineToParElems $ Superscript [Str $ show curNoteId]
365+ inSpNotes <- asks envInSpeakerNotes
366+ if inSpNotes
367+ then return []
368+ else do
369+ notes <- gets stNoteIds
370+ let maxNoteId = case M.keys notes of
371+ [] -> 0
372+ lst -> maximum lst
373+ curNoteId = maxNoteId + 1
374+ modify $ \st -> st { stNoteIds = M.insert curNoteId blks notes }
375+ local (\env -> env{envRunProps = (envRunProps env){rLink = Just $ InternalTarget endNotesSlideId}}) $
376+ inlineToParElems $ Superscript [Str $ show curNoteId]
366377inlineToParElems (Span _ ils) = concatMapM inlineToParElems ils
367378inlineToParElems (RawInline _ _) = return []
368379inlineToParElems _ = return []
@@ -464,7 +475,8 @@ blockToParagraphs (DefinitionList entries) = do
464475 definition <- concatMapM (blockToParagraphs . BlockQuote) blksLst
465476 return $ term ++ definition
466477 concatMapM go entries
467−blockToParagraphs (Div (_, "notes" : [], _) blks) = do
478+blockToParagraphs (Div (_, "notes" : [], _) blks) =
479+ local (\env -> env{envInSpeakerNotes=True}) $ do
468480 sldId <- asks envCurSlideId
469481 spkNotesMap <- gets stSpeakerNotesMap
470482 paras <- concatMapM blockToParagraphs blks