git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: With --toc, headers no longer link to themselves.

Closes #1081.

commit4e7aadb903548bb08c9132c93699071e52f61d76 authorJohn MacFarlane <fiddlosopher@gmail.com> dateThu 2 Jan 2014, 19:59 (13 years ago) parentb2db697
1 file changed+8−15
src/Text/Pandoc/Writers/HTML.hs+8−15
src/Text/Pandoc/Writers/HTML.hs+8−15
@@ -475,28 +475,21 @@ blockToHtml opts (BlockQuote blocks) =
475475 else do
476476 contents <- blockListToHtml opts blocks
477477 return $ H.blockquote $ nl opts >> contents >> nl opts
478−blockToHtml opts (Header level (ident,_,_) lst) = do
478+blockToHtml opts (Header level (_,_,_) lst) = do
479479 contents <- inlineListToHtml opts lst
480480 secnum <- liftM stSecNum get
481481 let contents' = if writerNumberSections opts && not (null secnum)
482482 then (H.span ! A.class_ "header-section-number" $ toHtml
483483 $ showSecNum secnum) >> strToHtml " " >> contents
484484 else contents
485− let revealSlash = ['/' | writerSlideVariant opts == RevealJsSlides]
486− let contents'' = if writerTableOfContents opts && not (null ident)
487− then H.a ! A.href (toValue $
488− '#' : revealSlash ++
489− writerIdentifierPrefix opts ++
490− ident) $ contents'
491− else contents'
492485 return $ case level of
493− 1 -> H.h1 contents''
494− 2 -> H.h2 contents''
495− 3 -> H.h3 contents''
496− 4 -> H.h4 contents''
497− 5 -> H.h5 contents''
498− 6 -> H.h6 contents''
499− _ -> H.p contents''
486+ 1 -> H.h1 contents'
487+ 2 -> H.h2 contents'
488+ 3 -> H.h3 contents'
489+ 4 -> H.h4 contents'
490+ 5 -> H.h5 contents'
491+ 6 -> H.h6 contents'
492+ _ -> H.p contents'
500493blockToHtml opts (BulletList lst) = do
501494 contents <- mapM (blockListToHtml opts) lst
502495 return $ unordList opts contents