From 9dd18ebf34ce14a900c947c2f039fb2aec51e6fc Mon Sep 17 00:00:00 2001 From: Mauro Bieg Date: Sun, 23 Oct 2016 21:42:33 +0200 Subject: ICML writer: replace partial function (!!) in table handling (#3175) --- src/Text/Pandoc/Writers/ICML.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs index 8f6123e20..125deb08c 100644 --- a/src/Text/Pandoc/Writers/ICML.hs +++ b/src/Text/Pandoc/Writers/ICML.hs @@ -323,13 +323,13 @@ blockToICML opts style (Table caption aligns widths headers rows) = else length $ head rows rowsToICML [] _ = return empty rowsToICML (col:rest) rowNr = - liftM2 ($$) (colsToICML col rowNr (0::Int)) $ rowsToICML rest (rowNr+1) - colsToICML [] _ _ = return empty - colsToICML (cell:rest) rowNr colNr = do + liftM2 ($$) (colsToICML col aligns rowNr (0::Int)) $ rowsToICML rest (rowNr+1) + colsToICML [] _ _ _ = return empty + colsToICML _ [] _ _ = return empty + colsToICML (cell:rest) (alig:restAligns) rowNr colNr = do let stl = if rowNr == 0 && not noHeader then tableHeaderName:style' else style' - alig = aligns !! colNr stl' | alig == AlignLeft = alignLeftName : stl | alig == AlignRight = alignRightName : stl | alig == AlignCenter = alignCenterName : stl @@ -337,7 +337,7 @@ blockToICML opts style (Table caption aligns widths headers rows) = c <- blocksToICML opts stl' cell let cl = return $ inTags True "Cell" [("Name", show colNr ++":"++ show rowNr), ("AppliedCellStyle","CellStyle/Cell")] c - liftM2 ($$) cl $ colsToICML rest rowNr (colNr+1) + liftM2 ($$) cl $ colsToICML rest restAligns rowNr (colNr+1) in do let tabl = if noHeader then rows -- cgit v1.2.3