git.iko.soy/typeable/pandoc
on master help sign in
Removed whitespace at ends of line.
commit935b16b38a710a26b06f0ae2ced5967429e010cc authorJohn MacFarlane <jgm@berkeley.edu> dateWed 13 Dec 2017, 20:48 (9 years ago) parent52a8116
4 files changed+42−42
src/Text/Pandoc/Class.hs+3−3 src/Text/Pandoc/Data.hs+1−1 src/Text/Pandoc/Writers/OOXML.hs+2−2 src/Text/Pandoc/Writers/Powerpoint.hs+36−36
src/Text/Pandoc/Class.hs+3−3
@@ -453,7 +453,7 @@ runIO :: PandocIO a -> IO (Either PandocError a)
453453runIO ma = flip evalStateT def $ runExceptT $ unPandocIO ma
454454
455455-- | Evaluate a 'PandocIO' operation, handling any errors
456−-- by exiting with an appropriate message and error status.
456+-- by exiting with an appropriate message and error status.
457457runIOorExplode :: PandocIO a -> IO a
458458runIOorExplode ma = runIO ma >>= handleError
459459
@@ -720,7 +720,7 @@ getDefaultReferencePptx = do
720720 epochtime <- (floor . utcTimeToPOSIXSeconds) <$> getCurrentTime
721721 contents <- toLazy <$> readDataFile ("pptx/" ++ path)
722722 return $ toEntry path epochtime contents
723− datadir <- getUserDataDir
723+ datadir <- getUserDataDir
724724 mbArchive <- case datadir of
725725 Nothing -> return Nothing
726726 Just d -> do
@@ -732,7 +732,7 @@ getDefaultReferencePptx = do
732732 Just arch -> toArchive <$> readFileLazy arch
733733 Nothing -> foldr addEntryToArchive emptyArchive <$>
734734 mapM pathToEntry paths
735−
735+
736736
737737-- | Read file from user data directory or,
738738-- if not found there, from Cabal data directory.
src/Text/Pandoc/Data.hs+1−1
@@ -18,5 +18,5 @@ dataFiles' = ("MANUAL.txt", $(embedFile "MANUAL.txt")) :
1818 -- handle the hidden file separately, since embedDir doesn't
1919 -- include it:
2020 ("docx/_rels/.rels", $(embedFile "data/docx/_rels/.rels")) :
21− ("pptx/_rels/.rels", $(embedFile "data/pptx/_rels/.rels")) :
21+ ("pptx/_rels/.rels", $(embedFile "data/pptx/_rels/.rels")) :
2222 $(embedDir "data")
src/Text/Pandoc/Writers/OOXML.hs+2−2
@@ -76,12 +76,12 @@ parseXml refArchive distArchive relpath =
7676 Nothing -> fail $ relpath ++ " corrupt in reference file"
7777 Just d -> return d
7878
79−-- Copied from Util
79+-- Copied from Util
8080
8181attrToNSPair :: XML.Attr -> Maybe (String, String)
8282attrToNSPair (XML.Attr (QName s _ (Just "xmlns")) val) = Just (s, val)
8383attrToNSPair _ = Nothing
84−
84+
8585
8686elemToNameSpaces :: Element -> NameSpaces
8787elemToNameSpaces = mapMaybe attrToNSPair . elAttribs
src/Text/Pandoc/Writers/Powerpoint.hs+36−36
@@ -174,7 +174,7 @@ getPageHeight :: PresentationSize -> Pixels
174174getPageHeight sz = case presSizeRatio sz of
175175 Ratio4x3 -> floor (((fromInteger (presSizeWidth sz)) / 4) * 3 :: Double)
176176 Ratio16x9 -> floor (((fromInteger (presSizeWidth sz)) / 16) * 9 :: Double)
177− Ratio16x10 -> floor (((fromInteger (presSizeWidth sz)) / 16) * 10 :: Double)
177+ Ratio16x10 -> floor (((fromInteger (presSizeWidth sz)) / 16) * 10 :: Double)
178178
179179instance Default PresentationSize where
180180 def = PresentationSize 720 Ratio4x3
@@ -183,7 +183,7 @@ data Slide = MetadataSlide { metadataSlideTitle :: [ParaElem]
183183 , metadataSlideSubtitle :: [ParaElem]
184184 , metadataSlideAuthors :: [[ParaElem]]
185185 , metadataSlideDate :: [ParaElem]
186− }
186+ }
187187 | TitleSlide { titleSlideHeader :: [ParaElem]}
188188 | ContentSlide { contentSlideHeader :: [ParaElem]
189189 , contentSlideContent :: [Shape]
@@ -206,7 +206,7 @@ data TableProps = TableProps { tblPrFirstRow :: Bool
206206
207207type ColWidth = Integer
208208
209−data Graphic = Tbl TableProps [ColWidth] [Cell] [[Cell]]
209+data Graphic = Tbl TableProps [ColWidth] [Cell] [[Cell]]
210210 deriving (Show, Eq)
211211
212212
@@ -217,7 +217,7 @@ data Paragraph = Paragraph { paraProps :: ParaProps
217217data HeaderType = TitleHeader | SlideHeader | InternalHeader Int
218218 deriving (Show, Eq)
219219
220−-- type StartingAt = Int
220+-- type StartingAt = Int
221221
222222-- data AutoNumType = ArabicNum
223223-- | AlphaUpperNum
@@ -362,7 +362,7 @@ blockToParagraphs (Plain ils) = do
362362 return [Paragraph pProps parElems]
363363blockToParagraphs (Para ils) = do
364364 parElems <- inlinesToParElems ils
365− pProps <- asks envParaProps
365+ pProps <- asks envParaProps
366366 return [Paragraph pProps parElems]
367367blockToParagraphs (LineBlock ilsList) = do
368368 parElems <- inlinesToParElems $ intercalate [LineBreak] ilsList
@@ -380,9 +380,9 @@ blockToParagraphs (BlockQuote blks) =
380380-- TODO: work out the format
381381blockToParagraphs (RawBlock _ _) = return []
382382 -- parElems <- inlinesToParElems [Str str]
383− -- paraProps <- asks envParaProps
383+ -- paraProps <- asks envParaProps
384384 -- return [Paragraph paraProps parElems]
385−-- TODO: work out the format
385+-- TODO: work out the format
386386blockToParagraphs (Header n _ ils) = do
387387 slideLevel <- asks envSlideLevel
388388 parElems <- inlinesToParElems ils
@@ -490,7 +490,7 @@ splitBlocks' cur acc (h@(Header n _ _) : blks) = do
490490 EQ -> splitBlocks' [h] (acc ++ (if null cur then [] else [cur])) blks
491491 GT -> splitBlocks' (cur ++ [h]) acc blks
492492splitBlocks' cur acc ((Para (img@(Image _ _ _):ils)) : blks) = do
493− slideLevel <- asks envSlideLevel
493+ slideLevel <- asks envSlideLevel
494494 case cur of
495495 (Header n _ _) : [] | n == slideLevel ->
496496 splitBlocks' []
@@ -500,7 +500,7 @@ splitBlocks' cur acc ((Para (img@(Image _ _ _):ils)) : blks) = do
500500 (acc ++ (if null cur then [] else [cur]) ++ [[Para [img]]])
501501 (if null ils then blks else (Para ils) : blks)
502502splitBlocks' cur acc ((Plain (img@(Image _ _ _):ils)) : blks) = do
503− slideLevel <- asks envSlideLevel
503+ slideLevel <- asks envSlideLevel
504504 case cur of
505505 (Header n _ _) : [] | n == slideLevel ->
506506 splitBlocks' []
@@ -510,7 +510,7 @@ splitBlocks' cur acc ((Plain (img@(Image _ _ _):ils)) : blks) = do
510510 (acc ++ (if null cur then [] else [cur]) ++ [[Para [img]]])
511511 (if null ils then blks else (Plain ils) : blks)
512512splitBlocks' cur acc (tbl@(Table _ _ _ _ _) : blks) = do
513− slideLevel <- asks envSlideLevel
513+ slideLevel <- asks envSlideLevel
514514 case cur of
515515 (Header n _ _) : [] | n == slideLevel ->
516516 splitBlocks' [] (acc ++ [cur ++ [tbl]]) blks
@@ -592,7 +592,7 @@ getMediaFiles = do
592592 distArchive <- asks envDistArchive
593593 let allEntries = nub $ filesInArchive refArchive ++ filesInArchive distArchive
594594 return $ filter (isPrefixOf "ppt/media") allEntries
595−
595+
596596
597597copyFileToArchiveIfExists :: PandocMonad m => Archive -> FilePath -> P m Archive
598598copyFileToArchiveIfExists arch fp = do
@@ -635,7 +635,7 @@ inheritedFiles = [ "_rels/.rels"
635635 -- , "ppt/slides/_rels/slide2.xml.rels"
636636 -- This is the one we're
637637 -- going to build
638− -- , "ppt/slides/slide2.xml"
638+ -- , "ppt/slides/slide2.xml"
639639 -- , "ppt/slides/slide1.xml"
640640 , "ppt/viewProps.xml"
641641 , "ppt/tableStyles.xml"
@@ -670,7 +670,7 @@ presentationToArchive p@(Presentation _ slides) = do
670670 slideEntries ++
671671 slideRelEntries ++
672672 mediaEntries ++
673− [contentTypesEntry, presEntry, presRelsEntry]
673+ [contentTypesEntry, presEntry, presRelsEntry]
674674
675675--------------------------------------------------
676676
@@ -726,25 +726,25 @@ shapeHasName ns name element
726726
727727-- getContentTitleShape :: NameSpaces -> Element -> Maybe Element
728728-- getContentTitleShape ns spTreeElem
729−-- | isElem ns "p" "spTree" spTreeElem =
729+-- | isElem ns "p" "spTree" spTreeElem =
730730-- filterChild (\e -> (isElem ns "p" "sp" e) && (shapeHasName ns "Title 1" e)) spTreeElem
731731-- | otherwise = Nothing
732732
733733-- getSubtitleShape :: NameSpaces -> Element -> Maybe Element
734734-- getSubtitleShape ns spTreeElem
735−-- | isElem ns "p" "spTree" spTreeElem =
735+-- | isElem ns "p" "spTree" spTreeElem =
736736-- filterChild (\e -> (isElem ns "p" "sp" e) && (shapeHasName ns "Subtitle 2" e)) spTreeElem
737737-- | otherwise = Nothing
738738
739739-- getDateShape :: NameSpaces -> Element -> Maybe Element
740740-- getDateShape ns spTreeElem
741−-- | isElem ns "p" "spTree" spTreeElem =
741+-- | isElem ns "p" "spTree" spTreeElem =
742742-- filterChild (\e -> (isElem ns "p" "sp" e) && (shapeHasName ns "Date Placeholder 3" e)) spTreeElem
743743-- | otherwise = Nothing
744−
744+
745745getContentShape :: NameSpaces -> Element -> Maybe Element
746746getContentShape ns spTreeElem
747− | isElem ns "p" "spTree" spTreeElem =
747+ | isElem ns "p" "spTree" spTreeElem =
748748 filterChild (\e -> (isElem ns "p" "sp" e) && (shapeHasName ns "Content Placeholder 2" e)) spTreeElem
749749 | otherwise = Nothing
750750
@@ -831,7 +831,7 @@ registerMedia fp caption = do
831831
832832 (imgBytes, mbMt) <- P.fetchItem fp
833833 let imgExt = (mbMt >>= extensionFromMimeType >>= (\x -> return $ '.':x))
834− <|>
834+ <|>
835835 case imageType imgBytes of
836836 Just Png -> Just ".png"
837837 Just Jpeg -> Just ".jpeg"
@@ -840,7 +840,7 @@ registerMedia fp caption = do
840840 Just Eps -> Just ".eps"
841841 Just Svg -> Just ".svg"
842842 Nothing -> Nothing
843−
843+
844844 let newGlobalId = case M.lookup fp globalIds of
845845 Just ident -> ident
846846 Nothing -> maxGlobalId + 1
@@ -893,7 +893,7 @@ fitToPage' (x, y) pageWidth pageHeight
893893 (floor x, floor y)
894894 | x / fromIntegral pageWidth > y / fromIntegral pageWidth =
895895 (pageWidth, floor $ ((fromIntegral pageWidth) / x) * y)
896− | otherwise =
896+ | otherwise =
897897 (floor $ ((fromIntegral pageHeight) / y) * x, pageHeight)
898898
899899positionImage :: (Double, Double) -> Integer -> Integer -> (Integer, Integer)
@@ -957,7 +957,7 @@ createCaption :: PandocMonad m => [ParaElem] -> P m Element
957957createCaption paraElements = do
958958 let para = Paragraph def{pPropAlign = Just AlgnCenter} paraElements
959959 elements <- mapM paragraphToElement [para]
960− let ((x, y), (cx, cy)) = captionPosition
960+ let ((x, y), (cx, cy)) = captionPosition
961961 let txBody = mknode "p:txBody" [] $
962962 [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] ++ elements
963963 return $
@@ -1041,7 +1041,7 @@ makePicElement mInfo attr = do
10411041 , blipFill
10421042 , spPr ]
10431043
1044−-- Currently hardcoded, until I figure out how to make it dynamic.
1044+-- Currently hardcoded, until I figure out how to make it dynamic.
10451045blockQuoteSize :: Pixels
10461046blockQuoteSize = 20
10471047
@@ -1150,7 +1150,7 @@ shapeToElement layout (TextBox paras)
11501150 [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] ++ elements
11511151 emptySpPr = mknode "p:spPr" [] ()
11521152 return $
1153− surroundWithMathAlternate $
1153+ surroundWithMathAlternate $
11541154 replaceNamedChildren ns "p" "txBody" [txBody] $
11551155 replaceNamedChildren ns "p" "spPr" [emptySpPr] $
11561156 sp
@@ -1199,7 +1199,7 @@ shapesToElements layout shps = do
11991199
12001200hardcodedTableMargin :: Integer
12011201hardcodedTableMargin = 36
1202−
1202+
12031203
12041204graphicToElement :: PandocMonad m => Graphic -> P m Element
12051205graphicToElement (Tbl tblPr colWidths hdrCells rows) = do
@@ -1241,7 +1241,7 @@ graphicToElement (Tbl tblPr colWidths hdrCells rows) = do
12411241
12421242getShapeByName :: NameSpaces -> Element -> String -> Maybe Element
12431243getShapeByName ns spTreeElem name
1244− | isElem ns "p" "spTree" spTreeElem =
1244+ | isElem ns "p" "spTree" spTreeElem =
12451245 filterChild (\e -> (isElem ns "p" "sp" e) && (shapeHasName ns name e)) spTreeElem
12461246 | otherwise = Nothing
12471247
@@ -1266,7 +1266,7 @@ nonBodyTextToElement layout shapeName paraElements
12661266-- | ns <- elemToNameSpaces layout
12671267-- , Just cSld <- findChild (elemName ns "p" "cSld") layout
12681268-- , Just spTree <- findChild (elemName ns "p" "spTree") cSld
1269−-- , Just sp <- getContentTitleShape ns spTree =
1269+-- , Just sp <- getContentTitleShape ns spTree =
12701270-- let hdrPara = Paragraph def paraElems
12711271-- txBody = mknode "p:txBody" [] $
12721272-- [mknode "a:bodyPr" [] (), mknode "a:lstStyle" [] ()] ++
@@ -1387,7 +1387,7 @@ elementToRel element
13871387
13881388slideToPresRel :: Monad m => Slide -> Int -> P m Relationship
13891389slideToPresRel slide idNum = do
1390− n <- gets stSlideIdOffset
1390+ n <- gets stSlideIdOffset
13911391 let rId = idNum + n
13921392 fp = "slides/" ++ slideToFilePath slide idNum
13931393 return $ Relationship { relId = rId
@@ -1429,7 +1429,7 @@ presentationToRels (Presentation _ slides) = do
14291429 modifyRelNum n = n - minRelNotOne + 2 + length slides
14301430
14311431 relsWithoutSlides' = map (\r -> r{relId = modifyRelNum $ relId r}) relsWithoutSlides
1432−
1432+
14331433 return $ mySlideRels ++ relsWithoutSlides'
14341434
14351435relToElement :: Relationship -> Element
@@ -1479,7 +1479,7 @@ mediaRelElement mInfo =
14791479 let ext = case mInfoExt mInfo of
14801480 Just e -> e
14811481 Nothing -> ""
1482− in
1482+ in
14831483 mknode "Relationship" [ ("Id", "rId" ++ (show $ mInfoLocalId mInfo))
14841484 , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")
14851485 , ("Target", "../media/image" ++ (show $ mInfoGlobalId mInfo) ++ ext)
@@ -1503,7 +1503,7 @@ slideToSlideRelElement slide idNum = do
15031503 Nothing -> []
15041504
15051505 return $
1506− mknode "Relationships"
1506+ mknode "Relationships"
15071507 [("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships")]
15081508 ([mknode "Relationship" [ ("Id", "rId1")
15091509 , ("Type", "http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout")
@@ -1546,9 +1546,9 @@ presentationToPresentationElement pres = do
15461546presentationToPresEntry :: PandocMonad m => Presentation -> P m Entry
15471547presentationToPresEntry pres = presentationToPresentationElement pres >>=
15481548 elemToEntry "ppt/presentation.xml"
1549−
15501549
1551−
1550+
1551+
15521552
15531553defaultContentTypeToElem :: DefaultContentType -> Element
15541554defaultContentTypeToElem dct =
@@ -1558,7 +1558,7 @@ defaultContentTypeToElem dct =
15581558 ()
15591559
15601560overrideContentTypeToElem :: OverrideContentType -> Element
1561−overrideContentTypeToElem oct =
1561+overrideContentTypeToElem oct =
15621562 mknode "Override"
15631563 [("PartName", overrideContentTypesPart oct),
15641564 ("ContentType", overrideContentTypesType oct)]
@@ -1571,7 +1571,7 @@ contentTypesToElement ct =
15711571 mknode "Types" [("xmlns", ns)] $
15721572 (map defaultContentTypeToElem $ contentTypesDefaults ct) ++
15731573 (map overrideContentTypeToElem $ contentTypesOverrides ct)
1574−
1574+
15751575data DefaultContentType = DefaultContentType
15761576 { defContentTypesExt :: String
15771577 , defContentTypesType:: MimeType
@@ -1634,7 +1634,7 @@ presML = "application/vnd.openxmlformats-officedocument.presentationml"
16341634
16351635noPresML :: String
16361636noPresML = "application/vnd.openxmlformats-officedocument"
1637−
1637+
16381638getContentType :: FilePath -> Maybe MimeType
16391639getContentType fp
16401640 | fp == "ppt/presentation.xml" = Just $ presML ++ ".presentation.main+xml"