aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNeil Mitchell <http://www.cs.york.ac.uk/~ndm/>2007-01-12 12:17:46 +0000
committerNeil Mitchell <http://www.cs.york.ac.uk/~ndm/>2007-01-12 12:17:46 +0000
commit208e5e87a92f8d804c87f6812bebda2a97ff27b7 (patch)
tree76b4bd4d4fcd495a965678fbda7dd4e005483c32 /src
parent2577cee25b234a4911157882d08b65bec5f15e78 (diff)
Rewrite much of the index searching code, previously was too slow to execute on the base library with IE, the new version guarantees less than O(log n) operations be performed, where n is the number in the list (before was always O(n))
Diffstat (limited to 'src')
-rw-r--r--src/Haddock/Backends/Html.hs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Haddock/Backends/Html.hs b/src/Haddock/Backends/Html.hs
index 10bf794a..051f71a6 100644
--- a/src/Haddock/Backends/Html.hs
+++ b/src/Haddock/Backends/Html.hs
@@ -448,10 +448,20 @@ ppHtmlIndex odir doctitle maybe_package maybe_html_help_format
search_box = tda [colspan 2, thestyle "padding-top:5px;"] << search
where
search :: Html
- search = "Search: " +++ input ! [identifier "searchbox", strAttr "onkeyup" "quick_search()"] +++ " " +++ input ! [value "Search", thetype "button", onclick "full_search()"]
+ search = "Search: " +++ input ! [identifier "searchbox", strAttr "onkeyup" "quick_search()"]
+ +++ " " +++ input ! [value "Search", thetype "button", onclick "full_search()"]
+ +++ " " +++ thespan ! [identifier "searchmsg"] << " "
- index_html = td << table ! [identifier "indexlist", cellpadding 0, cellspacing 5] <<
- aboves (map indexElt index)
+ index_html = td << setTrClass (table ! [identifier "indexlist", cellpadding 0, cellspacing 5] <<
+ aboves (map indexElt index))
+
+ setTrClass :: Html -> Html
+ setTrClass (Html xs) = Html $ map f xs
+ where
+ f (HtmlTag name attrs inner)
+ | map toUpper name == "TR" = HtmlTag name (theclass "indexrow":attrs) inner
+ | otherwise = HtmlTag name attrs (setTrClass inner)
+ f x = x
index :: [(String, Map GHC.Name [(Module,Bool)])]
index = sortBy cmp (Map.toAscList full_index)