@@ -66,6 +66,7 @@ import Text.Pandoc.Slides (getSlideLevel)
6666import Text.Pandoc.Options
6767import Text.Pandoc.Logging
6868import Text.Pandoc.Walk
69+import Text.Pandoc.Compat.Time (UTCTime)
6970import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"
7071import Text.Pandoc.Writers.Shared (metaValueToInlines)
7172import qualified Data.Map as M
@@ -161,9 +162,16 @@ concatMapM f xs = liftM concat (mapM f xs)
161162
162163type Pixels = Integer
163164
164−data Presentation = Presentation [Slide]
165+data Presentation = Presentation DocProps [Slide]
165166 deriving (Show)
166167
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)
174+
167175
168176data Slide = Slide { slideId :: SlideId
169177 , slideLayout :: Layout
@@ -796,8 +804,8 @@ replaceAnchor (Run rProps s)
796804 return $ Run rProps' s
797805replaceAnchor pe = return pe
798806
799−blocksToPresentation :: [Block] -> Pres Presentation
800−blocksToPresentation blks = do
807+blocksToPresentationSlides :: [Block] -> Pres [Slide]
808+blocksToPresentationSlides blks = do
801809 opts <- asks envOpts
802810 metadataslides <- maybeToList <$> getMetaSlide
803811 -- As far as I can tell, if we want to have a variable-length toc in
@@ -836,17 +844,36 @@ blocksToPresentation blks = do
836844 return [endNotesSlide]
837845
838846 let slides = metadataslides ++ tocSlides ++ bodyslides ++ endNotesSlides
839− slides' <- mapM (applyToSlide replaceAnchor) slides
840− return $ Presentation slides'
847+ mapM (applyToSlide replaceAnchor) 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
853+ _ -> Nothing
854+
855+ authors = case lookupMeta "author" meta of
856+ Just (MetaList xs) -> Just $ map Shared.stringify xs
857+ _ -> Nothing
858+ in
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
864+ }
841865
842866documentToPresentation :: WriterOptions
843867 -> Pandoc
844868 -> (Presentation, [LogMessage])
845−documentToPresentation opts (Pandoc meta blks) = do
869+documentToPresentation opts (Pandoc meta blks) =
846870 let env = def { envOpts = opts
847871 , envMetadata = meta
848872 , envSlideLevel = case writerSlideLevel opts of
849873 Just lvl -> lvl
850874 Nothing -> getSlideLevel blks
851875 }
852− runPres env def $ blocksToPresentation blks
876+ (presSlides, msgs) = runPres env def $ blocksToPresentationSlides blks
877+ docProps = metaToDocProps meta
878+ in
879+ (Presentation docProps presSlides, msgs)