summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/HTML.hs
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-09-02 17:22:22 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-09-02 17:22:22 +0000
commit4f3ad778ba3bff7984a1fee617efefbfd5591068 (patch)
tree07ae93c90d430a883a5fcd37ba45aca03c7eb7cb /src/Text/Pandoc/Writers/HTML.hs
parentfcdbb7b058f7d8889cfafea986e2b0e77ef04649 (diff)
HTML writer: put anchors around contents of headers, not around
the header tags themselves, when producing backlinks to TOC. Resolves Issue #23. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1000 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Writers/HTML.hs')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index e234b7fca..0b99c6c92 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -274,17 +274,17 @@ blockToHtml opts (Header level lst) = do
let attribs = if writerStrictMarkdown opts && not (writerTableOfContents opts)
then []
else [identifier id]
- let headerHtml = case level of
- 1 -> h1 contents ! attribs
- 2 -> h2 contents ! attribs
- 3 -> h3 contents ! attribs
- 4 -> h4 contents ! attribs
- 5 -> h5 contents ! attribs
- 6 -> h6 contents ! attribs
- _ -> paragraph contents ! attribs
- return $ if writerTableOfContents opts
- then anchor ! [href ("#TOC-" ++ id)] $ headerHtml
- else headerHtml
+ let contents' = if writerTableOfContents opts
+ then anchor ! [href ("#TOC-" ++ id)] $ contents
+ else contents
+ return $ case level of
+ 1 -> h1 contents' ! attribs
+ 2 -> h2 contents' ! attribs
+ 3 -> h3 contents' ! attribs
+ 4 -> h4 contents' ! attribs
+ 5 -> h5 contents' ! attribs
+ 6 -> h6 contents' ! attribs
+ _ -> paragraph contents' ! attribs
blockToHtml opts (BulletList lst) = do
contents <- mapM (blockListToHtml opts) lst
let attribs = if writerIncremental opts