@@ -190,7 +190,12 @@ tableOfContents opts sects = do
190190 let tocList = catMaybes contents
191191 return $ if null tocList
192192 then Nothing
193− else Just $ thediv ! [prefixedId opts' "TOC"] $ unordList tocList
193+ else Just $
194+ if writerHtml5 opts
195+ then tag "nav" ! [prefixedId opts' "TOC"] $
196+ unordList tocList
197+ else thediv ! [prefixedId opts' "TOC"] $
198+ unordList tocList
194199
195200-- | Convert section number to string
196201showSecNum :: [Int] -> String
@@ -299,8 +304,11 @@ blockToHtml opts (Plain lst) = inlineListToHtml opts lst
299304blockToHtml opts (Para [Image txt (s,tit)]) = do
300305 img <- inlineToHtml opts (Image txt (s,tit))
301306 capt <- inlineListToHtml opts txt
302− return $ thediv ! [theclass "figure"] <<
303− [img, paragraph ! [theclass "caption"] << capt]
307+ return $ if writerHtml5 opts
308+ then tag "figure" <<
309+ [img, tag "figcaption" << capt]
310+ else thediv ! [theclass "figure"] <<
311+ [img, paragraph ! [theclass "caption"] << capt]
304312blockToHtml opts (Para lst) = inlineListToHtml opts lst >>= (return . paragraph)
305313blockToHtml _ (RawHtml str) = return $ primHtml str
306314blockToHtml _ (HorizontalRule) = return $ hr
@@ -371,7 +379,17 @@ blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do
371379 then [start startnum]
372380 else []) ++
373381 (if numstyle /= DefaultStyle
374− then [thestyle $ "list-style-type: " ++ numstyle' ++ ";"]
382+ then if writerHtml5 opts
383+ then [strAttr "type" $
384+ case numstyle of
385+ Decimal -> "1"
386+ LowerAlpha -> "a"
387+ UpperAlpha -> "A"
388+ LowerRoman -> "i"
389+ UpperRoman -> "I"
390+ _ -> "1"]
391+ else [thestyle $ "list-style-type: " ++
392+ numstyle']
375393 else [])
376394 return $ ordList ! attribs $ contents
377395blockToHtml opts (DefinitionList lst) = do
@@ -384,28 +402,30 @@ blockToHtml opts (DefinitionList lst) = do
384402 else []
385403 return $ dlist ! attribs << concat contents
386404blockToHtml opts (Table capt aligns widths headers rows') = do
387− let alignStrings = map alignmentToString aligns
388405 captionDoc <- if null capt
389406 then return noHtml
390407 else inlineListToHtml opts capt >>= return . caption
391408 let percent w = show (truncate (100*w) :: Integer) ++ "%"
409+ let widthAttrs w = if writerHtml5 opts
410+ then [thestyle $ "width: " ++ percent w]
411+ else [width $ percent w]
392412 let coltags = if all (== 0.0) widths
393413 then noHtml
394414 else concatHtml $ map
395− (\w -> col ! [width $ percent w] $ noHtml) widths
415+ (\w -> col ! (widthAttrs w) $ noHtml) widths
396416 head' <- if all null headers
397417 then return noHtml
398− else liftM (thead <<) $ tableRowToHtml opts alignStrings 0 headers
418+ else liftM (thead <<) $ tableRowToHtml opts aligns 0 headers
399419 body' <- liftM (tbody <<) $
400− zipWithM (tableRowToHtml opts alignStrings) [1..] rows'
420+ zipWithM (tableRowToHtml opts aligns) [1..] rows'
401421 return $ table $ captionDoc +++ coltags +++ head' +++ body'
402422
403423tableRowToHtml :: WriterOptions
404− -> [String]
424+ -> [Alignment]
405425 -> Int
406426 -> [[Block]]
407427 -> State WriterState Html
408−tableRowToHtml opts alignStrings rownum cols' = do
428+tableRowToHtml opts aligns rownum cols' = do
409429 let mkcell = if rownum == 0 then th else td
410430 let rowclass = case rownum of
411431 0 -> "header"
@@ -413,7 +433,7 @@ tableRowToHtml opts alignStrings rownum cols' = do
413433 _ -> "even"
414434 cols'' <- sequence $ zipWith
415435 (\alignment item -> tableItemToHtml opts mkcell alignment item)
416− alignStrings cols'
436+ aligns cols'
417437 return $ tr ! [theclass rowclass] $ toHtmlFromList cols''
418438
419439alignmentToString :: Alignment -> [Char]
@@ -425,12 +445,15 @@ alignmentToString alignment = case alignment of
425445
426446tableItemToHtml :: WriterOptions
427447 -> (Html -> Html)
428− -> [Char]
448+ -> Alignment
429449 -> [Block]
430450 -> State WriterState Html
431451tableItemToHtml opts tag' align' item = do
432452 contents <- blockListToHtml opts item
433− return $ tag' ! [align align'] $ contents
453+ let alignAttrs = if writerHtml5 opts
454+ then [thestyle $ "align: " ++ alignmentToString align']
455+ else [align $ alignmentToString align']
456+ return $ tag' ! alignAttrs $ contents
434457
435458blockListToHtml :: WriterOptions -> [Block] -> State WriterState Html
436459blockListToHtml opts lst =