aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Powerpoint
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2019-04-05 12:05:08 -0400
committerJesse Rosenthal <jrosenthal@jhu.edu>2019-04-05 12:05:08 -0400
commitba7898bb3dae98c14ae824eab3129f22a70e6bd3 (patch)
treecd52d3c5041eb8b4c074bed92a7ff01e073a7dfa /src/Text/Pandoc/Writers/Powerpoint
parentb99188c44c448bf4a61265663512771cfd98271f (diff)
downloadpandoc-ba7898bb3dae98c14ae824eab3129f22a70e6bd3.tar.gz
PowerPoint writer code style fix
I had been using record syntax in an ADT, is bad style, since it means that each record produces a partial function. Fortunately we weren't using the partial functions anywhere, so this changes it to positional syntax.
Diffstat (limited to 'src/Text/Pandoc/Writers/Powerpoint')
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Presentation.hs44
1 files changed, 14 insertions, 30 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
index c57849532..ae36c961c 100644
--- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
@@ -183,20 +183,15 @@ newtype SlideId = SlideId String
newtype SpeakerNotes = SpeakerNotes {fromSpeakerNotes :: [Paragraph]}
deriving (Show, Eq, Monoid, Semigroup)
-data Layout = MetadataSlide { metadataSlideTitle :: [ParaElem]
- , metadataSlideSubtitle :: [ParaElem]
- , metadataSlideAuthors :: [[ParaElem]]
- , metadataSlideDate :: [ParaElem]
- }
- | TitleSlide { titleSlideHeader :: [ParaElem]}
- | ContentSlide { contentSlideHeader :: [ParaElem]
- , contentSlideContent :: [Shape]
- }
- | TwoColumnSlide { twoColumnSlideHeader :: [ParaElem]
- , twoColumnSlideLeft :: [Shape]
- , twoColumnSlideRight :: [Shape]
- }
- deriving (Show, Eq)
+data Layout = MetadataSlide [ParaElem] [ParaElem] [[ParaElem]] [ParaElem]
+ -- title subtitle authors date
+ | TitleSlide [ParaElem]
+ -- heading
+ | ContentSlide [ParaElem] [Shape]
+ -- heading content
+ | TwoColumnSlide [ParaElem] [Shape] [Shape]
+ -- heading left right
+ deriving (Show, Eq)
data Shape = Pic PicProps FilePath [ParaElem]
| GraphicFrame [Graphic] [ParaElem]
@@ -621,7 +616,7 @@ blocksToSlide' lvl (Header n (ident, _, _) ils : blks) spkNotes
registerAnchorId ident
sldId <- asks envCurSlideId
hdr <- inlinesToParElems ils
- return $ Slide sldId TitleSlide {titleSlideHeader = hdr} spkNotes
+ return $ Slide sldId (TitleSlide hdr) spkNotes
| n == lvl = do
registerAnchorId ident
hdr <- inlinesToParElems ils
@@ -652,10 +647,7 @@ blocksToSlide' _ (blk : blks) spkNotes
sldId <- asks envCurSlideId
return $ Slide
sldId
- TwoColumnSlide { twoColumnSlideHeader = []
- , twoColumnSlideLeft = shapesL
- , twoColumnSlideRight = shapesR
- }
+ (TwoColumnSlide [] shapesL shapesR)
spkNotes
blocksToSlide' _ (blk : blks) spkNotes = do
inNoteSlide <- asks envInNoteSlide
@@ -666,18 +658,14 @@ blocksToSlide' _ (blk : blks) spkNotes = do
return $
Slide
sldId
- ContentSlide { contentSlideHeader = []
- , contentSlideContent = shapes
- }
+ (ContentSlide [] shapes)
spkNotes
blocksToSlide' _ [] spkNotes = do
sldId <- asks envCurSlideId
return $
Slide
sldId
- ContentSlide { contentSlideHeader = []
- , contentSlideContent = []
- }
+ (ContentSlide [] [])
spkNotes
blockToSpeakerNotes :: Block -> Pres SpeakerNotes
@@ -756,11 +744,7 @@ getMetaSlide = do
Just $
Slide
metadataSlideId
- MetadataSlide { metadataSlideTitle = title
- , metadataSlideSubtitle = subtitle
- , metadataSlideAuthors = authors
- , metadataSlideDate = date
- }
+ (MetadataSlide title subtitle authors date)
mempty
addSpeakerNotesToMetaSlide :: Slide -> [Block] -> Pres (Slide, [Block])