From 4f3ad778ba3bff7984a1fee617efefbfd5591068 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 2 Sep 2007 17:22:22 +0000 Subject: 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 --- src/Text/Pandoc/Writers/HTML.hs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3