HTML writer/templates: Made TOC more customizable.

The container for the TOC is now in the template, so users
can insert a header or other styling. Thanks to Bruce D'Arcus
for the suggestion.
This commit is contained in:
John MacFarlane 2011-07-23 12:04:31 -07:00
parent 12110f3282
commit 26418b7d14
2 changed files with 5 additions and 10 deletions

View file

@ -169,7 +169,9 @@ inTemplate opts tit auths date toc body' newvars =
[ ("body", dropWhile (=='\n') $ showHtmlFragment body')
, ("pagetitle", topTitle')
, ("title", dropWhile (=='\n') $ showHtmlFragment tit)
, ("date", date') ] ++
, ("date", date')
, ("idprefix", writerIdentifierPrefix opts)
] ++
[ ("html5","true") | writerHtml5 opts ] ++
(case toc of
Just t -> [ ("toc", showHtmlFragment t)]
@ -198,14 +200,7 @@ tableOfContents opts sects = do
let tocList = catMaybes contents
return $ if null tocList
then Nothing
else Just $
if writerHtml5 opts
then (tag "nav" ! [prefixedId opts' "TOC"] $
nl opts +++ unordList opts tocList +++ nl opts)
+++ nl opts
else (thediv ! [prefixedId opts' "TOC"] $
nl opts +++ unordList opts tocList +++ nl opts)
+++ nl opts
else Just $ unordList opts tocList
-- | Convert section number to string
showSecNum :: [Int] -> String

@ -1 +1 @@
Subproject commit 8590fab1359fd618a7f8f737121c9413a8749d1a
Subproject commit 8cb5fef740725ee51ffed5022faa097f21336bcd