aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/HTML.hs
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-09-13 20:23:55 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2020-09-13 20:26:06 +0200
commit871164051281b50a5b4b28cacee3dd15344d81f1 (patch)
tree8f840dc3d211ec5a854644d5d830c4c1c00d6d82 /src/Text/Pandoc/Writers/HTML.hs
parentcae155b095e5182cc1b342b21f7430e40afe7ba8 (diff)
downloadpandoc-871164051281b50a5b4b28cacee3dd15344d81f1.tar.gz
HTML writer: support attributes on all table elements
Add attributes to tbody and tr elements.
Diffstat (limited to 'src/Text/Pandoc/Writers/HTML.hs')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index decc487c1..9e6e22283 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -948,8 +948,8 @@ tableBodyToHtml :: PandocMonad m
=> WriterOptions
-> Ann.TableBody
-> StateT WriterState m Html
-tableBodyToHtml opts (Ann.TableBody _attr _rowHeadCols _intm rows) =
- H.tbody <$> bodyRowsToHtml opts rows
+tableBodyToHtml opts (Ann.TableBody attr _rowHeadCols _intm rows) =
+ addAttrs opts attr . H.tbody =<< bodyRowsToHtml opts rows
tableHeadToHtml :: PandocMonad m
=> WriterOptions
@@ -1060,7 +1060,7 @@ tableRowToHtml :: PandocMonad m
=> WriterOptions
-> TableRow
-> StateT WriterState m Html
-tableRowToHtml opts (TableRow tblpart _attr rownum rowhead rowbody) = do
+tableRowToHtml opts (TableRow tblpart attr rownum rowhead rowbody) = do
let rowclass = A.class_ $ case rownum of
Ann.RowNumber x | x `rem` 2 == 1 -> "odd"
_ | tblpart /= Thead -> "even"
@@ -1068,10 +1068,14 @@ tableRowToHtml opts (TableRow tblpart _attr rownum rowhead rowbody) = do
let celltype = case tblpart of
Thead -> HeaderCell
_ -> BodyCell
- head' <- mapM (cellToHtml opts HeaderCell) rowhead
- body <- mapM (cellToHtml opts celltype) rowbody
+ headcells <- mapM (cellToHtml opts HeaderCell) rowhead
+ bodycells <- mapM (cellToHtml opts celltype) rowbody
+ rowHtml <- addAttrs opts attr $ H.tr ! rowclass $ do
+ nl opts
+ mconcat headcells
+ mconcat bodycells
return $ do
- H.tr ! rowclass $ nl opts *> mconcat (head' <> body)
+ rowHtml
nl opts
alignmentToString :: Alignment -> Maybe Text