aboutsummaryrefslogtreecommitdiff
path: root/Text
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-18 23:14:59 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2008-10-18 23:14:59 +0000
commit5b422262d3889c6b303b7942505ac164bd245546 (patch)
treeeda2781cf181a74ac943cebe6fda701079b37c7e /Text
parent2122aa5359ada1ea7f56bb4280b004e55ea587d9 (diff)
downloadpandoc-5b422262d3889c6b303b7942505ac164bd245546.tar.gz
Include classes on tr elements in HTML output: "header", "odd", "even".
This allows tables to be styled with lines in alternating colors. Resolves Issue #91. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1467 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'Text')
-rw-r--r--Text/Pandoc/Writers/HTML.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Text/Pandoc/Writers/HTML.hs b/Text/Pandoc/Writers/HTML.hs
index 0870c7e18..628e784ed 100644
--- a/Text/Pandoc/Writers/HTML.hs
+++ b/Text/Pandoc/Writers/HTML.hs
@@ -375,7 +375,7 @@ blockToHtml opts (Table capt aligns widths headers rows') = do
else inlineListToHtml opts capt >>= return . caption
colHeads <- colHeadsToHtml opts alignStrings
widths headers
- rows'' <- mapM (tableRowToHtml opts alignStrings) rows'
+ rows'' <- zipWithM (tableRowToHtml opts alignStrings) (cycle ["odd", "even"]) rows'
return $ table $ captionDoc +++ colHeads +++ rows''
colHeadsToHtml :: WriterOptions
@@ -387,7 +387,7 @@ colHeadsToHtml opts alignStrings widths headers = do
heads <- sequence $ zipWith3
(\alignment columnwidth item -> tableItemToHtml opts th alignment columnwidth item)
alignStrings widths headers
- return $ tr $ toHtmlFromList heads
+ return $ tr ! [theclass "header"] $ toHtmlFromList heads
alignmentToString :: Alignment -> [Char]
alignmentToString alignment = case alignment of
@@ -398,11 +398,12 @@ alignmentToString alignment = case alignment of
tableRowToHtml :: WriterOptions
-> [[Char]]
+ -> String
-> [[Block]]
-> State WriterState Html
-tableRowToHtml opts aligns columns =
+tableRowToHtml opts aligns rowclass columns =
(sequence $ zipWith3 (tableItemToHtml opts td) aligns (repeat 0) columns) >>=
- return . tr . toHtmlFromList
+ return . (tr ! [theclass rowclass]) . toHtmlFromList
tableItemToHtml :: WriterOptions
-> (Html -> Html)