git.iko.soy/typeable/pandoc
on master help sign in
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.

commit26418b7d14ce04a7386392388d2a3cbded205705 authorJohn MacFarlane <jgm@berkeley.edu> dateSat 23 Jul 2011, 12:04 (15 years ago) parent12110f3
2 files changed+5−10
src/Text/Pandoc/Writers/HTML.hs+4−9 templates+1−1
src/Text/Pandoc/Writers/HTML.hs+4−9
@@ -169,7 +169,9 @@ inTemplate opts tit auths date toc body' newvars =
169169 [ ("body", dropWhile (=='\n') $ showHtmlFragment body')
170170 , ("pagetitle", topTitle')
171171 , ("title", dropWhile (=='\n') $ showHtmlFragment tit)
172− , ("date", date') ] ++
172+ , ("date", date')
173+ , ("idprefix", writerIdentifierPrefix opts)
174+ ] ++
173175 [ ("html5","true") | writerHtml5 opts ] ++
174176 (case toc of
175177 Just t -> [ ("toc", showHtmlFragment t)]
@@ -198,14 +200,7 @@ tableOfContents opts sects = do
198200 let tocList = catMaybes contents
199201 return $ if null tocList
200202 then Nothing
201− else Just $
202− if writerHtml5 opts
203− then (tag "nav" ! [prefixedId opts' "TOC"] $
204− nl opts +++ unordList opts tocList +++ nl opts)
205− +++ nl opts
206− else (thediv ! [prefixedId opts' "TOC"] $
207− nl opts +++ unordList opts tocList +++ nl opts)
208− +++ nl opts
203+ else Just $ unordList opts tocList
209204
210205-- | Convert section number to string
211206showSecNum :: [Int] -> String
templates+1−1

Submodule changed.