diff options
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 6 | ||||
-rw-r--r-- | test/tables/nordics.html4 | 12 | ||||
-rw-r--r-- | test/tables/nordics.html5 | 12 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index b6bde7f8f..bac720c66 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -1089,16 +1089,18 @@ tableRowToHtml :: PandocMonad m -> TableRow -> StateT WriterState m Html tableRowToHtml opts (TableRow tblpart attr rownum rowhead rowbody) = do - let rowclass = A.class_ $ case rownum of + let rowclass = case rownum of Ann.RowNumber x | x `rem` 2 == 1 -> "odd" _ | tblpart /= Thead -> "even" _ -> "header" + let attr' = case attr of + (id', classes, rest) -> (id', rowclass:classes, rest) let celltype = case tblpart of Thead -> HeaderCell _ -> BodyCell headcells <- mapM (cellToHtml opts HeaderCell) rowhead bodycells <- mapM (cellToHtml opts celltype) rowbody - rowHtml <- addAttrs opts attr $ H.tr ! rowclass $ do + rowHtml <- addAttrs opts attr' $ H.tr $ do nl opts mconcat headcells mconcat bodycells diff --git a/test/tables/nordics.html4 b/test/tables/nordics.html4 index a0d15e1bd..841ab03e5 100644 --- a/test/tables/nordics.html4 +++ b/test/tables/nordics.html4 @@ -17,38 +17,38 @@ </tr> </thead> <tbody class="souvereign-states"> -<tr class="odd" class="country"> +<tr class="odd country"> <th align="center">Denmark</th> <td align="left">Copenhagen</td> <td align="left">5,809,502</td> <td align="left">43,094</td> </tr> -<tr class="even" class="country"> +<tr class="even country"> <th align="center">Finland</th> <td align="left">Helsinki</td> <td align="left">5,537,364</td> <td align="left">338,145</td> </tr> -<tr class="odd" class="country"> +<tr class="odd country"> <th align="center">Iceland</th> <td align="left">Reykjavik</td> <td align="left">343,518</td> <td align="left">103,000</td> </tr> -<tr class="even" class="country"> +<tr class="even country"> <th align="center">Norway</th> <td align="left">Oslo</td> <td align="left">5,372,191</td> <td align="left">323,802</td> </tr> -<tr class="odd" class="country"> +<tr class="odd country"> <th align="center">Sweden</th> <td align="left">Stockholm</td> <td align="left">10,313,447</td> <td align="left">450,295</td> </tr> </tbody><tfoot> -<tr class="even" id="summary"> +<tr id="summary" class="even"> <td align="center">Total</td> <td align="left"></td> <td align="left" id="total-population">27,376,022</td> diff --git a/test/tables/nordics.html5 b/test/tables/nordics.html5 index f52cf8e4c..0d639d4ea 100644 --- a/test/tables/nordics.html5 +++ b/test/tables/nordics.html5 @@ -17,38 +17,38 @@ </tr> </thead> <tbody class="souvereign-states"> -<tr class="odd" class="country"> +<tr class="odd country"> <th style="text-align: center;">Denmark</th> <td style="text-align: left;">Copenhagen</td> <td style="text-align: left;">5,809,502</td> <td style="text-align: left;">43,094</td> </tr> -<tr class="even" class="country"> +<tr class="even country"> <th style="text-align: center;">Finland</th> <td style="text-align: left;">Helsinki</td> <td style="text-align: left;">5,537,364</td> <td style="text-align: left;">338,145</td> </tr> -<tr class="odd" class="country"> +<tr class="odd country"> <th style="text-align: center;">Iceland</th> <td style="text-align: left;">Reykjavik</td> <td style="text-align: left;">343,518</td> <td style="text-align: left;">103,000</td> </tr> -<tr class="even" class="country"> +<tr class="even country"> <th style="text-align: center;">Norway</th> <td style="text-align: left;">Oslo</td> <td style="text-align: left;">5,372,191</td> <td style="text-align: left;">323,802</td> </tr> -<tr class="odd" class="country"> +<tr class="odd country"> <th style="text-align: center;">Sweden</th> <td style="text-align: left;">Stockholm</td> <td style="text-align: left;">10,313,447</td> <td style="text-align: left;">450,295</td> </tr> </tbody><tfoot> -<tr class="even" id="summary"> +<tr id="summary" class="even"> <td style="text-align: center;">Total</td> <td style="text-align: left;"></td> <td style="text-align: left;" id="total-population">27,376,022</td> |