aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--html/haddock-util.js13
-rw-r--r--html/shaddock.css344
-rw-r--r--html/thaddock.css234
-rw-r--r--src/Haddock/Backends/Xhtml.hs11
-rw-r--r--src/Haddock/Backends/Xhtml/Util.hs30
5 files changed, 625 insertions, 7 deletions
diff --git a/html/haddock-util.js b/html/haddock-util.js
index 364081f0..227ac4f8 100644
--- a/html/haddock-util.js
+++ b/html/haddock-util.js
@@ -137,3 +137,16 @@ function setSynopsis(filename) {
parent.window.synopsis.location = filename;
}
}
+
+
+function setActiveStyleSheet(href) {
+ var i, a, main;
+ for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")) {
+ a.disabled = true;
+ if(a.getAttribute("href") == href) a.disabled = false;
+ //a.disabled = a.getAttribute("title") != title;
+ }
+ }
+}
diff --git a/html/shaddock.css b/html/shaddock.css
new file mode 100644
index 00000000..3df31926
--- /dev/null
+++ b/html/shaddock.css
@@ -0,0 +1,344 @@
+/* -------- Global things --------- */
+
+@font-face {
+ font-family: 'DroidSerif';
+ src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.eot');
+ src: local('Droid Serif'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.woff') format('woff'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.ttf') format('truetype'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Regular.svg#DroidSerif') format('svg');
+}
+
+@font-face {
+ font-family: 'DroidSerif';
+ font-style: italic;
+ src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.eot');
+ src: local('Droid Serif'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.woff') format('woff'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.ttf') format('truetype'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Italic.svg#DroidSerif-Italic') format('svg');
+}
+
+@font-face {
+ font-family: 'DroidSerif';
+ font-weight: bold;
+ src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.eot');
+ src: local('Droid Serif'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.woff') format('woff'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.ttf') format('truetype'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-Bold.svg#DroidSerif-Bold') format('svg');
+}
+
+@font-face {
+ font-family: 'DroidSerif';
+ src: url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.eot');
+ font-weight: bold;
+ font-style: italic;
+ src: local('Droid Serif'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.woff') format('woff'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.ttf') format('truetype'),
+ url('http://snapframework.com/docs/latest/snap-core/fonts/DroidSerif-BoldItalic.svg#DroidSerif-BoldItalic') format('svg');
+}
+
+
+
+html {
+ background-color: #f0f3ff;
+ width: 100%;
+}
+
+body {
+ -moz-border-radius:5px;
+ -webkit-border-radius:5px;
+ width: 50em;
+ margin: 2em auto;
+ padding: 0;
+ background-color: #ffffff;
+ color: #000000;
+ font-size: 110%;
+ font-family: DroidSerif, Georgia, serif;
+ }
+
+div {
+ padding: 0 30px;
+}
+
+
+
+a:link { color: #5200A3; text-decoration: none }
+a:visited { color: #5200A3; text-decoration: none }
+a:hover { color: #5200A3; text-decoration: none; border-bottom:#5200A3 dashed 1px; }
+
+table{
+ border-spacing: 1px 1px;
+}
+
+td {
+ border-width: 0px;
+ vertical-align: top;
+}
+
+p {
+ margin-top: 0;
+ margin-bottom: 0.75em;
+ padding-left: 4px;
+ font-size: 95%;
+ line-height: 1.66;
+ }
+
+li p { margin: 0pt }
+
+
+tt, pre, code {
+ font-family: Monaco,
+ "DejaVu Sans Mono",
+ "Bitstream Vera Sans Mono",
+ "Lucida Console",
+ monospace;
+ font-size: 90%;
+}
+
+.src {
+ padding: 4px 8px;
+ background-color: #f0f0f0;
+ font-size: 80%;
+ font-family: Monaco,
+ "DejaVu Sans Mono",
+ "Bitstream Vera Sans Mono",
+ "Lucida Console",
+ monospace;
+
+ vertical-align: top;
+ white-space: nowrap;
+}
+
+ul {
+ padding: 0;
+}
+
+ul ul {
+ padding-left: 30px;
+}
+
+ul.links {
+ list-style: none;
+ position: absolute;
+ right: 1px;
+ top: 0;
+ margin: 0;
+}
+
+ul.links li {
+ display: inline;
+ white-space: nowrap;
+}
+
+
+
+/* Captions and Headers */
+
+p.caption, h1, h2, h3, h4 {
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ margin: 0;
+ padding: 0;
+ font-size: inherit;
+ line-height: inherit;
+}
+
+#module-header .caption {
+ font-weight: bold; letter-spacing: -0.02em;
+ font-size: 201%;
+ margin: 0;
+ padding: 0;
+}
+
+h1,
+#description .caption,
+#synopsis .caption {
+ padding-top: 14px;
+ margin-bottom: 0;
+ font-weight: bold;
+ letter-spacing: -0.02em;
+ font-size: 140%
+ }
+
+h2 {
+ padding-top: 14px;
+ font-weight: bold;
+ letter-spacing: -0.02em;
+ font-size: 120%
+}
+
+h3 {
+ padding-top: 12px;
+ font-weight: bold;
+ letter-spacing: -0.02em;
+ font-size: 105%
+}
+
+h4,
+#table-of-contents .caption,
+.constructors .caption,
+.instances .caption,
+.methods .caption {
+ font-weight: bold;
+ padding-top: 12px;
+ padding-bottom: 4px;
+ letter-spacing: -0.02em;
+ font-size: 90%
+}
+
+.arguments .caption,
+.fields .caption {
+ display: none;
+}
+
+/* Per Section Styling */
+
+#package-header {
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ background: #3465a4 url(haskell_icon.gif) no-repeat 4px 3px;
+ padding: 0;
+ -moz-border-radius-topleft:5px;
+ -moz-border-radius-topright:5px;
+ -webkit-border-radius-topleft:5px;
+ -webkit-border-radius-topright:5px;
+ position: relative;
+}
+
+#package-header li {
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ padding-left: 5px;
+ padding-right: 5px;
+ border-left-width: 1px;
+ border-left-color: #ffffff;
+ border-left-style: solid;
+ letter-spacing: -0.02em;
+ font-weight: bold;
+}
+
+#package-header a { color: #ffffff }
+#package-header a:visited { color: #ffff00 }
+#package-header a:hover { background-color: #C9D3DE; }
+#package-header li:hover { background-color: #C9D3DE; }
+
+#module-header {
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ color: #141B24;
+ background-color: #C9D3DE;
+ padding: 5px;
+ border-top-width: 1px;
+ border-top-color: #ffffff;
+ border-top-style: solid;
+ -moz-border-radius-bottomleft:5px;
+ -moz-border-radius-bottomright:5px;
+ -webkit-border-radius-bottomleft:5px;
+ -webkit-border-radius-bottomright:5px;
+}
+
+#module-header .info {
+ display: none;
+}
+
+#table-of-contents,
+#description,
+#synopsis,
+#footer {
+ margin-top: 15px;
+}
+
+#table-of-contents ul {
+ font-size: 80%;
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ letter-spacing: -0.01em;
+ margin: 0;
+ list-style: none;
+}
+
+#synopsis ul {
+ list-style: none;
+}
+
+#synopsis .src,
+.instances .src {
+ background-color: #FAFAFA;
+ border-bottom: #F2F2F2 solid 1px;
+ border-top: #FCFCFC solid 1px;
+}
+
+.top {
+ padding: 20px 0 0.5ex 0;
+}
+
+.top .src,
+#interface .subs.methods .src {
+ border-spacing: 0px;
+ border-bottom:1px solid #d7d7df;
+ border-right:1px solid #d7d7df;
+ border-top:1px solid #f4f4f9;
+ border-left:1px solid #f4f4f9;
+ padding: 4px;
+}
+
+#interface p + div {
+ margin-top: -15px
+}
+
+.subs p {
+ margin: 0;
+}
+
+#interface .subs .src {
+ padding: 2px 12px;
+ border: none;
+}
+
+#interface .subs td + td {
+ font-style: italic;
+ font-size: 80%;
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+}
+
+#interface .methods .src {
+ margin-top: 15px;
+}
+#interface .instances div {
+ margin: 0;
+ padding: 0;
+}
+
+div.arguments {
+ padding-left: 0;
+ padding-top: 9px;
+}
+
+.arguments table {
+ border-spacing: 0;
+}
+
+#footer {
+ font-family: "Gill Sans", "Helvetica Neue","Arial",sans-serif;
+ -moz-border-radius:5px;
+ -webkit-border-radius:5px;
+ background-color: #3465a4;
+ color: #ffffff;
+ padding: 5px
+}
+
+#footer p {
+ margin: 0;
+}
+
+#footer a:link {
+ color: #ffffff;
+ text-decoration: underline
+ }
+#footer a:visited {
+ color: #ffff00
+ }
+#footer a:hover {
+ background-color: #6060ff
+ }
+
+
+
diff --git a/html/thaddock.css b/html/thaddock.css
new file mode 100644
index 00000000..c7ae7d8c
--- /dev/null
+++ b/html/thaddock.css
@@ -0,0 +1,234 @@
+html, body {
+ height:100%;
+ margin:0;
+ padding:0;
+}
+
+body {
+ background-color:#FFFFFF;
+ color:#000000;
+ font-family:Helvetica,Arial,sans-serif;
+ font-size:small;
+ margin:3px 8px;
+
+ max-width:956px;
+ padding-left:24px;
+}
+
+#package-header {
+ background: #eaeaea url(haskell_icon.gif) no-repeat 5px 6px;
+ height: 2em;
+ margin: 0 0 0 -10px;
+ position: relative;
+}
+
+#module-header .caption {
+ background:transparent none repeat scroll 0 0;
+ border:medium none;
+ font-size: 170%;
+ line-height: 130%;
+ margin:0 0 0 -10px;
+ /* padding:0.8em 0 0; */
+
+ background-color:#E5ECF9;
+ border-top:1px solid #3366CC;
+ padding:1px 3px;
+ font-weight: bold;
+ position: relative;
+}
+
+
+dl.info {
+ position: absolute;
+ display: block;
+ right: 1em;
+ top: 3em;
+ background-color:#FAFAFA;
+ border:1px solid #BBBBBB;
+ padding:0.99em;
+}
+
+dl.info dt {
+ float: left;
+ clear: left;
+ width: 5em;
+ font-weight: bold;
+ margin: 0;
+ padding: 0;
+}
+
+dl.info dd {
+ padding-left: 6em;
+ margin: 0;
+}
+
+#description .caption,
+#synopsis .caption,
+h1 {
+ background-color:#E5ECF9;
+ border-top:1px solid #3366CC;
+ font-size:130%;
+ font-weight:bold;
+ margin:2em 0 0 -10px;
+ padding:1px 3px;
+ position:relative;
+}
+
+#table-of-contents .caption,
+h2 {
+ font-size:130%;
+ font-weight:bold;
+ margin:1.5em 0 0;
+ padding: 0;
+ top:0;
+}
+
+#synopsis li.src * {
+ display: inline;
+}
+
+#synopsis ul.subs,
+#synopsis ul.subs li {
+ padding: 0 0 0 0.25em;
+ margin: 0;
+}
+
+#footer {
+ color:#666666;
+ background-color: #eaeaea;
+ margin: 2em 0 0 -10px;
+ position: relative;
+}
+
+#footer p {
+ margin: 0;
+ padding: 0.5em;
+ border-top: 1px solid #919191;
+}
+
+ol, ul {
+ line-height:125%;
+ margin:0.5em 0 0 15px;
+ padding:0;
+}
+
+li {
+ margin:0.3em 0 0 1.5em;
+ padding:0;
+}
+
+p {
+ line-height:125%;
+ margin:0;
+ padding:0;
+}
+
+h1 + p, h2 + p, h3 + p,
+pre + p,
+p + p {
+ padding-top: 1em;
+}
+
+code, pre {
+ color:#007000;
+ font-family:monospace;
+}
+
+pre {
+ background-color:#FAFAFA;
+ border:1px solid #BBBBBB;
+ font-size:9pt;
+ line-height:125%;
+ margin:1em 0 0;
+ overflow:auto;
+ padding:0.99em;
+}
+
+code {
+ font-size:10pt;
+}
+
+a, a:link {
+ color:#0000CC;
+}
+
+ul.links {
+ list-style: none;
+ position: absolute;
+ right: 1px;
+ top: 0;
+}
+
+ul.links li {
+ display: inline;
+ white-space: nowrap;
+ padding: 0 10px;
+ border-left: 1px solid #919191;
+ margin: 0;
+}
+
+dl {
+ line-height:125%;
+ margin:0;
+ padding:0;
+}
+
+dt {
+ font-weight:normal;
+ margin:0.75em 0 0;
+ padding:0;
+}
+
+dd {
+ font-weight:normal;
+ margin:0.4em 0 0 2em;
+ padding:0;
+}
+
+.top, .subs {
+ margin:0.4em 0 0 2em;
+ padding:0;
+}
+
+.top .src {
+ font-family:monospace;
+ font-size:larger;
+ font-weight:bold;
+ margin:0.75em 0 0 -2em;
+ padding:0;
+}
+
+.top .subs .src {
+ margin-left: 0;
+}
+
+.arguments {
+ margin: 0 0 1em;
+}
+.arguments .caption,
+.fields .caption {
+ display: none;
+}
+
+.associated-types,
+.constructors,
+.methods {
+ background-color:#FAFAFA;
+ border:1px solid #BBBBBB;
+ padding:0.99em;
+}
+
+.caption {
+ margin-top: 0;
+ padding-top: 0;
+}
+
+.subs .caption {
+ font-weight: bold;
+ color: #919100;
+}
+
+.subs td {
+ padding-right: 1em;
+ padding-left: 1em;
+}
diff --git a/src/Haddock/Backends/Xhtml.hs b/src/Haddock/Backends/Xhtml.hs
index dc24acbd..c24dec6a 100644
--- a/src/Haddock/Backends/Xhtml.hs
+++ b/src/Haddock/Backends/Xhtml.hs
@@ -138,16 +138,19 @@ copyFile fromFPath toFPath =
copyHtmlBits :: FilePath -> FilePath -> Maybe FilePath -> IO ()
-copyHtmlBits odir libdir maybe_css = do
+copyHtmlBits odir libdir _maybe_css = do
let
libhtmldir = joinPath [libdir, "html"]
+ {-
css_file = case maybe_css of
Nothing -> joinPath [libhtmldir, 'x':cssFile]
Just f -> f
css_destination = joinPath [odir, cssFile]
+ -}
copyLibFile f = do
copyFile (joinPath [libhtmldir, f]) (joinPath [odir, f])
- copyFile css_file css_destination
+ --copyFile css_file css_destination
+ mapM_ copyLibFile cssFiles
mapM_ copyLibFile [ iconFile, plusFile, minusFile, jsFile, framesFile ]
footer :: Html
@@ -201,7 +204,7 @@ simpleHeader doctitle maybe_contents_url maybe_index_url
wikiButton maybe_wiki_url Nothing,
contentsButton maybe_contents_url,
indexButton maybe_index_url
- ]) ! [theclass "links"]
+ ] ++ stylePickers) ! [theclass "links"]
)
pageHeader :: String -> Interface -> String
@@ -217,7 +220,7 @@ pageHeader mdl iface doctitle
wikiButton maybe_wiki_url (Just $ ifaceMod iface),
contentsButton maybe_contents_url,
indexButton maybe_index_url
- ]) ! [theclass "links"]
+ ] ++ stylePickers) ! [theclass "links"]
) +++
divModuleHeader << (
sectionName << mdl +++
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