aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Backends/Xhtml
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
parent26a6eaaed227afbd5c8d47c04c72827c60d3935f (diff)
clean up of anchors
Diffstat (limited to 'src/Haddock/Backends/Xhtml')
-rw-r--r--src/Haddock/Backends/Xhtml/Names.hs5
-rw-r--r--src/Haddock/Backends/Xhtml/Util.hs21
2 files changed, 12 insertions, 14 deletions
diff --git a/src/Haddock/Backends/Xhtml/Names.hs b/src/Haddock/Backends/Xhtml/Names.hs
index 755b7a2d..5b3732c6 100644
--- a/src/Haddock/Backends/Xhtml/Names.hs
+++ b/src/Haddock/Backends/Xhtml/Names.hs
@@ -43,9 +43,6 @@ ppDocName (Documented name mdl) =
where occName = nameOccName name
ppDocName (Undocumented name) = toHtml (getOccString name)
-linkTarget :: OccName -> Html
-linkTarget n = namedAnchor (anchorNameStr n) << toHtml ""
-
ppName :: Name -> Html
ppName name = toHtml (getOccString name)
@@ -54,7 +51,7 @@ ppBinder :: Bool -> OccName -> Html
-- The Bool indicates whether we are generating the summary, in which case
-- the binder will be a link to the full definition.
ppBinder True n = linkedAnchor (anchorNameStr n) << ppBinder' n
-ppBinder False n = linkTarget n +++ bold << ppBinder' n
+ppBinder False n = namedAnchor (anchorNameStr n) << bold << ppBinder' n
ppBinder' :: OccName -> Html
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"]