1{-# LANGUAGE OverloadedStrings #-} 2{-# OPTIONS_GHC -fno-warn-type-defaults #-} 3 4-- | An example which should always compile and demonstrates \"real\" 5-- code. 6 7module Example1 where 8 9import Control.Monad 10import Lucid 11 12demo :: Html () 13demo = 14 doctypehtml_ 15 (do head_ (do meta_ [charset_ "utf-8"] 16 meta_ [name_ "viewport" 17 ,content_ "width=device-width, initial-scale=1"] 18 link_ [href_ "//fonts.googleapis.com/css?family=Open+Sans" 19 ,rel_ "stylesheet" 20 ,type_ "text/css"] 21 link_ [href_ "//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.1.0/css/bootstrap.min.css" 22 ,rel_ "stylesheet" 23 ,type_ "text/css"] 24 title_ "YSU Closing Status") 25 body_ (div_ [class_ "container"] 26 (do h1_ "YSU Closing Status" 27 t_ [class_ "deal"] "So, here's the deal:" 28 t_ (do "The weather is currently " 29 strong_ "(unknown)" 30 " and " 31 strong_ "(unknown)" 32 ".") 33 t_ (do "There are currently " 34 strong_ "Closings!" 35 " delays/closings according to a local (Youngstown) news source.") 36 t_ (do "Youngstown State University " 37 strong_ (if False 38 then span_ [style_ "color: green;"] "WAS mentioned" 39 else span_ [style_ "color: red;"] "was NOT mentioned") 40 " among them.") 41 t_ (do "There are currently " 42 strong_ (toHtml (maybe "unknown" show (Just 123 :: Maybe Int))) 43 " weather alert(s) covering Youngstown as of " 44 strong_ "2014-23-23" 45 ".") 46 when (0 /= 1) 47 (ul_ (mapM_ (\w -> 48 li_ (do strong_ "Foo" 49 " expiring " 50 toHtml (show w))) 51 [1 .. 5])) 52 hr_ [] 53 p_ [style_ "text-align: center;"] 54 (small_ (do "This website is not affiliated Youngstown " 55 "State University in any way. It was " 56 (a_ [href_ "https://github.com/relrod/isysuclosed.com/"] 57 "written") 58 " to make a point.")) 59 p_ [style_ "text-align: center;"] 60 (small_ (do "While hopefully accurate, this is NOT an official " 61 "resource. Always confirm " 62 a_ [href_ "https://swww.ysu.edu/downloads/closing_procedure.pdf"] 63 "official" 64 " resources.")) 65 p_ [style_ "text-align: center; color: #888888"] 66 (small_ "Valid HTML5. Weather information via Weather Underground.") 67 img_ [style_ "display: block; margin: 0 auto; width: 180px;" 68 ,src_ "http://icons.wxug.com/logos/images/wundergroundLogo_4c_horz.jpg" 69 ,alt_ "Weather Underground Logo"]))) 70 where t_ :: Term a r 71 => a -> r 72 t_ = termWith "p" [class_ " t "] 73