diff --git a/Handler/Haddock.hs b/Handler/Haddock.hs index b09b51e..716b6c8 100644 --- a/Handler/Haddock.hs +++ b/Handler/Haddock.hs @@ -32,9 +32,17 @@ getHaddockR slug rest Just route -> redirect route Nothing -> do let stylesheet = render' $ StaticR haddock_style_css + script = render' $ StaticR haddock_script_js + bootstrap = render' $ StaticR haddock_bootstrap_css + jquery = render' $ StaticR haddock_jquery_js render' = return . ContentText . render addExtra t@(EventEndElement "head") = [ EventBeginElement "link" + [ ("rel", [ContentText "stylesheet"]) + , ("href", bootstrap) + ] + , EventEndElement "link" + , EventBeginElement "link" [ ("rel", [ContentText "stylesheet"]) , ("href", [ContentText "https://fonts.googleapis.com/css?family=Open+Sans"]) ] @@ -44,9 +52,17 @@ getHaddockR slug rest , ("href", stylesheet) ] , EventEndElement "link" + , EventBeginElement "script" + [ ("src", jquery) + ] + , EventEndElement "script" + , EventBeginElement "script" + [ ("src", script) + ] + , EventEndElement "script" , t ] - addExtra t@(EventBeginElement "body" _) = [t] + addExtra t@(EventBeginElement "body" _) = [t] ++ nav addExtra t = [t] req <- parseUrl $ unpack $ makeURL slug rest (_, res) <- acquireResponse req >>= allocateAcquire @@ -72,6 +88,34 @@ redirectWithVersion slug rest = return (Just (HaddockR slug [pkg <> "-" <> version, file])) _ -> return Nothing +nav :: [Event] +nav = + el "nav" + [("class","navbar navbar-default")] + (el "div" + [("class","container")] + (el "div" + [("class","navbar-header")] + (el "a" + [("href","https://haskell-lang.org/packages") + ,("class","navbar-brand")] + (el "span" [("class","logo")] [] ++ text "Haskell")) ++ + el "div" + [("class","navbar-collapse")] + (el "ul" + [("id","bootstrap-nav"), + ("class","nav navbar-nav")] + (concat [el "li" [] (el "a" [] (text "Source")) + ,el "li" [] (el "a" [] (text "Contents")) + ,el "li" [] (el "a" [] (text "Index")) + ])))) + where text x = [EventContent (ContentText x)] + el name props inner = open ++ inner ++ close + where open = + [EventBeginElement name + (map (\(k,v) -> (k,[ContentText v])) props)] + close = [EventEndElement name] + getHaddockBackupR :: [Text] -> Handler () getHaddockBackupR rest = track "Handler.Haddock.getHaddockBackupR" $ redirect $ concat $ "https://s3.amazonaws.com/haddock.stackage.org" diff --git a/etc/scripts/stage_docker.sh b/etc/scripts/stage_docker.sh index 1ca4c67..b938544 100755 --- a/etc/scripts/stage_docker.sh +++ b/etc/scripts/stage_docker.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -ex +set -e cd "$(dirname "${BASH_SOURCE[0]}")/../.." mkdir -p etc/docker/_artifacts stack install --local-bin-path=etc/docker/_artifacts "$@" -rsync -av --delete config static etc/docker/_artifacts/ +cp -r config static etc/docker/_artifacts/ diff --git a/static/haddock/style.css b/static/haddock/style.css index d8ff95f..574e75f 100644 --- a/static/haddock/style.css +++ b/static/haddock/style.css @@ -1,306 +1,266 @@ -/* @group Fundamentals */ - -* { margin: 0; padding: 0 } - -/* Is this portable? */ -html { - background-color: white; - width: 100%; - height: 100%; -} - -body { - background: white; - color: black; - text-align: left; - min-height: 100%; - position: relative; -} - -p { - margin: 0.8em 0; -} - -ul, ol { - margin: 0.8em 0 0.8em 2em; -} - -dl { - margin: 0.8em 0; -} - -dt { - font-weight: bold; -} -dd { - margin-left: 2em; -} - -a { text-decoration: none; } -a[href]:link { color: rgb(196,69,29); } -a[href]:visited { color: rgb(171,105,84); } -a[href]:hover { text-decoration:underline; } - -/* @end */ - -/* @group Fonts & Sizes */ - -/* Basic technique & IE workarounds from YUI 3 - For reasons, see: - http://yui.yahooapis.com/3.1.1/build/cssfonts/fonts.css +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Global styles */ +html { + position:relative; + min-height:100%; +} + body { - font:13px/1.4 sans-serif; - *font-size:small; /* for IE */ - *font:x-small; /* for IE in quirks mode */ -} - -h1 { font-size: 146.5%; /* 19pt */ } -h2 { font-size: 131%; /* 17pt */ } -h3 { font-size: 116%; /* 15pt */ } -h4 { font-size: 100%; /* 13pt */ } -h5 { font-size: 100%; /* 13pt */ } - -select, input, button, textarea { - font:99% sans-serif; -} - -table { - font-size:inherit; - font:100%; -} - -pre, code, kbd, samp, tt, .src { - font-family:monospace; - *font-size:108%; - line-height: 124%; -} - -.links, .link { - font-size: 85%; /* 11pt */ -} - -#module-header .caption { - font-size: 182%; /* 24pt */ -} - -.info { - font-size: 85%; /* 11pt */ -} - -#table-of-contents, #synopsis { - /* font-size: 85%; /* 11pt */ -} - - -/* @end */ - -/* @group Common */ - -.caption, h1, h2, h3, h4, h5, h6 { - font-weight: bold; - color: rgb(78,98,114); - margin: 0.8em 0 0.4em; -} - -* + h1, * + h2, * + h3, * + h4, * + h5, * + h6 { - margin-top: 2em; -} - -h1 + h2, h2 + h3, h3 + h4, h4 + h5, h5 + h6 { - margin-top: inherit; -} - -ul.links { - list-style: none; - text-align: left; - float: right; - display: inline-table; - margin: 0 0 0 1em; -} - -ul.links li { - display: inline; - border-left: 1px solid #d5d5d5; - white-space: nowrap; - padding: 0; -} - -ul.links li a { - padding: 0.2em 0.5em; -} - -.hide { display: none; } -.show { display: inherit; } -.clear { clear: both; } - -.collapser { - background-image: url(minus.gif); - background-repeat: no-repeat; -} -.expander { - background-image: url(plus.gif); - background-repeat: no-repeat; -} -p.caption.collapser, -p.caption.expander { - background-position: 0 0.4em; -} -.collapser, .expander { - padding-left: 14px; - margin-left: -14px; - cursor: pointer; + background:#fff; + font-family: "Open Sans", sans-serif; + font-size:14px; + margin:0 0 6em; + padding:0; + overflow-y:scroll; } pre { - padding: 0.25em; - margin: 0.8em 0; - background: rgb(229,237,244); - overflow: auto; - border-bottom: 0.25em solid white; -/* white border adds some space below the box to compensate - for visual extra space that paragraphs have between baseline - and the bounding box */ + font-family: ubuntu mono, monospace; } -.src { - background: #f0f0f0; - padding: 0.2em 0.5em; +code { + background: #eee; + color: #4F4371; + font-family: ubuntu mono, monospace; } -.keyword { font-weight: normal; } -.def { font-weight: bold; } - - -/* @end */ - -/* @group Page Structure */ - -#content { - margin: 0 auto; - padding: 0 2em 6em; +.wrap { + background:#fff; + padding-bottom:2em; } +p,ul,li { + font-size:15px; +} + +h1 { + margin-top:.1em; + margin-left:0; + text-indent:-.05em; +} + +h2 { + color:#6e618d; +} + +.muted { + opacity: 0.6; +} + +.footer { + background-color:#323232; + color:#999; + position:absolute; + bottom:0; + width:100%; + height:4em; + overflow: hidden; + line-height:2em; +} + +.footer p { + margin-top:1em; + font-size:13px; + height: 30px; + overflow: hidden; +} + +.footer a { + color: #fff; +} + +.footer .item + .item { + margin-left: 2em; +} + +.logo { + background-image: url(/static/img/haskell-logo.png); + background-size: 21px auto; + background-repeat: no-repeat; + background-position: center; + padding: 10px; +} + +.span12 ul li + li { + margin-top: 0.5em; +} + +.api-docs, .api-docs:hover { + font-size: 15px; + padding-left: 0.25em; + padding-right: 0.25em; + padding-bottom: 0.125em; + border-radius: 0.125em; + background: #4f4371; + color: #fff; + text-decoration: none; + } + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Syntax highlighting (hscolour) +*/ + +pre .hs-comment { color:#555 } +pre .hs-keyword { color:#397460 } +pre .hs-str { color:#366354 } +pre .hs-conid { color:#4F4371 } +pre .hs-varop, pre .hs-keyglyph { color:#8f4e8b } +pre .hs-varid { color:#333 } +pre .hs-num { color:#4F4371 } +pre .hs-definition { color: #2e659c } +pre .diff { color:#555 } +pre code .title { color:#333 } +pre code .string { color:#366354 } +pre code .built_in { color:#397460 } +pre code .preprocessor { color:#4F4371 } +pre code .comment { color:#555 } +pre code .command { color:#397460 } +pre code .special { color:#333 } +pre code .formula { color:#4F4371 } +pre code .keyword { color:#397460 } +pre code .number { color:#4F4371 } +pre code .header { color:#555 } +pre code .deletion { background-color:#FDD; color:#695B5B } +pre code .addition { background-color:#DFD; color:#000 } + +code .hs-definition { color: #2e659c } +code .hs-comment { color:#555 } +code .hs-keyword { color:#397460 } +code .hs-str { color:#366354 } +code .hs-conid { color:#4F4371 } +code .hs-varop, code .hs-keyglyph { color:#8f4e8b } +code .hs-varid { color:#333 } +code .hs-num { color:#4F4371 } +code .diff { color:#555 } + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Navigation +*/ + +.mobile > .navbar { + display: none; +} +.navbar { + background-color:#352f44; + border-radius:0; + border:0; +} + +.navbar-brand { + color:#fff; + font-size:inherit; + font-weight:700; + margin-left: 0 !important; + padding-left:0; +} + +.navbar-default .navbar-brand { + color:#fff; +} + +.navbar-brand .logo { + margin-right:.5em; + color:#fff; +} + +.navbar-default .navbar-nav > .active > a { + color:#d1cddc!important; + background-color:#312b3f; + border-bottom:.3em solid #465787; +} + +.navbar-default .navbar-brand:hover, +.navbar-default .navbar-brand:focus { + color:#fff; +} + +.navbar-default .navbar-nav > .active > a:hover, +.navbar-default .navbar-nav a:hover, +.navbar-default .navbar-nav > .active > a:focus { + color:#fff!important; + background-color:#312b3f; +} + +.navbar-default .navbar-nav > li > a { + color:#d1cddc!important; + background-color:inherit; +} + +.navbar a:hover { + color: #c3a6e0; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Template +*/ + +.template .navbar { + margin-bottom:.5em; +} + +.template code { + background-color:#f5f5f5; + color:#366354; +} + +.template pre { + font-size:14px; + word-wrap: normal; +} + +.template .container > .row { + max-width:none; +} + +.template .breadcrumb { + padding-left:0; + background-color:inherit; + margin-bottom:0; +} + +.template .breadcrumb li { + margin-right: 5px; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Haddock-specific CSS +*/ + #package-header { - background: rgb(41,56,69); - border-top: 5px solid rgb(78,98,114); - color: #ddd; - padding: 0.2em; - position: relative; - text-align: left; } -#package-header .caption { - background: url(hslogo-16.png) no-repeat 0em; - color: white; - margin: 0 2em; - font-weight: normal; - font-style: normal; - padding-left: 2em; +#page-menu { + display: none; } -#package-header a:link, #package-header a:visited { color: white; } -#package-header a:hover { background: rgb(78,98,114); } - -#module-header .caption { - color: rgb(78,98,114); - font-weight: bold; - border-bottom: 1px solid #ddd; -} - -table.info { - float: right; - padding: 0.5em 1em; - border: 1px solid #ddd; - color: rgb(78,98,114); - background-color: #fff; - max-width: 40%; - border-spacing: 0; - position: relative; - top: -0.5em; - margin: 0 0 0 2em; -} - -.info th { - padding: 0 1em 0 0; -} - -div#style-menu-holder { - position: relative; - z-index: 2; - display: inline; -} - -#style-menu { - position: absolute; - z-index: 1; - overflow: visible; - background: #374c5e; - margin: 0; - text-align: center; - right: 0; +#table-of-contents a code { + background: inherit; + border: 0; padding: 0; - top: 1.25em; -} - -#style-menu li { - display: list-item; - border-style: none; - margin: 0; - padding: 0; - color: #000; - list-style-type: none; -} - -#style-menu li + li { - border-top: 1px solid #919191; -} - -#style-menu a { - width: 6em; - padding: 3px; - display: block; -} - -#footer { - background: #ddd; - border-top: 1px solid #aaa; - padding: 0.5em 0; - color: #666; - text-align: center; - position: absolute; - bottom: 0; - width: 100%; - height: 3em; -} - -/* @end */ - -/* @group Front Matter */ - -#table-of-contents { - float: right; - clear: right; - background: #faf9dc; - border: 1px solid #d8d7ad; - padding: 0.5em 1em; - max-width: 20em; - margin: 0.5em 0 1em 1em; + color: inherit; + font-size: inherit; } #table-of-contents .caption { - text-align: center; - margin: 0; + font-weight: bold; } -#table-of-contents ul { - list-style: none; - margin: 0; +#module-header .caption { + font-family: inherit; + font-weight: 500; + line-height: 1.1; + color: inherit; + font-size: 36px; + margin-top: .1em; + margin-left: 0; + text-indent: -.05em; } -#table-of-contents ul ul { - margin-left: 2em; +/* Who really reads this info? */ +#module-header .info { + display: none; } #description .caption { @@ -311,324 +271,118 @@ div#style-menu-holder { display: none; } -.no-frame #synopsis { - display: block; - position: fixed; - right: 0; - height: 80%; - top: 10%; - padding: 0; -} - -#synopsis .caption { - float: left; - width: 29px; - color: rgba(255,255,255,0); - height: 110px; - margin: 0; - font-size: 1px; - padding: 0; -} - -#synopsis p.caption.collapser { - background: url(synopsis.png) no-repeat -64px -8px; -} - -#synopsis p.caption.expander { - background: url(synopsis.png) no-repeat 0px -8px; -} - -#synopsis ul { - height: 100%; - overflow: auto; - padding: 0.5em; - margin: 0; -} - -#synopsis ul ul { - overflow: hidden; -} - -#synopsis ul, -#synopsis ul li.src { - background-color: #faf9dc; - white-space: nowrap; - list-style: none; - margin-left: 0; -} - -/* @end */ - -/* @group Main Content */ - -#interface div.top { margin: 2em 0; } -#interface h1 + div.top, -#interface h2 + div.top, -#interface h3 + div.top, -#interface h4 + div.top, -#interface h5 + div.top { +.top { margin-top: 1em; + padding-top: 1em; } -#interface p.src .link { +.top > .src { + background: #efefef; + margin-left: -5px; + margin-right: -5px; + padding: 5px; + border-radius: 3px; +} + +.src { font-family: monospace; padding: 0; } +.src .keyword, .src .keyword:hover { color:#397460; text-decoration: none; } +.src .def, .src .def:hover, .src a { color:#4F4371; text-decoration: none;} +.src a[href]:hover { text-decoration: underline; } + +.top > .src > .link { float: right; - color: #919191; - border-left: 1px solid #919191; - background: #f0f0f0; - padding: 0 0.5em 0.2em; - margin: 0 -0.5em 0 0.5em; + font-family: "Open Sans", sans-serif; + color: #428bca; } -#interface span.fixity { - color: #919191; - border-left: 1px solid #919191; - padding: 0.2em 0.5em 0.2em 0.5em; - margin: 0 -1em 0 1em; +.subs .caption { + margin-top: 0.5em; + font-weight: bold; } -#interface span.rightedge { - border-left: 1px solid #919191; - padding: 0.2em 0 0.2em 0; - margin: 0 0 0 1em; +body > pre { + background: #fff; + border: 0; + padding-top: 0; } -#interface table { border-spacing: 2px; } -#interface td { +nav + pre { + margin-top: -5px; +} + +.src .fixity { + color: #888; +} + +.src .fixity:before { + content: " ("; + color: #888; +} +.src .fixity:after { + content: ")"; + color: #888; +} + +.doc code a { + color: #4F4371 !important; +} + +.instances td.src { + width: 50%; vertical-align: top; - padding-left: 0.5em; -} -#interface td.src { - white-space: nowrap; -} -#interface td.doc p { - margin: 0; -} -#interface td.doc p + p { - margin-top: 0.8em; } -.subs dl { - margin: 0; +h4 { margin-top: 1em; } + +.hide,.show {display: none !important;} + +.collapser { cursor: pointer } +.collapser:before { + content:"\25B6 "; + font-size: 0.6em; + color: #666; +} +.collapser.active:before { + content: "\25BC "; + font-size: 0.6em; + color: #666; } -.subs dt { - float: left; - clear: left; - display: block; - margin: 1px 0; +code code { padding: 0; margin: 0; } + +h4.collapser { font-size: 15px; font-weight: bold } + +.subs > .src { + background: #f5f5f5; + padding: 5px; + border-radius: 3px; + min-width: 50%; } -.subs dd { +.subs > .src > .link { float: right; - width: 90%; - display: block; - padding-left: 0.5em; - margin-bottom: 0.5em; + font-family: "Open Sans", sans-serif; + color: #428bca; } -.subs dd.empty { - display: none; -} - -.subs dd p { - margin: 0; -} - -/* Render short-style data instances */ -.inst ul { - height: 100%; - padding: 0.5em; - margin: 0; -} - -.inst, .inst li { - list-style: none; - margin-left: 1em; -} - -.top p.src { - border-top: 1px solid #ccc; -} - -.subs, .doc { - /* use this selector for one level of indent */ - padding-left: 2em; -} - -.warning { - color: red; -} - -.arguments { - margin-top: -0.4em; -} -.arguments .caption { - display: none; -} - -.fields { padding-left: 1em; } - -.fields .caption { display: none; } - -.fields p { margin: 0 0; } - -/* this seems bulky to me -.methods, .constructors { - background: #f8f8f8; - border: 1px solid #eee; -} -*/ - -/* @end */ - -/* @group Auxillary Pages */ - - -.extension-list { - list-style-type: none; - margin-left: 0; -} - -#mini { - margin: 0 auto; - padding: 0 1em 1em; -} - -#mini > * { - font-size: 93%; /* 12pt */ -} - -#mini #module-list .caption, -#mini #module-header .caption { - font-size: 125%; /* 15pt */ -} - -#mini #interface h1, -#mini #interface h2, -#mini #interface h3, -#mini #interface h4 { - font-size: 109%; /* 13pt */ - margin: 1em 0 0; -} - -#mini #interface .top, -#mini #interface .src { - margin: 0; -} - -#mini #module-list ul { - list-style: none; - margin: 0; -} - -#alphabet ul { - list-style: none; - padding: 0; - margin: 0.5em 0 0; - text-align: center; -} - -#alphabet li { - display: inline; - margin: 0 0.25em; -} - -#alphabet a { - font-weight: bold; -} - -#index .caption, -#module-list .caption { font-size: 131%; /* 17pt */ } - -#index table { - margin-left: 2em; -} - -#index .src { - font-weight: bold; -} -#index .alt { - font-size: 77%; /* 10pt */ - font-style: italic; - padding-left: 2em; -} - -#index td + td { +.subs .arguments td.doc { padding-left: 1em; } -#module-list ul { - list-style: none; - margin: 0 0 0 2em; +.constructors table { + border-collapse: separate; + border-spacing: 3px; +} +.constructors td.src { + background: #f5f5f5; + padding: 5px 6px 5px 6px; + border-radius: 3px; + font-weight: bold; } -#module-list li { - clear: right; +.top > .doc, .top > .subs { + margin-left: 1em; } -#module-list span.collapser, -#module-list span.expander { - background-position: 0 0.3em; -} +.doc.empty { display: none; } -#module-list .package { - float: right; -} - -/* @end */ -body { font-family: "Open Sans", ubuntu, sans-serif; font-size: 14px } - - -#synopsis > .show > *,#synopsis > .show { - background: inherit; -} -#synopsis ul, #synopsis ul li.src { - background: inherit; -} - -#package-header { - background: #352f44; - border:0; - color: #fff !important; - line-height: 30px -} -#package-header .caption { - color: #fff !important; - background: url(/static/img/haskell-logo.png) ; - background-image: url(/static/img/haskell-logo.png); - background-size: 21px auto; - background-repeat: no-repeat; - background-position: left; - padding: 5px 5px 5px 30px; -} -a[href] { - color: #005b89 !important -} - -#package-header > ul > li > a { - color: #fff !important -} -#package-header > ul > li > a:hover { - color: #fff !important; - background: inherit; -} -#package-header .links li { - border: 0; -} -.caption { color: #6e618d!important } -pre{ background: #f8f8f8; padding: 1em; } -pre, pre * { font-family: "ubuntu mono", "Monaco" !important; font-size: 13px !important; } -#table-of-contents { - background: #f8f8f8; - border: 1px solid #eee; -} -.doc > .warning { - color: #c09853; - padding: 0px 35px 0px 14px; - margin-bottom: 20px; - text-shadow: 0 1px 0 rgba(255,255,255,0.5); - background-color: #fcf8e3; - border: 1px solid #fbeed5; - -webkit-border-radius: 2px; - -moz-border-radius: 2px; - border-radius: 2px; -} +a.selflink { float right; padding-right: 0.5em }