diff options
author | Mark Lentczner <markl@glyphic.com> | 2010-07-15 23:53:01 +0000 |
---|---|---|
committer | Mark Lentczner <markl@glyphic.com> | 2010-07-15 23:53:01 +0000 |
commit | b67678234917d61b8393fa9b75092bfa2c399ab4 (patch) | |
tree | f5bdf58b5af5e20ddbfbf33c37b1419a20bd2f9b /src/Haddock/Backends/Xhtml | |
parent | 3811494e06613f472c28a00ec3de00b50490f143 (diff) |
added two new themes and rough css switcher
Diffstat (limited to 'src/Haddock/Backends/Xhtml')
-rw-r--r-- | src/Haddock/Backends/Xhtml/Util.hs | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/src/Haddock/Backends/Xhtml/Util.hs b/src/Haddock/Backends/Xhtml/Util.hs index f2527b06..de5f8180 100644 --- a/src/Haddock/Backends/Xhtml/Util.hs +++ b/src/Haddock/Backends/Xhtml/Util.hs @@ -26,7 +26,9 @@ module Haddock.Backends.Xhtml.Util ( abovesSep, hsep, collapsebutton, collapseId, collapsed, - documentCharacterEncoding, styleSheet + documentCharacterEncoding, + + cssFiles, styleSheet, stylePickers ) where import Haddock.GhcUtils @@ -217,6 +219,28 @@ documentCharacterEncoding :: Html documentCharacterEncoding = meta ! [httpequiv "Content-Type", content "text/html; charset=UTF-8"] +-- Standard set of style sheets, first is the preferred +cssThemes :: [(String, String)] +cssThemes = [ + ("Classic", "xhaddock.css"), + ("Tibbe", "thaddock.css"), + ("Snappy", "shaddock.css") + ] + +cssFiles :: [String] +cssFiles = map snd cssThemes + styleSheet :: Html -styleSheet = - (thelink ! [href cssFile, rel "stylesheet", thetype "text/css"]) noHtml +styleSheet = toHtml $ zipWith mkLink cssThemes rels + where + rels = ("stylesheet" : repeat "alternate stylesheet") + mkLink (aTitle, aFile) aRel = + (thelink ! [href aFile, rel aRel, thetype "text/css", Html.title aTitle]) noHtml + +stylePickers :: [Html] +stylePickers = map mkPicker cssThemes + where + mkPicker (aTitle, aFile) = + let js = "setActiveStyleSheet('" ++ aFile ++ "'); return false;" in + anchor ! [href "#", onclick js] << aTitle +
\ No newline at end of file |