aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml/Util.hs
diff options
context:
space:
mode:
authorMark Lentczner <markl@glyphic.com>2010-07-15 05:02:26 +0000
committerMark Lentczner <markl@glyphic.com>2010-07-15 05:02:26 +0000
commit3811494e06613f472c28a00ec3de00b50490f143 (patch)
tree90d595ff96b6f52b65b98c11dd60e45758f68c4b /src/Haddock/Backends/Xhtml/Util.hs
parent26a6eaaed227afbd5c8d47c04c72827c60d3935f (diff)
clean up of anchors
Diffstat (limited to 'src/Haddock/Backends/Xhtml/Util.hs')
-rw-r--r--src/Haddock/Backends/Xhtml/Util.hs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/Haddock/Backends/Xhtml/Util.hs b/src/Haddock/Backends/Xhtml/Util.hs
index 826b69f1..f2527b06 100644
--- a/src/Haddock/Backends/Xhtml/Util.hs
+++ b/src/Haddock/Backends/Xhtml/Util.hs
@@ -177,15 +177,21 @@ s8 = tda [ theclass "s8" ] << noHtml
-- | Generate a named anchor
--
--- This actually generates two anchor tags, one with the name unescaped, and one
+-- This used to generate two anchor tags, one with the name unescaped, and one
-- with the name URI-escaped. This is needed because Opera 9.52 (and later
-- versions) needs the name to be unescaped, while IE 7 needs it to be escaped.
---
-namedAnchor :: String -> Html -> Html
-namedAnchor n c = anchor ! [Html.name n] << noHtml +++
- anchor ! [Html.name (escapeStr n)] << c
+-- The escaped form for IE 7 is probably erroneous and not needed...
+namedAnchor :: String -> Html -> Html
+namedAnchor n c = anchor ! [Html.name n] << c
+linkedAnchor :: String -> Html -> Html
+linkedAnchor frag = anchor ! [href hr_]
+ where hr_ | null frag = ""
+ | otherwise = '#': escapeStr frag
+ -- this escape function is over-zealous for the fragment part of a URI
+ -- (':' for example does not need to be escaped)
+
--
-- A section of HTML which is collapsible via a +/- button.
--
@@ -207,11 +213,6 @@ collapsed fn id_ html =
collapseId :: Name -> String
collapseId nm = "i:" ++ escapeStr (getOccString nm)
-linkedAnchor :: String -> Html -> Html
-linkedAnchor frag = anchor ! [href hr_]
- where hr_ | null frag = ""
- | otherwise = '#': escapeStr frag
-
documentCharacterEncoding :: Html
documentCharacterEncoding =
meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"]