@@ -66,6 +66,7 @@ import Text.Pandoc.Slides (getSlideLevel)
66import Text.Pandoc.Options
66import Text.Pandoc.Options
67import Text.Pandoc.Logging
67import Text.Pandoc.Logging
68import Text.Pandoc.Walk
68import Text.Pandoc.Walk
69+import Text.Pandoc.Compat.Time (UTCTime)
69import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"
70import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"
70import Text.Pandoc.Writers.Shared (metaValueToInlines)
71import Text.Pandoc.Writers.Shared (metaValueToInlines)
71import qualified Data.Map as M
72import qualified Data.Map as M
@@ -161,9 +162,16 @@ concatMapM f xs = liftM concat (mapM f xs)
162type Pixels = Integer
163type Pixels = Integer
164−data Presentation = Presentation [Slide]
165+data Presentation = Presentation DocProps [Slide]
165 deriving (Show)
166 deriving (Show)
168+data DocProps = DocProps { dcTitle :: Maybe String
169+ , dcSubject :: Maybe String
170+ , dcCreator :: Maybe String
171+ , dcKeywords :: Maybe [String]
172+ , dcCreated :: Maybe UTCTime
173+ } deriving (Show, Eq)
168data Slide = Slide { slideId :: SlideId
176data Slide = Slide { slideId :: SlideId
169 , slideLayout :: Layout
177 , slideLayout :: Layout
@@ -796,8 +804,8 @@ replaceAnchor (Run rProps s)
796 return $ Run rProps' s
804 return $ Run rProps' s
797replaceAnchor pe = return pe
805replaceAnchor pe = return pe
799−blocksToPresentation :: [Block] -> Pres Presentation
807+blocksToPresentationSlides :: [Block] -> Pres [Slide]
800−blocksToPresentation blks = do
808+blocksToPresentationSlides blks = do
801 opts <- asks envOpts
809 opts <- asks envOpts
802 metadataslides <- maybeToList <$> getMetaSlide
810 metadataslides <- maybeToList <$> getMetaSlide
803 -- As far as I can tell, if we want to have a variable-length toc in
811 -- As far as I can tell, if we want to have a variable-length toc in
@@ -836,17 +844,36 @@ blocksToPresentation blks = do
836 return [endNotesSlide]
844 return [endNotesSlide]
838 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
846 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
839− slides' <- mapM (applyToSlide replaceAnchor) slides
847+ mapM (applyToSlide replaceAnchor) slides
840− return $ Presentation slides'
848+
849+metaToDocProps :: Meta -> DocProps
850+metaToDocProps meta =
851+ let keywords = case lookupMeta "keywords" meta of
852+ Just (MetaList xs) -> Just $ map Shared.stringify xs
855+ authors = case lookupMeta "author" meta of
856+ Just (MetaList xs) -> Just $ map Shared.stringify xs
859+ DocProps{ dcTitle = Shared.stringify <$> lookupMeta "title" meta
860+ , dcSubject = Shared.stringify <$> lookupMeta "subject" meta
861+ , dcCreator = (intercalate "; ") <$> authors
862+ , dcKeywords = keywords
863+ , dcCreated = Nothing
842documentToPresentation :: WriterOptions
866documentToPresentation :: WriterOptions
843 -> Pandoc
867 -> Pandoc
844 -> (Presentation, [LogMessage])
868 -> (Presentation, [LogMessage])
845−documentToPresentation opts (Pandoc meta blks) = do
869+documentToPresentation opts (Pandoc meta blks) =
846 let env = def { envOpts = opts
870 let env = def { envOpts = opts
847 , envMetadata = meta
871 , envMetadata = meta
848 , envSlideLevel = case writerSlideLevel opts of
872 , envSlideLevel = case writerSlideLevel opts of
849 Just lvl -> lvl
873 Just lvl -> lvl
850 Nothing -> getSlideLevel blks
874 Nothing -> getSlideLevel blks
852− runPres env def $ blocksToPresentation blks
876+ (presSlides, msgs) = runPres env def $ blocksToPresentationSlides blks
877+ docProps = metaToDocProps meta
879+ (Presentation docProps presSlides, msgs)