aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Textile.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/Textile.hs')
-rw-r--r--src/Text/Pandoc/Writers/Textile.hs76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/Text/Pandoc/Writers/Textile.hs b/src/Text/Pandoc/Writers/Textile.hs
index d2cb74c84..e68303cfe 100644
--- a/src/Text/Pandoc/Writers/Textile.hs
+++ b/src/Text/Pandoc/Writers/Textile.hs
@@ -168,44 +168,44 @@ blockToTextile opts (BlockQuote blocks) = do
contents <- blockListToTextile opts blocks
return $ "<blockquote>\n\n" <> contents <> "\n</blockquote>\n"
-blockToTextile opts (Table [] aligns widths headers rows') |
- all (==0) widths = do
- hs <- mapM (liftM (("_. " <>) . stripTrailingNewlines) . blockListToTextile opts) headers
- let cellsToRow cells = "|" <> T.intercalate "|" cells <> "|"
- let header = if all null headers then "" else cellsToRow hs <> "\n"
- let blocksToCell (align, bs) = do
- contents <- stripTrailingNewlines <$> blockListToTextile opts bs
- let alignMarker = case align of
- AlignLeft -> "<. "
- AlignRight -> ">. "
- AlignCenter -> "=. "
- AlignDefault -> ""
- return $ alignMarker <> contents
- let rowToCells = mapM blocksToCell . zip aligns
- bs <- mapM rowToCells rows'
- let body = T.unlines $ map cellsToRow bs
- return $ header <> body
-
-blockToTextile opts (Table capt aligns widths headers rows') = do
- let alignStrings = map alignmentToText aligns
- captionDoc <- if null capt
- then return ""
- else do
- c <- inlineListToTextile opts capt
- return $ "<caption>" <> c <> "</caption>\n"
- let percent w = tshow (truncate (100*w) :: Integer) <> "%"
- let coltags = if all (== 0.0) widths
- then ""
- else T.unlines $ map
- (\w -> "<col width=\"" <> percent w <> "\" />") widths
- head' <- if all null headers
- then return ""
- else do
- hs <- tableRowToTextile opts alignStrings 0 headers
- return $ "<thead>\n" <> hs <> "\n</thead>\n"
- body' <- zipWithM (tableRowToTextile opts alignStrings) [1..] rows'
- return $ "<table>\n" <> captionDoc <> coltags <> head' <>
- "<tbody>\n" <> T.unlines body' <> "</tbody>\n</table>\n"
+blockToTextile opts (Table _ blkCapt specs thead tbody tfoot)
+ = case toLegacyTable blkCapt specs thead tbody tfoot of
+ ([], aligns, widths, headers, rows') | all (==0) widths -> do
+ hs <- mapM (liftM (("_. " <>) . stripTrailingNewlines) . blockListToTextile opts) headers
+ let cellsToRow cells = "|" <> T.intercalate "|" cells <> "|"
+ let header = if all null headers then "" else cellsToRow hs <> "\n"
+ let blocksToCell (align, bs) = do
+ contents <- stripTrailingNewlines <$> blockListToTextile opts bs
+ let alignMarker = case align of
+ AlignLeft -> "<. "
+ AlignRight -> ">. "
+ AlignCenter -> "=. "
+ AlignDefault -> ""
+ return $ alignMarker <> contents
+ let rowToCells = mapM blocksToCell . zip aligns
+ bs <- mapM rowToCells rows'
+ let body = T.unlines $ map cellsToRow bs
+ return $ header <> body
+ (capt, aligns, widths, headers, rows') -> do
+ let alignStrings = map alignmentToText aligns
+ captionDoc <- if null capt
+ then return ""
+ else do
+ c <- inlineListToTextile opts capt
+ return $ "<caption>" <> c <> "</caption>\n"
+ let percent w = tshow (truncate (100*w) :: Integer) <> "%"
+ let coltags = if all (== 0.0) widths
+ then ""
+ else T.unlines $ map
+ (\w -> "<col width=\"" <> percent w <> "\" />") widths
+ head' <- if all null headers
+ then return ""
+ else do
+ hs <- tableRowToTextile opts alignStrings 0 headers
+ return $ "<thead>\n" <> hs <> "\n</thead>\n"
+ body' <- zipWithM (tableRowToTextile opts alignStrings) [1..] rows'
+ return $ "<table>\n" <> captionDoc <> coltags <> head' <>
+ "<tbody>\n" <> T.unlines body' <> "</tbody>\n</table>\n"
blockToTextile opts x@(BulletList items) = do
oldUseTags <- gets stUseTags