@@ -244,6 +244,14 @@ newtype PresentationBackground = PresentationBackground { unPresentationBackgrou
244244 deriving stock (Show , Eq )
245245 deriving newtype (Aeson.FromJSON , Aeson.ToJSON )
246246
247+ newtype PresentationHeader = PresentationHeader { unPresentationHeader :: T. Text }
248+ deriving stock (Show , Eq )
249+ deriving newtype (Aeson.FromJSON , Aeson.ToJSON )
250+
251+ newtype PresentationFooter = PresentationFooter { unPresentationFooter :: T. Text }
252+ deriving stock (Show , Eq )
253+ deriving newtype (Aeson.FromJSON , Aeson.ToJSON )
254+
247255-- SLIDES
248256
249257instance ToSchema Slide where
@@ -312,6 +320,8 @@ data PresentationInfo = PresentationInfo
312320 { presentationName :: PresentationName
313321 , presentationOwner :: UserId
314322 , presentationBackground :: Maybe PresentationBackground
323+ , presentationHeader :: Maybe PresentationHeader
324+ , presentationFooter :: Maybe PresentationFooter
315325 , presentationAttributes :: HMS. HashMap T. Text T. Text
316326 , presentationSlides :: [Slide ]
317327 , presentationDescription :: T. Text
@@ -331,6 +341,8 @@ instance FromJSONObject PresentationInfo where
331341 obj .: " name" <*>
332342 obj .: " owner_id" <*>
333343 obj .:? " background" <*>
344+ obj .:? " header" <*>
345+ obj .:? " footer" <*>
334346 obj .:? " attributes" .!= HMS. empty <*>
335347 obj .: " slides" <*>
336348 obj .: " description" <*>
@@ -1325,11 +1337,17 @@ type Tag = TagSoup.Tag T.Text
13251337processTags :: PresentationInfo -> [Tag ] -> [Tag ]
13261338processTags presentationInfo = concatMap $ \ case
13271339 TagSoup. TagOpen str (HMS. fromList -> attrs)
1340+ -- If the tag is 'deckgo-deck', we add the slides and the "background",
1341+ -- "header" and "footer" divs
13281342 | str == " deckgo-deck" -> do
13291343 [ TagSoup. TagOpen str (HMS. toList (presentationAttributes presentationInfo <> attrs)) ] <>
13301344 (concatMap slideTags (presentationSlides presentationInfo)) <>
13311345 (maybe [] presentationBackgroundTags
1332- (presentationBackground presentationInfo))
1346+ (presentationBackground presentationInfo)) <>
1347+ (maybe [] presentationHeaderTags
1348+ (presentationHeader presentationInfo)) <>
1349+ (maybe [] presentationFooterTags
1350+ (presentationFooter presentationInfo))
13331351 t -> [t]
13341352
13351353presentationBackgroundTags :: PresentationBackground -> [Tag ]
@@ -1339,6 +1357,20 @@ presentationBackgroundTags (unPresentationBackground -> bg) =
13391357 [ TagSoup. TagClose " div"
13401358 ]
13411359
1360+ presentationHeaderTags :: PresentationHeader -> [Tag ]
1361+ presentationHeaderTags (unPresentationHeader -> bg) =
1362+ [ TagSoup. TagOpen " div" (HMS. toList $ HMS. singleton " slot" " header" )
1363+ ] <> TagSoup. parseTags bg <>
1364+ [ TagSoup. TagClose " div"
1365+ ]
1366+
1367+ presentationFooterTags :: PresentationFooter -> [Tag ]
1368+ presentationFooterTags (unPresentationFooter -> bg) =
1369+ [ TagSoup. TagOpen " div" (HMS. toList $ HMS. singleton " slot" " footer" )
1370+ ] <> TagSoup. parseTags bg <>
1371+ [ TagSoup. TagClose " div"
1372+ ]
1373+
13421374slideTags :: Slide -> [Tag ]
13431375slideTags slide =
13441376 [ TagSoup. TagOpen
0 commit comments