Skip to content

Commit

Permalink
HTML5
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Jun 16, 2011
1 parent 63e74d1 commit 34f7d95
Show file tree
Hide file tree
Showing 20 changed files with 258 additions and 467 deletions.
11 changes: 5 additions & 6 deletions Handler/ShowMap.hs
Expand Up @@ -24,12 +24,11 @@ showTree :: Int -> [Tree] -> Hamlet WikiRoute
showTree depth trees = [hamlet|
$forall tree <- trees
<section>
\<h#{show depth}>
$maybe tid <- treeTopicId tree
<a .topic-link href=@{TopicR tid}>#{treeTitle tree}
$nothing
\#{treeTitle tree}
\</h#{show depth}>
<h1>
$maybe tid <- treeTopicId tree
<a .topic-link href=@{TopicR tid}>#{treeTitle tree}
$nothing
\#{treeTitle tree}
$maybe c <- treeContent tree
$maybe tid <- treeTopicId tree
^{renderContent tid (topicContentFormat c) (topicContentContent c)}
Expand Down
1 change: 1 addition & 0 deletions TODO
@@ -1,3 +1,4 @@
Create an apple touch icon
Show topic: list where this appears (maps, the book, blogs posts, comments)?
Disqus?
Maps/topic heads in maps
Expand Down
8 changes: 4 additions & 4 deletions Util.hs
Expand Up @@ -134,10 +134,10 @@ ditaToHtml topic txml render =
Just [ContentText nt]
| nt == "other" ->
case lookup "othertype" as of
Just [ContentText ot] -> [html|<.note-#{ot}>#{x}|]
_ -> [html|<.note#{x}>|]
| otherwise -> [html|<.#{nt}>#{x}|]
_ -> [html|<.note>#{x}|]
Just [ContentText ot] -> [html|<aside .note-#{ot}>#{x}|]
_ -> [html|<aside .note-#{x}>|]
| otherwise -> [html|<aside .#{nt}>#{x}|]
_ -> [html|<aside .note>#{x}|]
go' n _ _ =
trace ("Unknown DITA element: " ++ show n) $
[html|<h1 style=color:red>Unknown DITA element: #{show n}|]
Expand Down
7 changes: 3 additions & 4 deletions Wiki.hs
Expand Up @@ -60,7 +60,7 @@ import Data.Text (Text, pack)
import Control.Applicative ((<$>), (<*>))
import Text.Hamlet (Html)
import Data.Monoid (mappend)
import Text.Hamlet.NonPoly (ihamletFile)
import Text.Hamlet.NonPoly (ihamletFile, IHamlet)
import qualified Yesod.Auth.OpenId as OpenId
import qualified Yesod.Auth.Message as Msg

Expand Down Expand Up @@ -116,15 +116,14 @@ instance Yesod Wiki where
muser <- fmap (fmap snd) maybeAuth
pc <- widgetToPageContent $ do
setTitleI title
addLucius $(Settings.luciusFile "html5reset")
widget
addCassius $(Settings.cassiusFile "default-layout")
addLucius $(Settings.luciusFile "default-layout")
atomLink FeedR "Site activity"
atomLink BlogFeedR "Blog posts"
tm <- getRouteToMaster
mcurr <- getCurrentRoute
let isHome = fmap tm mcurr == Just RootR
ihamletToRepHtml $(ihamletFile "hamlet/default-layout.hamlet")
ihamletToRepHtml ($(ihamletFile "hamlet/default-layout.hamlet") :: IHamlet WikiMessage WikiRoute)

-- This is done to provide an optimization for serving static files from
-- a separate domain. Please see the staticroot setting in Settings.hs
Expand Down
2 changes: 0 additions & 2 deletions cassius/default-layout.cassius

This file was deleted.

1 change: 0 additions & 1 deletion hamlet/book.hamlet
@@ -1,4 +1,3 @@
<h1>#{tMapTitle tm}
$forall topic <- mtopic
^{addHamlet $ renderContent (fst topic) (topicContentFormat $ snd topic) (topicContentContent $ snd topic)}
^{showTOC tocs}
119 changes: 55 additions & 64 deletions hamlet/default-layout.hamlet
@@ -1,65 +1,56 @@
\<!DOCTYPE html>
!!!
\<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
\<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
\<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
\<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<html lang="en">
<head>
<title>Yesod :: #{pageTitle pc}
<link rel=stylesheet href=@{StaticR bluevelvet_bluevelvet_css}>
<meta charset="utf-8">
^{const $ pageHead pc}
<body :isHome:.yesod-home :not isHome:.yesod-wide>
<div .yesod-main-wrapper>
<div .yesod-border-wrap>
<div .yesod-header-wrap>
<div .yesod-header>
<a .yesod-wide-logo href=@{RootR}>
<ul .yesod-primary-nav>
<li>
<a href=@{BookR}>Book
<li>
<a href=@{PageR "contributors"}>Contributors
<li>
<a href=@{PageR "community"}>Community
<li>
<a href=@{BlogR}>Blog
<li>
<a href=@{PageR "wiki"}>Wiki
<div .yesod-body>
<div .yesod-userbar>
$maybe user <- muser
<a href=@{SettingsR}>_{MsgLoggedInAs $ userName user}
\ | #
<a href=@{AuthR LogoutR}>_{MsgLogout}
$nothing
_{MsgNotLoggedIn} #
<a href=@{AuthR LoginR}>_{MsgLoginNow}
$if isHome
<div .yesod-primary-content>
^{const $ pageBody pc}
$else
<div .yesod-breadcrumb>
<p .yesod-breadcrumb-label>_{MsgYouAreHere}
<ul>
$forall bc <- bcs
<li>
<span class="yesod-breadcrumb-separator">»</span>
<a href=@{fst bc}>_{snd bc}
<li>
<span class="yesod-breadcrumb-separator">»</span>
_{title}
<div .yesod-clear>
<!-- <div .yesod-secondary-content> -->
<div .yesod-primary-content .yesod-width-fix>
$maybe msg <- mmsg
<p .message>#{msg}
^{const $ pageBody pc}
<div .yesod-footer>
Yesod is BSD licensed. The content of this site is #
<a href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Attribution-NonCommercial-ShareAlike 3.0 Unported
<br>
Site design by #
<a href="http://chrisdone.com/">Chris Done
. For site issues, contact #
<a href="mailto:michael@snoyman.com">Michael Snoyman
.
<script>
\var _gaq = _gaq || [];_gaq.push(['_setAccount', 'UA-1434510-13']);_gaq.push(['_trackPageview']);(function(){var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();
<title>#{pageTitle pc}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="/apple-touch-icon.png">

<script src=@{StaticR modernizr_js}>
^{const $ pageHead pc}
<link rel=stylesheet href=@{StaticR custom_style_css}>
<body>

<div id="container">
<nav #userbar>
$maybe user <- muser
<a href=@{SettingsR}>_{MsgLoggedInAs $ userName user}
\ | #
<a href=@{AuthR LogoutR}>_{MsgLogout}
$nothing
_{MsgNotLoggedIn} #
<a href=@{AuthR LoginR}>_{MsgLoginNow}
<nav #breadcrumbs>
_{MsgYouAreHere}
<ul>
$forall bc <- bcs
<li>
<a href=@{fst bc}>_{snd bc}
\ »
<li>
_{title}

<header>
<h1>#{pageTitle pc}

<div id="main" role="main">
^{const $ pageBody pc}

<footer>
<h1>
<a href="http://www.yesodweb.com/">Powered by Yesod


\<!--[if lt IE 7 ]><script src="js/libs/dd_belatedpng.js"></script><script>DD_belatedPNG.fix("img, .png_bg");</script><![endif]-->
<script>
var _gaq=[["_setAccount","UA-1434510-19"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
\</html>
28 changes: 15 additions & 13 deletions hamlet/login.hamlet
@@ -1,13 +1,15 @@
<p>_{MsgPleaseLogIn}
<form action=@{AuthR OpenId.forwardUrl}>
<input type=hidden name=#{name} value="https://www.google.com/accounts/o8/id">
<button>
<img src=@{StaticR google_gif} alt=Google>
<form action=@{AuthR OpenId.forwardUrl}>
<input type=hidden name=#{name} value="http://me.yahoo.com/">
<button>
<img src=@{StaticR yahoo_gif} alt=Yahoo!>
<form action=@{AuthR OpenId.forwardUrl}>
<label for=#{ident}>OpenID: #
<input id=#{ident} type=text name=#{name} value="http://">
<input type=submit value=_{Msg.LoginOpenID}>
<section #logins>
<h1>_{MsgPleaseLogIn}

<form action=@{AuthR OpenId.forwardUrl}>
<input type=hidden name=#{name} value="https://www.google.com/accounts/o8/id">
<button>
<img src=@{StaticR google_gif} alt=Google>
<form action=@{AuthR OpenId.forwardUrl}>
<input type=hidden name=#{name} value="http://me.yahoo.com/">
<button>
<img src=@{StaticR yahoo_gif} alt=Yahoo!>
<form action=@{AuthR OpenId.forwardUrl}>
<label for=#{ident}>OpenID: #
<input id=#{ident} type=text name=#{name} value="http://">
<input type=submit value=_{Msg.LoginOpenID}>
5 changes: 0 additions & 5 deletions lucius/default-layout.lucius

This file was deleted.

102 changes: 102 additions & 0 deletions lucius/html5reset.lucius
@@ -0,0 +1,102 @@
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, summary,
time, mark, audio, video {
margin:0;
padding:0;
border:0;
outline:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}

body {
line-height:1;
}

article,aside,details,figcaption,figure,
footer,header,hgroup,menu,nav,section {
display:block;
}

nav ul {
list-style:none;
}

blockquote, q {
quotes:none;
}

blockquote:before, blockquote:after,
q:before, q:after {
content:'';
content:none;
}

a {
margin:0;
padding:0;
font-size:100%;
vertical-align:baseline;
background:transparent;
}

/* change colours to suit your needs */
ins {
background-color:#ff9;
color:#000;
text-decoration:none;
}

/* change colours to suit your needs */
mark {
background-color:#ff9;
color:#000;
font-style:italic;
font-weight:bold;
}

del {
text-decoration: line-through;
}

abbr[title], dfn[title] {
border-bottom:1px dotted;
cursor:help;
}

table {
border-collapse:collapse;
border-spacing:0;
}

/* change border colour to suit your needs */
hr {
display:block;
height:1px;
border:0;
border-top:1px solid #cccccc;
margin:1em 0;
padding:0;
}

input, select {
vertical-align:middle;
}
1 change: 1 addition & 0 deletions messages/en.msg
Expand Up @@ -123,4 +123,5 @@ BrowseTitle: Browse
BlogPostTitle title@Text: #{title}
HomepageTitle: Homepage
BookTitle title@Text: #{title}
BookTitleRaw: Book
BookChapterTitle title@Text: #{title}

0 comments on commit 34f7d95

Please sign in to comment.