aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/Native.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Pandoc/Writers/Native.hs')
-rw-r--r--src/Text/Pandoc/Writers/Native.hs33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/Native.hs b/src/Text/Pandoc/Writers/Native.hs
index 1c4719fe9..a533496c1 100644
--- a/src/Text/Pandoc/Writers/Native.hs
+++ b/src/Text/Pandoc/Writers/Native.hs
@@ -40,12 +40,33 @@ prettyBlock (DefinitionList items) = "DefinitionList" $$
prettyList (map deflistitem items)
where deflistitem (term, defs) = "(" <> text (show term) <> "," <> cr <>
nest 1 (prettyList $ map (prettyList . map prettyBlock) defs) <> ")"
-prettyBlock (Table caption aligns widths header rows) =
- "Table " <> text (show caption) <> " " <> text (show aligns) <> " " <>
- text (show widths) $$
- prettyRow header $$
- prettyList (map prettyRow rows)
- where prettyRow cols = prettyList (map (prettyList . map prettyBlock) cols)
+prettyBlock (Table attr blkCapt specs rhs thead tbody tfoot) =
+ mconcat [ "Table "
+ , text (show attr)
+ , " "
+ , prettyCaption blkCapt
+ , " "
+ , text (show specs)
+ , " "
+ , text (show rhs) ] $$
+ prettyRows thead $$
+ prettyRows tbody $$
+ prettyRows tfoot
+ where prettyRows = prettyList . map prettyRow
+ prettyRow (Row a body) =
+ text ("Row " <> show a) $$ prettyList (map prettyCell body)
+ prettyCell (Cell a ma h w b) =
+ mconcat [ "Cell "
+ , text (show a)
+ , " "
+ , text (showsPrec 11 ma "")
+ , " "
+ , text (show h)
+ , " "
+ , text (show w) ] $$
+ prettyList (map prettyBlock b)
+ prettyCaption (Caption mshort body) =
+ "(Caption " <> text (showsPrec 11 mshort "") $$ prettyList (map prettyBlock body) <> ")"
prettyBlock (Div attr blocks) =
text ("Div " <> show attr) $$ prettyList (map prettyBlock blocks)
prettyBlock block = text $ show block