aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock
diff options
context:
space:
mode:
authorrrnewton <rrnewton@gmail.com>2010-10-24 03:19:28 +0000
committerrrnewton <rrnewton@gmail.com>2010-10-24 03:19:28 +0000
commit54de1813071ef9191299efa8fa71159767f5f090 (patch)
treeacf014eac571d00c37fed34b49718ef3d1da4063 /src/Haddock
parent00064a3fd99b14e353d155650e3917d6b783bacc (diff)
Change to index pages: include an 'All' option even when subdividing A-Z.
Diffstat (limited to 'src/Haddock')
-rw-r--r--src/Haddock/Backends/Xhtml.hs15
-rw-r--r--src/Haddock/Utils.hs8
2 files changed, 14 insertions, 9 deletions
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs
index dc0bcaf2..e126eb9b 100644
--- a/src/Haddock/Backends/Xhtml.hs
+++ b/src/Haddock/Backends/Xhtml.hs
@@ -346,8 +346,11 @@ ppHtmlIndex odir doctitle _maybe_package themes
createDirectoryIfMissing True odir
- when split_indices $
+ when split_indices $ do
mapM_ (do_sub_index index) initialChars
+ -- Let's add a single large index as well for those who don't know exactly what they're looking for:
+ let mergedhtml = indexPage False Nothing index
+ writeFile (joinPath [odir, subIndexHtmlFile merged_name]) (renderToString mergedhtml)
writeFile (joinPath [odir, indexHtmlFile]) (renderToString html)
@@ -363,6 +366,7 @@ ppHtmlIndex odir doctitle _maybe_package themes
]
indexName ch = "Index" ++ maybe "" (\c -> " - " ++ [c]) ch
+ merged_name = "All"
buildIndex items = table << aboves (map indexElt items)
@@ -375,9 +379,10 @@ ppHtmlIndex odir doctitle _maybe_package themes
indexInitialLetterLinks =
divAlphabet <<
- unordList [ anchor ! [href (subIndexHtmlFile c)] << [c]
- | c <- initialChars
- , any ((==c) . toUpper . head . fst) index ]
+ unordList (map (\str -> anchor ! [href (subIndexHtmlFile str)] << str) $
+ [ [c] | c <- initialChars
+ , any ((==c) . toUpper . head . fst) index ] ++
+ [merged_name])
-- todo: what about names/operators that start with Unicode
-- characters?
@@ -388,7 +393,7 @@ ppHtmlIndex odir doctitle _maybe_package themes
do_sub_index this_ix c
= unless (null index_part) $
- writeFile (joinPath [odir, subIndexHtmlFile c]) (renderToString html)
+ writeFile (joinPath [odir, subIndexHtmlFile [c]]) (renderToString html)
where
html = indexPage True (Just c) index_part
index_part = [(n,stuff) | (n,stuff) <- this_ix, toUpper (head n) == c]
diff --git a/src/Haddock/Utils.hs b/src/Haddock/Utils.hs
index 9a760bbe..60ee799d 100644
--- a/src/Haddock/Utils.hs
+++ b/src/Haddock/Utils.hs
@@ -204,10 +204,10 @@ mainFrameName = "main"
synopsisFrameName = "synopsis"
-subIndexHtmlFile :: Char -> String
-subIndexHtmlFile a = "doc-index-" ++ b ++ ".html"
- where b | isAlpha a = [a]
- | otherwise = show (ord a)
+subIndexHtmlFile :: String -> String
+subIndexHtmlFile ls = "doc-index-" ++ b ++ ".html"
+ where b | all isAlpha ls = ls
+ | otherwise = concat (map (show . ord) ls)
-------------------------------------------------------------------------------