summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-07-15 19:01:00 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-07-15 22:26:45 -0700
commit9be9bccfcfc2c46459b3da963bc59a37f841fe8a (patch)
tree1ecfb499923d950426d8ca1cc12e1c28291ae235 /src/Text/Pandoc/Writers
parent57a91f3b6add303ef70aa29a14a8c67123ec7c0f (diff)
Added --section-divs option.
+ Header identifiers now get attached to the headers, unless --section-divs is specified, in which case they are added to enclosing divs. By default, the divs are not added. + Resolves Issue #230, #239.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 20022e182..e9006a39b 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -208,15 +208,16 @@ elementToHtml opts (Sec level num id' title' elements) = do
innerContents <- mapM (elementToHtml opts) elements
modify $ \st -> st{stSecNum = num} -- update section number
header' <- blockToHtml opts (Header level title')
- let stuff = header' : innerContents
- return $ case writerSlideVariant opts of
- SlidySlides -> toHtmlFromList stuff
- S5Slides -> toHtmlFromList stuff
- -- S5 gets confused by the extra divs around sections
- _ | (writerStrictMarkdown opts &&
- not (writerTableOfContents opts)) ->
- toHtmlFromList stuff
- _ -> thediv ! [prefixedId opts id'] << stuff
+ let slides = writerSlideVariant opts `elem` [SlidySlides, S5Slides]
+ let header'' = header' ! [prefixedId opts id' |
+ not (writerStrictMarkdown opts ||
+ writerSectionDivs opts || slides)]
+ let stuff = header'' : innerContents
+ return $ if slides -- S5 gets confused by the extra divs around sections
+ then toHtmlFromList stuff
+ else if writerSectionDivs opts
+ then thediv ! [prefixedId opts id'] << stuff
+ else toHtmlFromList stuff
-- | Convert list of Note blocks to a footnote <div>.
-- Assumes notes are sorted.