From 7f5638853b7107f086d105dafe9bf6e28dc7ac95 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 8 Jul 2007 17:09:17 +0000 Subject: HTML writer changes: + change in scheme for construction of unique identifiers for headers: - all lowercase - spaces turn into -, not _ + TOC items now have their own identifiers, starting with TOC- + when there is a TOC, headers link back to the corresponding TOC items, rather than the top of the TOC. git-svn-id: https://pandoc.googlecode.com/svn/trunk@653 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Writers/HTML.hs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 75a1dccb6..54d120879 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -117,7 +117,7 @@ elementToListItem opts (Sec headerText subsecs) = do let subList = if null subHeads then noHtml else unordList subHeads - return $ (anchor ! [href ("#" ++ id)] $ txt) +++ subList + return $ (anchor ! [href ("#" ++ id), identifier ("TOC-" ++ id)] $ txt) +++ subList -- | Convert list of Note blocks to a footnote
. -- Assumes notes are sorted. @@ -175,17 +175,17 @@ inlineListToIdentifier [] = "" inlineListToIdentifier (x:xs) = xAsText ++ inlineListToIdentifier xs where xAsText = case x of - Str s -> s + Str s -> map toLower s Emph lst -> inlineListToIdentifier lst Strong lst -> inlineListToIdentifier lst Quoted _ lst -> inlineListToIdentifier lst Code s -> s - Space -> "_" + Space -> "-" EmDash -> "--" EnDash -> "-" Apostrophe -> "" Ellipses -> "..." - LineBreak -> "_" + LineBreak -> "-" TeX _ -> "" HtmlInline _ -> "" Link lst _ -> inlineListToIdentifier lst @@ -242,7 +242,7 @@ blockToHtml opts block = 6 -> h6 contents ! attribs _ -> paragraph contents ! attribs let headerHtml' = if writerTableOfContents opts - then anchor ! [href "#toc"] $ + then anchor ! [href ("#TOC-" ++ id)] $ headerHtml else headerHtml return headerHtml' -- cgit v1.2.3