git.iko.soy/typeable/pandoc
on master help sign in
ICML writer: replace partial function (!!) in table handling (#3175)
commit9dd18ebf34ce14a900c947c2f039fb2aec51e6fc authorMauro Bieg <mb21@users.noreply.github.com> dateSun 23 Oct 2016, 21:42 (10 years ago) parent1d15f0e
1 file changed+5−5
src/Text/Pandoc/Writers/ICML.hs+5−5
src/Text/Pandoc/Writers/ICML.hs+5−5
@@ -323,13 +323,13 @@ blockToICML opts style (Table caption aligns widths headers rows) =
323323 else length $ head rows
324324 rowsToICML [] _ = return empty
325325 rowsToICML (col:rest) rowNr =
326− liftM2 ($$) (colsToICML col rowNr (0::Int)) $ rowsToICML rest (rowNr+1)
327− colsToICML [] _ _ = return empty
328− colsToICML (cell:rest) rowNr colNr = do
326+ liftM2 ($$) (colsToICML col aligns rowNr (0::Int)) $ rowsToICML rest (rowNr+1)
327+ colsToICML [] _ _ _ = return empty
328+ colsToICML _ [] _ _ = return empty
329+ colsToICML (cell:rest) (alig:restAligns) rowNr colNr = do
329330 let stl = if rowNr == 0 && not noHeader
330331 then tableHeaderName:style'
331332 else style'
332− alig = aligns !! colNr
333333 stl' | alig == AlignLeft = alignLeftName : stl
334334 | alig == AlignRight = alignRightName : stl
335335 | alig == AlignCenter = alignCenterName : stl
@@ -337,7 +337,7 @@ blockToICML opts style (Table caption aligns widths headers rows) =
337337 c <- blocksToICML opts stl' cell
338338 let cl = return $ inTags True "Cell"
339339 [("Name", show colNr ++":"++ show rowNr), ("AppliedCellStyle","CellStyle/Cell")] c
340− liftM2 ($$) cl $ colsToICML rest rowNr (colNr+1)
340+ liftM2 ($$) cl $ colsToICML rest restAligns rowNr (colNr+1)
341341 in do
342342 let tabl = if noHeader
343343 then rows