on master help sign in
Embedded working too
commit0ac139867f2d523d2870dd93c0fb144e5f1a3b3d authorMichael Snoyman <michael@snoyman.com> dateTue 7 Jun 2011, 14:01 (15 years ago) parent500cb45
1 file changed+15−15
Network/Wai/Application/Static.hs+15−15
Network/Wai/Application/Static.hs+15−15
@@ -614,8 +614,8 @@ defaultListing pieces (Folder _ contents) = do
614614 H.head $ do
615615 let title = T.unpack $ T.intercalate "/" $ map piecePretty pieces
616616 let title' = if null title then "root folder" else title
617− H.title $ H.string title'
618− H.style $ H.string $ unlines [ "table { margin: 0 auto; width: 760px; border-collapse: collapse; font-family: 'sans-serif'; }"
617+ H.title $ H.toHtml title'
618+ H.style $ H.toHtml $ unlines [ "table { margin: 0 auto; width: 760px; border-collapse: collapse; font-family: 'sans-serif'; }"
619619 , "table, th, td { border: 1px solid #353948; }"
620620 , "td.size { text-align: right; font-size: 0.7em; width: 50px }"
621621 , "td.date { text-align: right; font-size: 0.7em; width: 130px }"
@@ -638,12 +638,12 @@ defaultListing pieces (Folder _ contents) = do
638638 haskellSrc = image "haskell"
639639 showName "" = "root"
640640 showName x = x
641− showFolder [] = H.string "/"
642− showFolder [x] = H.string $ showName x
641+ showFolder [] = "/"
642+ showFolder [x] = H.toHtml $ showName x
643643 showFolder (x:xs) = do
644− let href = concat $ replicate (length xs) "../"
645− H.a ! A.href (H.stringValue href) $ H.string $ showName x
646− H.string " / "
644+ let href = concat $ replicate (length xs) "../" :: String
645+ H.a ! A.href (H.toValue href) $ H.toHtml $ showName x
646+ " / "
647647 showFolder xs
648648
649649-- | a function to generate an HTML table showing the contents of a directory on the disk
@@ -659,10 +659,10 @@ renderDirectoryContentsTable :: String
659659 -> [Either Folder File]
660660 -> H.Html
661661renderDirectoryContentsTable haskellSrc folderSrc fps =
662− H.table $ do H.thead $ do H.th ! (A.class_ $ H.stringValue "first") $ H.img ! (A.src $ H.stringValue haskellSrc)
663− H.th $ H.string "Name"
664− H.th $ H.string "Modified"
665− H.th $ H.string "Size"
662+ H.table $ do H.thead $ do H.th ! (A.class_ "first") $ H.img ! (A.src $ H.toValue haskellSrc)
663+ H.th "Name"
664+ H.th "Modified"
665+ H.th "Size"
666666 H.tbody $ mapM_ mkRow (zip (sortBy sortMD fps) $ cycle [False, True])
667667 where
668668 sortMD :: Either Folder File -> Either Folder File -> Ordering
@@ -672,12 +672,12 @@ renderDirectoryContentsTable haskellSrc folderSrc fps =
672672 sortMD (Right a) (Right b) = compare (fileName a) (fileName b)
673673 mkRow :: (Either Folder File, Bool) -> H.Html
674674 mkRow (md, alt) =
675− (if alt then (! A.class_ (H.stringValue "alt")) else id) $
675+ (if alt then (! A.class_ "alt") else id) $
676676 H.tr $ do
677− H.td ! A.class_ (H.stringValue "first")
677+ H.td ! A.class_ "first"
678678 $ case md of
679− Left{} -> H.img ! A.src (H.stringValue folderSrc)
680− ! A.alt (H.stringValue "Folder")
679+ Left{} -> H.img ! A.src (H.toValue folderSrc)
680+ ! A.alt "Folder"
681681 Right{} -> return ()
682682 let name = either folderName fileName md
683683 let isFile = either (const False) (const True) md