summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJesse Rosenthal <jrosenthal@jhu.edu>2018-01-15 15:51:58 -0500
committerJesse Rosenthal <jrosenthal@jhu.edu>2018-01-15 15:51:58 -0500
commitc6a55f8e9f189d2cda279ff2ee5f17e516490942 (patch)
treec2f34aa1219c5a2b33ae8820f6a5e03f57c71cea /src/Text/Pandoc/Writers
parente408ae6278482b67c8995ebbc7239c30bdf480d1 (diff)
Powerpoint writer: Improve table placement.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Output.hs14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
index 68f3991ea..95dccb655 100644
--- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
@@ -842,9 +842,6 @@ shapesToElements :: PandocMonad m => Element -> [Shape] -> P m [Element]
shapesToElements layout shps = do
concat <$> mapM (shapeToElements layout) shps
-hardcodedTableMargin :: Integer
-hardcodedTableMargin = 36
-
graphicFrameToElements :: PandocMonad m => Element -> [Graphic] -> [ParaElem] -> P m [Element]
graphicFrameToElements layout tbls caption = do
-- get the sizing
@@ -857,7 +854,7 @@ graphicFrameToElements layout tbls caption = do
let cy = if (not $ null caption) then cytmp - captionHeight else cytmp
- elements <- mapM graphicToElement tbls
+ elements <- mapM (graphicToElement cx) tbls
let graphicFrameElts =
mknode "p:graphicFrame" [] $
[ mknode "p:nvGraphicFramePr" [] $
@@ -878,20 +875,19 @@ graphicFrameToElements layout tbls caption = do
return [graphicFrameElts, capElt]
else return [graphicFrameElts]
-graphicToElement :: PandocMonad m => Graphic -> P m Element
-graphicToElement (Tbl tblPr hdrCells rows) = do
- (pageWidth, _) <- asks envPresentationSize
+graphicToElement :: PandocMonad m => Integer -> Graphic -> P m Element
+graphicToElement tableWidth (Tbl tblPr hdrCells rows) = do
let colWidths = if null hdrCells
then case rows of
r : _ | not (null r) -> replicate (length r) $
- (pageWidth - (2 * hardcodedTableMargin))`div` (toInteger $ length r)
+ (tableWidth `div` (toInteger $ length r))
-- satisfy the compiler. This is the same as
-- saying that rows is empty, but the compiler
-- won't understand that `[]` exhausts the
-- alternatives.
_ -> []
else replicate (length hdrCells) $
- (pageWidth - (2 * hardcodedTableMargin)) `div` (toInteger $ length hdrCells)
+ (tableWidth `div` (toInteger $ length hdrCells))
let cellToOpenXML paras =
do elements <- mapM paragraphToElement paras