diff options
| -rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint/Output.hs | 24 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint/Presentation.hs | 6 | ||||
| -rw-r--r-- | test/pptx/comparison/both-columns/templated.pptx | bin | 57662 -> 57667 bytes | |||
| -rw-r--r-- | test/pptx/comparison/extra-image/templated.pptx | bin | 57688 -> 57693 bytes | |||
| -rw-r--r-- | test/pptx/comparison/extra-text/templated.pptx | bin | 57662 -> 57667 bytes | |||
| -rw-r--r-- | test/pptx/comparison/non-text-first/templated.pptx | bin | 57553 -> 57553 bytes | |||
| -rw-r--r-- | test/pptx/comparison/one-column/templated.pptx | bin | 41000 -> 41004 bytes | |||
| -rw-r--r-- | test/pptx/footer/basic/output.pptx | bin | 52727 -> 52724 bytes | |||
| -rw-r--r-- | test/pptx/footer/fixed-date/output.pptx | bin | 51354 -> 51349 bytes | |||
| -rw-r--r-- | test/pptx/footer/higher-slide-number/output.pptx | bin | 52740 -> 52735 bytes | |||
| -rw-r--r-- | test/pptx/footer/no-title-slide/output.pptx | bin | 52314 -> 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 Binary files differindex 945bc6dc4..97e18b890 100644 --- a/test/pptx/comparison/both-columns/templated.pptx +++ b/test/pptx/comparison/both-columns/templated.pptx diff --git a/test/pptx/comparison/extra-image/templated.pptx b/test/pptx/comparison/extra-image/templated.pptx Binary files differindex 2e48ffe87..520baf1dc 100644 --- a/test/pptx/comparison/extra-image/templated.pptx +++ b/test/pptx/comparison/extra-image/templated.pptx diff --git a/test/pptx/comparison/extra-text/templated.pptx b/test/pptx/comparison/extra-text/templated.pptx Binary files differindex debb62d52..97e18b890 100644 --- a/test/pptx/comparison/extra-text/templated.pptx +++ b/test/pptx/comparison/extra-text/templated.pptx diff --git a/test/pptx/comparison/non-text-first/templated.pptx b/test/pptx/comparison/non-text-first/templated.pptx Binary files differindex a19b469b1..5e5981b9c 100644 --- a/test/pptx/comparison/non-text-first/templated.pptx +++ b/test/pptx/comparison/non-text-first/templated.pptx diff --git a/test/pptx/comparison/one-column/templated.pptx b/test/pptx/comparison/one-column/templated.pptx Binary files differindex fa5c2dc87..256093f8b 100644 --- a/test/pptx/comparison/one-column/templated.pptx +++ b/test/pptx/comparison/one-column/templated.pptx diff --git a/test/pptx/footer/basic/output.pptx b/test/pptx/footer/basic/output.pptx Binary files differindex 2af46108c..68ed4c732 100644 --- a/test/pptx/footer/basic/output.pptx +++ b/test/pptx/footer/basic/output.pptx diff --git a/test/pptx/footer/fixed-date/output.pptx b/test/pptx/footer/fixed-date/output.pptx Binary files differindex 678ecdb87..089de7a3a 100644 --- a/test/pptx/footer/fixed-date/output.pptx +++ b/test/pptx/footer/fixed-date/output.pptx diff --git a/test/pptx/footer/higher-slide-number/output.pptx b/test/pptx/footer/higher-slide-number/output.pptx Binary files differindex 651491107..36bb46833 100644 --- a/test/pptx/footer/higher-slide-number/output.pptx +++ b/test/pptx/footer/higher-slide-number/output.pptx diff --git a/test/pptx/footer/no-title-slide/output.pptx b/test/pptx/footer/no-title-slide/output.pptx Binary files differindex c470cbb94..843d7db40 100644 --- a/test/pptx/footer/no-title-slide/output.pptx +++ b/test/pptx/footer/no-title-slide/output.pptx |
