From 3811494e06613f472c28a00ec3de00b50490f143 Mon Sep 17 00:00:00 2001 From: Mark Lentczner Date: Thu, 15 Jul 2010 05:02:26 +0000 Subject: clean up of anchors --- src/Haddock/Backends/Xhtml/Util.hs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/Haddock/Backends/Xhtml/Util.hs') 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"] -- cgit v1.2.3