summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Output.hs24
-rw-r--r--src/Text/Pandoc/Writers/Powerpoint/Presentation.hs6
-rw-r--r--test/pptx/comparison/both-columns/templated.pptxbin57662 -> 57667 bytes
-rw-r--r--test/pptx/comparison/extra-image/templated.pptxbin57688 -> 57693 bytes
-rw-r--r--test/pptx/comparison/extra-text/templated.pptxbin57662 -> 57667 bytes
-rw-r--r--test/pptx/comparison/non-text-first/templated.pptxbin57553 -> 57553 bytes
-rw-r--r--test/pptx/comparison/one-column/templated.pptxbin41000 -> 41004 bytes
-rw-r--r--test/pptx/footer/basic/output.pptxbin52727 -> 52724 bytes
-rw-r--r--test/pptx/footer/fixed-date/output.pptxbin51354 -> 51349 bytes
-rw-r--r--test/pptx/footer/higher-slide-number/output.pptxbin52740 -> 52735 bytes
-rw-r--r--test/pptx/footer/no-title-slide/output.pptxbin52314 -> 52309 bytes
11 files changed, 15 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Output.hs b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
index 0f06dee0d..63e145cee 100644
--- a/src/Text/Pandoc/Writers/Powerpoint/Output.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Output.hs
@@ -1411,19 +1411,19 @@ getDefaultTableStyle = do
return $ findAttr (QName "def" Nothing Nothing) tblStyleLst
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) $
+graphicToElement tableWidth (Tbl widths tblPr hdrCells rows) = do
+ let totalWidth = sum widths
+ let colWidths = if any (== 0.0) widths
+ then if null hdrCells
+ then case rows of
+ r@(_:_) : _ -> replicate (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) $
- tableWidth `div` toInteger (length hdrCells)
-
+ []: _ -> []
+ [] -> []
+ else replicate (length hdrCells) $
+ tableWidth `div` toInteger (length hdrCells)
+ else map (\w -> round $ w / totalWidth * fromIntegral tableWidth) widths
+
let cellToOpenXML paras =
do elements <- mapM paragraphToElement paras
let elements' = if null elements
diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
index dc1d54637..f3f00da50 100644
--- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
+++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs
@@ -244,7 +244,7 @@ data TableProps = TableProps { tblPrFirstRow :: Bool
, tblPrBandRow :: Bool
} deriving (Show, Eq)
-data Graphic = Tbl TableProps [TableCell] [[TableCell]]
+data Graphic = Tbl [Double] TableProps [TableCell] [[TableCell]]
deriving (Show, Eq)
@@ -601,7 +601,7 @@ blockToShape (Para (il:_)) | Link _ (il':_) target <- il
<$> inlinesToParElems ils
blockToShape (Figure _figattr _caption [b]) = blockToShape b
blockToShape (Table _ blkCapt specs thead tbody tfoot) = do
- let (caption, algn, _, hdrCells, rows) = toLegacyTable blkCapt specs thead tbody tfoot
+ let (caption, algn, widths, hdrCells, rows) = toLegacyTable blkCapt specs thead tbody tfoot
caption' <- inlinesToParElems caption
hdrCells' <- rowToParagraphs algn hdrCells
rows' <- mapM (rowToParagraphs algn) rows
@@ -613,7 +613,7 @@ blockToShape (Table _ blkCapt specs thead tbody tfoot) = do
, tblPrBandRow = True
}
- return $ GraphicFrame [Tbl tblPr hdrCells' rows'] caption'
+ return $ GraphicFrame [Tbl widths tblPr hdrCells' rows'] caption'
-- If the format isn't openxml, we fall through to blockToPargraphs
blockToShape (RawBlock (Format "openxml") str) = return $ RawOOXMLShape str
blockToShape blk = do paras <- blockToParagraphs blk
diff --git a/test/pptx/comparison/both-columns/templated.pptx b/test/pptx/comparison/both-columns/templated.pptx
index 945bc6dc4..97e18b890 100644
--- a/test/pptx/comparison/both-columns/templated.pptx
+++ b/test/pptx/comparison/both-columns/templated.pptx
Binary files differ
diff --git a/test/pptx/comparison/extra-image/templated.pptx b/test/pptx/comparison/extra-image/templated.pptx
index 2e48ffe87..520baf1dc 100644
--- a/test/pptx/comparison/extra-image/templated.pptx
+++ b/test/pptx/comparison/extra-image/templated.pptx
Binary files differ
diff --git a/test/pptx/comparison/extra-text/templated.pptx b/test/pptx/comparison/extra-text/templated.pptx
index debb62d52..97e18b890 100644
--- a/test/pptx/comparison/extra-text/templated.pptx
+++ b/test/pptx/comparison/extra-text/templated.pptx
Binary files differ
diff --git a/test/pptx/comparison/non-text-first/templated.pptx b/test/pptx/comparison/non-text-first/templated.pptx
index a19b469b1..5e5981b9c 100644
--- a/test/pptx/comparison/non-text-first/templated.pptx
+++ b/test/pptx/comparison/non-text-first/templated.pptx
Binary files differ
diff --git a/test/pptx/comparison/one-column/templated.pptx b/test/pptx/comparison/one-column/templated.pptx
index fa5c2dc87..256093f8b 100644
--- a/test/pptx/comparison/one-column/templated.pptx
+++ b/test/pptx/comparison/one-column/templated.pptx
Binary files differ
diff --git a/test/pptx/footer/basic/output.pptx b/test/pptx/footer/basic/output.pptx
index 2af46108c..68ed4c732 100644
--- a/test/pptx/footer/basic/output.pptx
+++ b/test/pptx/footer/basic/output.pptx
Binary files differ
diff --git a/test/pptx/footer/fixed-date/output.pptx b/test/pptx/footer/fixed-date/output.pptx
index 678ecdb87..089de7a3a 100644
--- a/test/pptx/footer/fixed-date/output.pptx
+++ b/test/pptx/footer/fixed-date/output.pptx
Binary files differ
diff --git a/test/pptx/footer/higher-slide-number/output.pptx b/test/pptx/footer/higher-slide-number/output.pptx
index 651491107..36bb46833 100644
--- a/test/pptx/footer/higher-slide-number/output.pptx
+++ b/test/pptx/footer/higher-slide-number/output.pptx
Binary files differ
diff --git a/test/pptx/footer/no-title-slide/output.pptx b/test/pptx/footer/no-title-slide/output.pptx
index c470cbb94..843d7db40 100644
--- a/test/pptx/footer/no-title-slide/output.pptx
+++ b/test/pptx/footer/no-title-slide/output.pptx
Binary files differ