mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 17:20:47 +08:00
pptx writer: Handle single column
Add an additional guard for a single column to be able to process it.
This commit is contained in:
committed by
John MacFarlane
parent
347fbb1ab2
commit
6ba552232a
@@ -727,6 +727,7 @@ bodyBlocksToSlide _ (blk : blks) spkNotes
|
||||
, "columns" `elem` classes
|
||||
, Div (_, clsL, _) blksL : Div (_, clsR, _) blksR : remaining <- divBlks
|
||||
, "column" `elem` clsL, "column" `elem` clsR = do
|
||||
-- At least 2 column elements
|
||||
mapM_ (addLogMessage . BlockNotRendered) (blks ++ remaining)
|
||||
let mkTwoColumn left right = do
|
||||
blksL' <- join . take 1 <$> splitBlocks left
|
||||
@@ -755,6 +756,16 @@ bodyBlocksToSlide _ (blk : blks) spkNotes
|
||||
if (any null [blksL1, blksL2]) && (any null [blksR1, blksR2])
|
||||
then mkTwoColumn blksL blksR
|
||||
else mkComparison blksL1 blksL2 blksR1 blksR2
|
||||
| Div (_, classes, _) divBlks <- blk
|
||||
, "columns" `elem` classes
|
||||
, Div (_, cls, _) columnBlks : remaining <- divBlks
|
||||
, "column" `elem` cls = do
|
||||
-- Only 1 column element.
|
||||
mapM_ (addLogMessage . BlockNotRendered) (blks ++ remaining)
|
||||
clBlks' <- join . take 1 <$> splitBlocks columnBlks
|
||||
shapes <- blocksToShapes clBlks'
|
||||
sldId <- asks envCurSlideId
|
||||
return $ Slide sldId (ContentSlide [] shapes) spkNotes Nothing
|
||||
bodyBlocksToSlide _ (blk : blks) spkNotes = do
|
||||
sldId <- asks envCurSlideId
|
||||
inNoteSlide <- asks envInNoteSlide
|
||||
|
||||
@@ -102,6 +102,14 @@ tests = let
|
||||
def
|
||||
"pptx/two-column/text-and-image/input.native"
|
||||
"pptx/two-column/text-and-image/output.pptx"
|
||||
, pptxTests "single column text"
|
||||
def
|
||||
"pptx/single-column/text/input.native"
|
||||
"pptx/single-column/text/output.pptx"
|
||||
, pptxTests "single column image"
|
||||
def
|
||||
"pptx/single-column/image/input.native"
|
||||
"pptx/single-column/image/output.pptx"
|
||||
, pptxTests "speaker notes"
|
||||
def
|
||||
"pptx/speaker-notes/input.native"
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
[ Header
|
||||
1
|
||||
( "single-column" , [] , [] )
|
||||
[ Str "Single" , Space , Str "column" ]
|
||||
, Div
|
||||
( "" , [ "columns" ] , [] )
|
||||
[ Div
|
||||
( "" , [ "column" ] , [] )
|
||||
[ Figure
|
||||
( "" , [] , [] )
|
||||
(Caption
|
||||
Nothing [ Plain [ Str "an" , Space , Str "image" ] ])
|
||||
[ Plain
|
||||
[ Image
|
||||
( "" , [] , [] )
|
||||
[ Str "an" , Space , Str "image" ]
|
||||
( "lalune.jpg" , "" )
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
[ Header
|
||||
1
|
||||
( "single-column" , [] , [] )
|
||||
[ Str "Single" , Space , Str "column" ]
|
||||
, Div
|
||||
( "" , [ "columns" ] , [] )
|
||||
[ Div
|
||||
( "" , [ "column" ] , [] )
|
||||
[ Para [ Str "One" , Space , Str "paragraph." ]
|
||||
, Para [ Str "Another" , Space , Str "paragraph." ]
|
||||
]
|
||||
]
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user