aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-08 17:09:17 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-07-08 17:09:17 +0000
commit7f5638853b7107f086d105dafe9bf6e28dc7ac95 (patch)
treebc83bf27787a696604e86b4a7beb9565e66f7a3f /src/Text/Pandoc
parentc3fb1dd4ea0cecaf541061b26ff6091b2d913140 (diff)
downloadpandoc-7f5638853b7107f086d105dafe9bf6e28dc7ac95.tar.gz
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
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs10
1 files 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 <div>.
-- 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'